arm: add IMM operand for printPostIdxImm8s4Operand(). issue #861

This commit is contained in:
Nguyen Anh Quynh 2017-02-22 09:26:54 +08:00
parent eebd47d78a
commit 695e60be9d

View File

@ -1266,10 +1266,19 @@ static void printPostIdxImm8s4Operand(MCInst *MI, unsigned OpNum, SStream *O)
{
MCOperand *MO = MCInst_getOperand(MI, OpNum);
unsigned Imm = (unsigned int)MCOperand_getImm(MO);
if (((Imm & 0xff) << 2) > HEX_THRESHOLD)
if (((Imm & 0xff) << 2) > HEX_THRESHOLD) {
SStream_concat(O, "#%s0x%x", ((Imm & 256) ? "" : "-"), ((Imm & 0xff) << 2));
else
} else {
SStream_concat(O, "#%s%u", ((Imm & 256) ? "" : "-"), ((Imm & 0xff) << 2));
}
if (MI->csh->detail) {
int v = (Imm & 256) ? ((Imm & 0xff) << 2) : -((Imm & 0xff) << 2);
MI->flat_insn->detail->arm.operands[MI->flat_insn->detail->arm.op_count].type = ARM_OP_IMM;
MI->flat_insn->detail->arm.operands[MI->flat_insn->detail->arm.op_count].imm = v;
MI->flat_insn->detail->arm.op_count++;
}
}
static void printAddrMode5Operand(MCInst *MI, unsigned OpNum, SStream *O,