|
|
|
@ -133,8 +133,12 @@ static void printMemOffset(MCInst *MI, unsigned Op, SStream *O) |
|
|
|
|
MI->pub_insn.x86.operands[MI->pub_insn.x86.op_count].mem.disp = imm; |
|
|
|
|
if (imm < 0) |
|
|
|
|
SStream_concat(O, "-0x%"PRIx64, -imm); |
|
|
|
|
else |
|
|
|
|
SStream_concat(O, "0x%"PRIx64, imm); |
|
|
|
|
else { |
|
|
|
|
if (imm > HEX_THRESHOLD) |
|
|
|
|
SStream_concat(O, "0x%"PRIx64, imm); |
|
|
|
|
else |
|
|
|
|
SStream_concat(O, "%"PRIu64, imm); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
SStream_concat(O, "%s", markup(">")); |
|
|
|
@ -257,8 +261,12 @@ static void printPCRelImm(MCInst *MI, unsigned OpNo, SStream *O) |
|
|
|
|
int64_t imm = MCOperand_getImm(Op) + MI->pub_insn.size + MI->pub_insn.address; |
|
|
|
|
if (imm < 0) |
|
|
|
|
SStream_concat(O, "-0x%"PRIx64, -imm); |
|
|
|
|
else |
|
|
|
|
SStream_concat(O, "0x%"PRIx64, imm); |
|
|
|
|
else { |
|
|
|
|
if (imm > HEX_THRESHOLD) |
|
|
|
|
SStream_concat(O, "0x%"PRIx64, imm); |
|
|
|
|
else |
|
|
|
|
SStream_concat(O, "%"PRIu64, imm); |
|
|
|
|
} |
|
|
|
|
MI->pub_insn.x86.operands[MI->pub_insn.x86.op_count].type = X86_OP_IMM; |
|
|
|
|
MI->pub_insn.x86.operands[MI->pub_insn.x86.op_count].imm = imm; |
|
|
|
|
MI->pub_insn.x86.op_count++; |
|
|
|
@ -276,7 +284,10 @@ static void printOperand(MCInst *MI, unsigned OpNo, SStream *O) |
|
|
|
|
} else if (MCOperand_isImm(Op)) { |
|
|
|
|
// Print X86 immediates as signed values.
|
|
|
|
|
int64_t imm = MCOperand_getImm(Op); |
|
|
|
|
SStream_concat(O, "%s$0x%"PRIx64"%s", markup("<imm:"), imm, markup(">")); |
|
|
|
|
if (imm > HEX_THRESHOLD) |
|
|
|
|
SStream_concat(O, "%s$0x%"PRIx64"%s", markup("<imm:"), imm, markup(">")); |
|
|
|
|
else |
|
|
|
|
SStream_concat(O, "%s$%"PRIu64"%s", markup("<imm:"), imm, markup(">")); |
|
|
|
|
MI->pub_insn.x86.operands[MI->pub_insn.x86.op_count].type = X86_OP_IMM; |
|
|
|
|
MI->pub_insn.x86.operands[MI->pub_insn.x86.op_count].imm = imm; |
|
|
|
|
MI->pub_insn.x86.op_count++; |
|
|
|
@ -294,8 +305,12 @@ static void _printOperand(MCInst *MI, unsigned OpNo, SStream *O) |
|
|
|
|
int64_t imm = MCOperand_getImm(Op); |
|
|
|
|
if (imm < 0) |
|
|
|
|
SStream_concat(O, "%s$-0x%"PRIx64"%s", markup("<imm:"), -imm, markup(">")); |
|
|
|
|
else |
|
|
|
|
SStream_concat(O, "%s$0x%"PRIx64"%s", markup("<imm:"), imm, markup(">")); |
|
|
|
|
else { |
|
|
|
|
if (imm > HEX_THRESHOLD) |
|
|
|
|
SStream_concat(O, "%s$0x%"PRIx64"%s", markup("<imm:"), imm, markup(">")); |
|
|
|
|
else |
|
|
|
|
SStream_concat(O, "%s$%"PRIu64"%s", markup("<imm:"), imm, markup(">")); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -326,8 +341,12 @@ static void printMemReference(MCInst *MI, unsigned Op, SStream *O) |
|
|
|
|
if (DispVal || (!MCOperand_getReg(IndexReg) && !MCOperand_getReg(BaseReg))) { |
|
|
|
|
if (DispVal < 0) |
|
|
|
|
SStream_concat(O, "-0x%"PRIx64, -DispVal); |
|
|
|
|
else |
|
|
|
|
SStream_concat(O, "0x%"PRIx64, DispVal); |
|
|
|
|
else { |
|
|
|
|
if (DispVal > HEX_THRESHOLD) |
|
|
|
|
SStream_concat(O, "0x%"PRIx64, DispVal); |
|
|
|
|
else |
|
|
|
|
SStream_concat(O, "%"PRIu64, DispVal); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|