x86: print out immediate as positive number for logic arithmetic operations: AND, OR, XOR. only works for x86 Intel syntax so far. issue reported by Pancake
diff --git a/cs.c b/cs.c
index 587c1b8..04bc615 100644
--- a/cs.c
+++ b/cs.c
@@ -264,9 +264,6 @@
memcpy(insn->bytes, code + insn->size - copy_size, copy_size);
insn->size = copy_size;
- // map internal instruction opcode to public insn ID
- handle->insn_id(handle, insn, MCInst_getOpcode(mci));
-
// alias instruction might have ID saved in OpcodePub
if (MCInst_getOpcodePub(mci))
insn->id = MCInst_getOpcodePub(mci);
@@ -481,7 +478,12 @@
SStream_Init(&ss);
mci.flat_insn->size = insn_size;
+
+ // map internal instruction opcode to public insn ID
+ handle->insn_id(handle, insn_cache, mci.Opcode);
+
handle->printer(&mci, &ss, handle->printer_info);
+
fill_insn(handle, insn_cache, ss.buffer, &mci, handle->post_printer, buffer);
next_offset = insn_size;
@@ -680,8 +682,14 @@
SStream_Init(&ss);
mci.flat_insn->size = insn_size;
+
+ // map internal instruction opcode to public insn ID
+ handle->insn_id(handle, insn, mci.Opcode);
+
handle->printer(&mci, &ss, handle->printer_info);
+
fill_insn(handle, insn, ss.buffer, &mci, handle->post_printer, *code);
+
*code += insn_size;
*size -= insn_size;
*address += insn_size;