Merge "Support disassembly of 16-bit immediates"
diff --git a/disassembler/disassembler_x86.cc b/disassembler/disassembler_x86.cc
index cba4ebf..614eca1 100644
--- a/disassembler/disassembler_x86.cc
+++ b/disassembler/disassembler_x86.cc
@@ -1040,8 +1040,13 @@
instr++;
} else {
CHECK_EQ(immediate_bytes, 4u);
- args << StringPrintf("%d", *reinterpret_cast<const int32_t*>(instr));
- instr += 4;
+ if (prefix[2] == 0x66) { // Operand size override from 32-bit to 16-bit.
+ args << StringPrintf("%d", *reinterpret_cast<const int16_t*>(instr));
+ instr += 2;
+ } else {
+ args << StringPrintf("%d", *reinterpret_cast<const int32_t*>(instr));
+ instr += 4;
+ }
}
} else if (branch_bytes > 0) {
DCHECK(!has_modrm);