x86: fix ATT syntax print immediate < 9 for MOV - issue #1456

This commit is contained in:
Nguyen Anh Quynh 2019-04-12 23:15:20 +08:00
parent b22d76226a
commit 58022575d7
2 changed files with 10 additions and 1 deletions

View File

@ -621,7 +621,10 @@ static void printOperand(MCInst *MI, unsigned OpNo, SStream *O)
case X86_INS_MOVABS:
case X86_INS_MOV:
// do not print number in negative form
SStream_concat(O, "$0x%"PRIx64, imm);
if (imm > HEX_THRESHOLD)
SStream_concat(O, "$0x%"PRIx64, imm);
else
SStream_concat(O, "$%"PRIu64, imm);
break;
case X86_INS_IN:

View File

@ -1,3 +1,9 @@
!# issue 1456
!# CS_ARCH_X86, CS_MODE_32, CS_OPT_SYNTAX_ATT
0xb8,0x00,0x00,0x00,0x00 == movl $0, %eax
0xd1,0x5e,0x48 == rcrl $1, 0x48(%esi)
!# issue 1456
!# CS_ARCH_X86, CS_MODE_32, None
0xd1,0x5e,0x48 == rcr dword ptr [esi + 0x48], 1