qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] handle multibyte NOPs
@ 2006-08-18 23:40 Igor Kovalenko
  2006-08-19  0:28 ` Paul Brook
  0 siblings, 1 reply; 9+ messages in thread
From: Igor Kovalenko @ 2006-08-18 23:40 UTC (permalink / raw)
  To: qemu-devel


[-- Attachment #1.1: Type: text/plain, Size: 239 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 269 bytes --]

[-- Attachment #2: x86-multibyte-noop.diff --]
[-- Type: text/plain, Size: 1529 bytes --]

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) {

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-08-30 19:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-18 23:40 [Qemu-devel] [PATCH] handle multibyte NOPs Igor Kovalenko
2006-08-19  0:28 ` Paul Brook
2006-08-20 21:51   ` Igor Kovalenko
2006-08-20 22:15     ` malc
2006-08-20 22:28       ` Igor Kovalenko
2006-08-20 22:39         ` malc
2006-08-20 22:47           ` Igor Kovalenko
2006-08-20 23:18             ` malc
2006-08-30 19:27               ` Igor Kovalenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).