x86: another attempt for #456
diff --git a/arch/X86/X86ATTInstPrinter.c b/arch/X86/X86ATTInstPrinter.c
index 35f1c26..2e93e08 100644
--- a/arch/X86/X86ATTInstPrinter.c
+++ b/arch/X86/X86ATTInstPrinter.c
@@ -462,9 +462,13 @@
}
// CALL/JMP rel16 is special
- if (MI->Opcode == X86_CALLpcrel16 || MI->Opcode == X86_JMP_2 || MI->Opcode == X86_JMP_4)
+ if (MI->Opcode == X86_CALLpcrel16 || MI->Opcode == X86_JMP_2)
imm = imm & 0xffff;
+ if (MI->csh->mode == CS_MODE_16 && MI->Opcode == X86_JMP_4)
+ imm = imm & 0xffff;
+
+
if (imm < 0) {
SStream_concat(O, "0x%"PRIx64, imm);
} else {
diff --git a/arch/X86/X86IntelInstPrinter.c b/arch/X86/X86IntelInstPrinter.c
index 4fdd9c3..0d7ae7b 100644
--- a/arch/X86/X86IntelInstPrinter.c
+++ b/arch/X86/X86IntelInstPrinter.c
@@ -544,7 +544,10 @@
}
// CALL/JMP rel16 is special
- if (MI->Opcode == X86_CALLpcrel16 || MI->Opcode == X86_JMP_2 || MI->Opcode == X86_JMP_4)
+ if (MI->Opcode == X86_CALLpcrel16 || MI->Opcode == X86_JMP_2)
+ imm = imm & 0xffff;
+
+ if (MI->csh->mode == CS_MODE_16 && MI->Opcode == X86_JMP_4)
imm = imm & 0xffff;
if (imm < 0) {