qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Igor Kovalenko" <igor.v.kovalenko@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] handle multibyte NOPs
Date: Sat, 19 Aug 2006 03:40:04 +0400	[thread overview]
Message-ID: <b2fa41d60608181640l34ce4bf7kb309a52dc5ef565d@mail.gmail.com> (raw)


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

             reply	other threads:[~2006-08-18 23:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-18 23:40 Igor Kovalenko [this message]
2006-08-19  0:28 ` [Qemu-devel] [PATCH] handle multibyte NOPs 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b2fa41d60608181640l34ce4bf7kb309a52dc5ef565d@mail.gmail.com \
    --to=igor.v.kovalenko@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).