OSDN Git Service

ART: Correct disassembling of 64bit immediates on x86_64
authorVladimir Kostyukov <vladimir.kostyukov@intel.com>
Wed, 23 Jul 2014 05:10:07 +0000 (12:10 +0700)
committerVladimir Kostyukov <vladimir.kostyukov@intel.com>
Wed, 30 Jul 2014 07:41:43 +0000 (07:41 +0000)
The patch fixes an issue with disassembling 'movsxd' and 'movabsq'
instructions altered with 64bit immediates: not only a REX.W prefix
may be prepended to these instructions.

Change-Id: Ida7c7b368327a6b5cae1ff12ec00ceb0769c0a3d
Signed-off-by: Vladimir Kostyukov <vladimir.kostyukov@intel.com>
disassembler/disassembler_x86.cc

index 101a55d..0ca8962 100644 (file)
@@ -268,7 +268,7 @@ DISASSEMBLER_ENTRY(cmp,
     target_specific = true;
     break;
   case 0x63:
-    if (rex == 0x48) {
+    if ((rex & REX_W) != 0) {
       opcode << "movsxd";
       has_modrm = true;
       load = true;
@@ -959,7 +959,7 @@ DISASSEMBLER_ENTRY(cmp,
     byte_operand = true;
     break;
   case 0xB8: case 0xB9: case 0xBA: case 0xBB: case 0xBC: case 0xBD: case 0xBE: case 0xBF:
-    if (rex == 0x48) {
+    if ((rex & REX_W) != 0) {
       opcode << "movabsq";
       immediate_bytes = 8;
       reg_in_opcode = true;