x86: fix #456 for AT&T syntax

This commit is contained in:
Nguyen Anh Quynh 2015-08-19 09:37:24 +08:00
parent 343a98d8a4
commit 94874ed436

View File

@ -525,6 +525,15 @@ static void printPCRelImm(MCInst *MI, unsigned OpNo, SStream *O)
imm = imm & 0xffffffff;
}
if (MI->csh->mode == CS_MODE_16 &&
(MI->Opcode != X86_JMP_4 && MI->Opcode != X86_CALLpcrel32))
imm = imm & 0xffff;
// Hack: X86 16bit with opcode X86_JMP_4
if (MI->csh->mode == CS_MODE_16 &&
(MI->Opcode == X86_JMP_4 && MI->x86_prefix[2] != 0x66))
imm = imm & 0xffff;
// CALL/JMP rel16 is special
if (MI->Opcode == X86_CALLpcrel16 || MI->Opcode == X86_JMP_2)
imm = imm & 0xffff;
@ -532,10 +541,6 @@ static void printPCRelImm(MCInst *MI, unsigned OpNo, SStream *O)
if (imm < 0) {
SStream_concat(O, "0x%"PRIx64, imm);
} else {
// handle 16bit segment bound
if (MI->csh->mode == CS_MODE_16)
imm = imm & 0xffff;
if (imm > HEX_THRESHOLD)
SStream_concat(O, "0x%"PRIx64, imm);
else