[PATCH] D38786: Fix for Bug 30718 - Failure to disassemble certain MOV with rex.R

Andrew V. Tischenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 11 01:31:58 PDT 2017


avt77 created this revision.

This tiny patch fixes the issue in the title.


https://reviews.llvm.org/D38786

Files:
  lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp
  test/MC/Disassembler/X86/x86-64.txt


Index: test/MC/Disassembler/X86/x86-64.txt
===================================================================
--- test/MC/Disassembler/X86/x86-64.txt
+++ test/MC/Disassembler/X86/x86-64.txt
@@ -486,3 +486,9 @@
 
 # CHECK: nopq %rax
 0x48 0x0f 0x1f 0xC0
+
+# CHECK: movq    %rdx, %cs
+0x4c 0x8e 0xca
+
+# CHECK: movq    %rdx, %cs
+0x48 0x8e 0xca
Index: lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp
===================================================================
--- lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp
+++ lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp
@@ -1483,6 +1483,7 @@
     case TYPE_MM64:                                       \
       return prefix##_MM0 + (index & 0x7);                \
     case TYPE_SEGMENTREG:                                 \
+      index = regFromModRM(insn->modRM);                  \
       if (index > 5)                                      \
         *valid = 0;                                       \
       return prefix##_ES + index;                         \


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38786.118557.patch
Type: text/x-patch
Size: 1043 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171011/4bc3b469/attachment.bin>


More information about the llvm-commits mailing list