Fix the partial disassembly of a broken three byte instruction at the end of a function.
authorJan Stancek <jstancek@redhat.com>
Mon, 24 Aug 2015 13:50:15 +0000 (14:50 +0100)
committerNick Clifton <nickc@redhat.com>
Mon, 24 Aug 2015 13:50:15 +0000 (14:50 +0100)
opcodes * i386-dis.c (print_insn): Fix decoding of three byte operands.

tests * gas/i386/intel.s: Add test of disassembly of a potential
three byte instuction at the end of a function.
* gas/i386/intel.d: Update expected disassembly.

gas/testsuite/ChangeLog
gas/testsuite/gas/i386/intel.d
gas/testsuite/gas/i386/intel.s
opcodes/ChangeLog
opcodes/i386-dis.c

index 2951966c0a26df5c58d6b83ff7391e5d5ab708db..6b85249695835a8395642ac6228d3c497e6d878b 100644 (file)
@@ -1,3 +1,9 @@
+2015-08-24  Jan Stancek  <jstancek@redhat.com>
+
+       * gas/i386/intel.s: Add test of disassembly of a potential
+       three byte instuction at the end of a function.
+       * gas/i386/intel.d: Update expected disassembly.
+
 2015-08-21  Nick Clifton  <nickc@redhat.com>
 
        PR gas/18581
index 45a66a5e41f589f3576c0d99512d7f774cdcafde..d10b4f00bb499898763b711558a11dfc202b015d 100644 (file)
@@ -698,4 +698,8 @@ Disassembly of section .text:
 [      ]*[a-f0-9]+:    0f 4b 90 90 90 90 90    cmovnp -0x6f6f6f70\(%eax\),%edx
 [      ]*[a-f0-9]+:    66 0f 4a 90 90 90 90 90         cmovp  -0x6f6f6f70\(%eax\),%dx
 [      ]*[a-f0-9]+:    66 0f 4b 90 90 90 90 90         cmovnp -0x6f6f6f70\(%eax\),%dx
+[      ]*[a-f0-9]+:    24 2f                   and    \$0x2f,%al
+[      ]*[a-f0-9]+:    0f                      \.byte 0xf
+[a-f0-9]+ <barn>:
+[      ]*[a-f0-9]+:    0f ba e2 03             bt     \$0x3,%edx
 #pass
index a3a07b336a429cd09d299e609e54af5d518f5ce5..045d6ae0fd0a57251b858010e7eadeb995f9ffcf 100644 (file)
@@ -698,3 +698,14 @@ fidivr  dword ptr [ebx]
  cmovpo edx, 0x90909090[eax]
  cmovpe  dx, 0x90909090[eax]
  cmovpo dx, 0x90909090[eax]
+
+       # Test that disassembly of a partial instruction shows the partial byte:
+       # https://www.sourceware.org/ml/binutils/2015-08/msg00226.html
+       .byte 0x24
+       .byte 0x2f
+       .byte 0x0f
+barn:
+        .byte 0x0f
+        .byte 0xba
+        .byte 0xe2
+        .byte 0x03
index 89e150fa42d8606b637d2d849e9a7c8d46f4ed04..3529dbc66a12638666a8471c015bbfc5ef81bf45 100644 (file)
@@ -1,3 +1,7 @@
+2015-08-24  Jan Stancek  <jstancek@redhat.com>
+
+       * i386-dis.c (print_insn): Fix decoding of three byte operands.
+
 2015-08-21  Alexander Fomin  <alexander.fomin@intel.com>
 
        PR binutils/18257
index 055b38f98639a8a2ad1e8a239d2c1aad844c6d41..ae18cf2dee03f31883bf064c56d6e5a4465cb195 100644 (file)
@@ -13438,8 +13438,10 @@ print_insn (bfd_vma pc, disassemble_info *info)
   if (*codep == 0x0f)
     {
       unsigned char threebyte;
-      FETCH_DATA (info, codep + 2);
-      threebyte = *++codep;
+
+      codep++;
+      FETCH_DATA (info, codep + 1);
+      threebyte = *codep;
       dp = &dis386_twobyte[threebyte];
       need_modrm = twobyte_has_modrm[*codep];
       codep++;
This page took 0.030093 seconds and 4 git commands to generate.