Hi!

This patch adds handling of multi-byte NOPs, recent gcc/gas uses them for x86 code padding.
Patch checked with current opensuse-factory x86 guest installation which is built with new gcc/gas tools.

--
Kind Regards,
Igor V. Kovalenko

Index: target-i386/translate.c
===================================================================
RCS file: /cvsroot/qemu/qemu/target-i386/translate.c,v
retrieving revision 1.59
diff -u -r1.59 translate.c
--- target-i386/translate.c     10 Jul 2006 19:53:04 -0000      1.59
+++ target-i386/translate.c     18 Aug 2006 23:23:40 -0000
@@ -5795,6 +5795,49 @@
             goto illegal_op;
         }
         break;
+    case 0x11f:
+        /* multi-byte noop */
+
+        modrm = ldub_code(s->pc++);
+        rm  = modrm & 7;
+        mod = (modrm >> 6) & 3;
+        reg = (modrm >> 3) & 7;
+
+        if (reg != 0)
+        {
+            goto illegal_op;
+        }
+
+        if (rm == 0x04)
+        {
+            /* SIB byte follows */
+            s->pc += 1;
+        }
+
+        switch (mod)
+        {
+            case 0x00:
+                if (rm == 0x05)
+                {
+                    /* 32bit data follows */
+                    s->pc += 4;
+                }
+                /* else register is specified */
+                break;
+            case 0x01:
+                /* 8bit data follows */
+                s->pc += 1;
+                break;
+            case 0x10:
+                /* 32bit data follows */
+                s->pc += 4;
+                break;
+            case 0x11:
+            default:
+                /* register is specified */
+                break;
+        }
+        break;
     case 0x120: /* mov reg, crN */
     case 0x122: /* mov crN, reg */
         if (s->cpl != 0) {
_______________________________________________
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel

Reply via email to