ppc: fix target address for bdnzt

This commit is contained in:
Nguyen Anh Quynh 2019-05-10 14:38:51 +08:00
parent 71c59fce93
commit bb6b2c137e
2 changed files with 12 additions and 0 deletions

View File

@ -574,6 +574,13 @@ void PPC_printInst(MCInst *MI, SStream *O, void *Info)
MCOperand_setImm(MCInst_getOperand(MI, 0), bd);
}
if ((MCInst_getOpcode(MI) == PPC_gBC) || (MCInst_getOpcode(MI) == PPC_gBCA) ||
(MCInst_getOpcode(MI) == PPC_gBCL) || (MCInst_getOpcode(MI) == PPC_gBCLA)) {
int64_t bd = MCOperand_getImm(MCInst_getOperand(MI, 2));
bd = SignExtend64(bd, 14);
MCOperand_setImm(MCInst_getOperand(MI, 2), bd);
}
mnem = printAliasBcc(MI, O, Info);
if (!mnem)
mnem = printAliasInstr(MI, O, Info);
@ -977,6 +984,7 @@ static void printAbsBranchOperand(MCInst *MI, unsigned OpNo, SStream *O)
}
imm = SignExtend32(MCOperand_getImm(MCInst_getOperand(MI, OpNo)) * 4, 32);
//imm = MCOperand_getImm(MCInst_getOperand(MI, OpNo)) * 4;
if (!PPC_abs_branch(MI->csh, MCInst_getOpcode(MI))) {
imm = MI->address + imm;

View File

@ -1,3 +1,7 @@
!# issue PPC bdnzt
!# CS_ARCH_PPC, CS_MODE_64 | CS_MODE_BIG_ENDIAN, None
0x1000: 0x41,0x00,0xff,0xac == bdnzt lt, 0xfac
!# issue 1469 PPC CRx
!# CS_ARCH_PPC, CS_MODE_64 | CS_MODE_BIG_ENDIAN, CS_OPT_DETAIL
0x4c,0x02,0x39,0x82 == crxor cr0lt, cr0eq, cr1un ; operands[0].type: REG = cr0lt