From: Sean Callanan Date: Fri, 22 Oct 2010 01:24:11 +0000 (+0000) Subject: Fixed handling of immediate operand sizes, which X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=751752e7caee441c0b50585c77637b36b048f235;p=oota-llvm.git Fixed handling of immediate operand sizes, which weren't properly reflecting the OperandSize attribute of the instruction leading to improper decoding of certain instructions with the 66H prefix. Also added a test case for this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117084 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c b/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c index 6c3ff6bd4a5..22b38b9d7d2 100644 --- a/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c +++ b/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c @@ -405,7 +405,7 @@ static int readPrefixes(struct InternalInstruction* insn) { insn->registerSize = (hasOpSize ? 2 : 4); insn->addressSize = (hasAdSize ? 2 : 4); insn->displacementSize = (hasAdSize ? 2 : 4); - insn->immediateSize = (hasAdSize ? 2 : 4); + insn->immediateSize = (hasOpSize ? 2 : 4); } else if (insn->mode == MODE_64BIT) { if (insn->rexPrefix && wFromREX(insn->rexPrefix)) { insn->registerSize = 8; diff --git a/test/MC/Disassembler/simple-tests.txt b/test/MC/Disassembler/simple-tests.txt index 48a439e80dd..13a19d2ca4c 100644 --- a/test/MC/Disassembler/simple-tests.txt +++ b/test/MC/Disassembler/simple-tests.txt @@ -63,3 +63,6 @@ # CHECK: enter $1, $2 0xc8 0x01 0x00 0x02 + +# CHECK: movw $47416, -66(%rbp) +0x66 0xc7 0x45 0xbe 0x38 0xb9