mirror of
https://github.com/capstone-engine/capstone.git
synced 2024-11-23 13:39:46 +00:00
ppc: fix target address of bdnz. issue #1468
This commit is contained in:
parent
b6924f4b86
commit
7ce9c792b1
@ -384,6 +384,11 @@ static char *printAliasBcc(MCInst *MI, SStream *OS, void *info)
|
||||
return tmp;
|
||||
}
|
||||
|
||||
static bool isBOCTRBranch(unsigned int op)
|
||||
{
|
||||
return ((op >= PPC_BDNZ) && (op <= PPC_BDZp));
|
||||
}
|
||||
|
||||
void PPC_printInst(MCInst *MI, SStream *O, void *Info)
|
||||
{
|
||||
char *mnem;
|
||||
@ -581,6 +586,14 @@ void PPC_printInst(MCInst *MI, SStream *O, void *Info)
|
||||
MCOperand_setImm(MCInst_getOperand(MI, 2), bd);
|
||||
}
|
||||
|
||||
if (isBOCTRBranch(MCInst_getOpcode(MI))) {
|
||||
if (MCOperand_isImm(MCInst_getOperand(MI,0))) {
|
||||
int64_t bd = MCOperand_getImm(MCInst_getOperand(MI, 0));
|
||||
bd = SignExtend64(bd, 14);
|
||||
MCOperand_setImm(MCInst_getOperand(MI, 0), bd);
|
||||
}
|
||||
}
|
||||
|
||||
mnem = printAliasBcc(MI, O, Info);
|
||||
if (!mnem)
|
||||
mnem = printAliasInstr(MI, O, Info);
|
||||
|
@ -1,3 +1,7 @@
|
||||
!# issue 1468 PPC bdnz
|
||||
!# CS_ARCH_PPC, CS_MODE_64 | CS_MODE_BIG_ENDIAN, None
|
||||
0x101086c: 0x42,0x00,0xff,0xf8 == bdnz 0x1010864
|
||||
|
||||
!# issue PPC bdnzt
|
||||
!# CS_ARCH_PPC, CS_MODE_64 | CS_MODE_BIG_ENDIAN, None
|
||||
0x1000: 0x41,0x00,0xff,0xac == bdnzt lt, 0xfac
|
||||
|
Loading…
Reference in New Issue
Block a user