|
|
|
@ -210,10 +210,7 @@ static void printMemOffset(MCInst *MI, unsigned Op, SStream *O) |
|
|
|
|
if (MI->csh->detail) |
|
|
|
|
MI->flat_insn.x86.operands[MI->flat_insn.x86.op_count].mem.disp = imm; |
|
|
|
|
if (imm < 0) { |
|
|
|
|
if (imm < -HEX_THRESHOLD) |
|
|
|
|
SStream_concat(O, "-0x%"PRIx64, -imm); |
|
|
|
|
else |
|
|
|
|
SStream_concat(O, "-%"PRIu64, -imm); |
|
|
|
|
SStream_concat(O, "0x%"PRIx64, arch_masks[MI->csh->mode] & imm); |
|
|
|
|
} else { |
|
|
|
|
if (imm > HEX_THRESHOLD) |
|
|
|
|
SStream_concat(O, "0x%"PRIx64, imm); |
|
|
|
@ -373,7 +370,7 @@ static void printOperand(MCInst *MI, unsigned OpNo, SStream *O) |
|
|
|
|
else |
|
|
|
|
SStream_concat(O, "%s$%"PRIu64"%s", markup("<imm:"), imm, markup(">")); |
|
|
|
|
} else { |
|
|
|
|
SStream_concat(O, "%s$0x%"PRIx64"%s", markup("<imm:"), ((1 << 8*MI->x86_imm_size) - 1) & imm, markup(">")); |
|
|
|
|
SStream_concat(O, "%s$0x%"PRIx64"%s", markup("<imm:"), arch_masks[MI->x86_imm_size] & imm, markup(">")); |
|
|
|
|
} |
|
|
|
|
if (MI->csh->detail) { |
|
|
|
|
MI->flat_insn.x86.operands[MI->flat_insn.x86.op_count].type = X86_OP_IMM; |
|
|
|
@ -393,7 +390,7 @@ static void _printOperand(MCInst *MI, unsigned OpNo, SStream *O) |
|
|
|
|
// Print X86 immediates as signed values.
|
|
|
|
|
int64_t imm = MCOperand_getImm(Op); |
|
|
|
|
if (imm < 0) { |
|
|
|
|
SStream_concat(O, "%s$0x%"PRIx64"%s", markup("<imm:"), ((1 << 8*MI->x86_imm_size) - 1) & imm, markup(">")); |
|
|
|
|
SStream_concat(O, "%s$0x%"PRIx64"%s", markup("<imm:"), arch_masks[MI->x86_imm_size] & imm, markup(">")); |
|
|
|
|
} else { |
|
|
|
|
if (imm > HEX_THRESHOLD) |
|
|
|
|
SStream_concat(O, "%s$0x%"PRIx64"%s", markup("<imm:"), imm, markup(">")); |
|
|
|
@ -432,7 +429,7 @@ static void printMemReference(MCInst *MI, unsigned Op, SStream *O) |
|
|
|
|
MI->flat_insn.x86.operands[MI->flat_insn.x86.op_count].mem.disp = DispVal; |
|
|
|
|
if (DispVal || (!MCOperand_getReg(IndexReg) && !MCOperand_getReg(BaseReg))) { |
|
|
|
|
if (DispVal < 0) { |
|
|
|
|
SStream_concat(O, "0x%"PRIx64, ((1L << (8*MI->csh->mode)) - 1) & DispVal); |
|
|
|
|
SStream_concat(O, "0x%"PRIx64, arch_masks[MI->csh->mode] & DispVal); |
|
|
|
|
} else { |
|
|
|
|
if (DispVal > HEX_THRESHOLD) |
|
|
|
|
SStream_concat(O, "0x%"PRIx64, DispVal); |
|
|
|
|