ppc: BDZLA is absolute branch. fix issue #968

This commit is contained in:
Nguyen Anh Quynh 2019-05-16 11:06:24 +08:00
parent 41fdced346
commit baf70c9755
3 changed files with 11 additions and 2 deletions

View File

@ -1001,7 +1001,7 @@ static void printAbsBranchOperand(MCInst *MI, unsigned OpNo, SStream *O)
//imm = MCOperand_getImm(MCInst_getOperand(MI, OpNo)) * 4;
if (!PPC_abs_branch(MI->csh, MCInst_getOpcode(MI))) {
imm = MI->address + imm;
imm += MI->address;
}
printUInt64(O, imm);

View File

@ -531,7 +531,7 @@ bool PPC_alias_insn(const char *name, struct ppc_alias *alias)
bool PPC_abs_branch(cs_struct *h, unsigned int id)
{
unsigned int i;
// list all relative branch instructions
// list all absolute branch instructions
static const unsigned int insn_abs[] = {
PPC_BA,
PPC_BCCA,
@ -550,6 +550,7 @@ bool PPC_abs_branch(cs_struct *h, unsigned int id)
PPC_BLA,
PPC_gBCA,
PPC_gBCLA,
PPC_BDZLA,
0
};

View File

@ -1,3 +1,11 @@
!# issue 968 PPC absolute branch: bdnzla
!# CS_ARCH_PPC, CS_MODE_64 | CS_MODE_BIG_ENDIAN, None
0x1000: 0x42,0x00,0x12,0x37 == bdnzla 0x1234
!# issue 968 PPC absolute branch: bdzla
!# CS_ARCH_PPC, CS_MODE_64 | CS_MODE_BIG_ENDIAN, None
0x1000: 0x42,0x40,0x12,0x37 == bdzla 0x1234
!# issue X86 xrelease xchg
!# CS_ARCH_X86, CS_MODE_32, None
0xf3,0x87,0x03 == xrelease xchg dword ptr [ebx], eax