qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: qemu-devel@nongnu.org
Cc: aurelien@aurel32.net, 600589@bugs.launchpad.net
Subject: [Qemu-devel] [PATCH] target-i386: Fix xchg rax,r8
Date: Thu,  1 Jul 2010 09:42:21 -0700	[thread overview]
Message-ID: <1278002541-16775-1-git-send-email-rth@twiddle.net> (raw)
In-Reply-To: <4C2CBF86.4060100@twiddle.net>

We were ignoring REX_B while special-casing NOP, i.e. xchg eax,eax.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 target-i386/translate.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/target-i386/translate.c b/target-i386/translate.c
index 708b0a1..8cb5cf0 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -5293,6 +5293,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
         break;
 
     case 0x91 ... 0x97: /* xchg R, EAX */
+    do_xchg_reg_eax:
         ot = dflag + OT_WORD;
         reg = (b & 7) | REX_B(s);
         rm = R_EAX;
@@ -6663,10 +6664,14 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
         /************************/
         /* misc */
     case 0x90: /* nop */
-        /* XXX: xchg + rex handling */
         /* XXX: correct lock test for all insn */
-        if (prefixes & PREFIX_LOCK)
+        if (prefixes & PREFIX_LOCK) {
             goto illegal_op;
+        }
+        /* If REX_B is set, then this is xchg eax, r8d, not a nop.  */
+        if (REX_B(s)) {
+            goto do_xchg_reg_eax;
+        }
         if (prefixes & PREFIX_REPZ) {
             gen_svm_check_intercept(s, pc_start, SVM_EXIT_PAUSE);
         }
-- 
1.7.0.1

  reply	other threads:[~2010-07-01 16:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-01 12:04 [Qemu-devel] [Bug 600589] [NEW] xchg r8,rax treated as nop Vic3Dexe
2010-07-01 16:17 ` Richard Henderson
2010-07-01 16:42   ` Richard Henderson [this message]
2010-07-01 21:52     ` [Qemu-devel] [PATCH] target-i386: Fix xchg rax,r8 Aurelien Jarno
2010-07-01 16:43   ` [Qemu-devel] [Bug 600589] [NEW] xchg r8,rax treated as nop malc
2010-07-02 19:13     ` vic3dexe
2010-07-02 20:08       ` Richard Henderson
2010-07-06 13:00 ` [Qemu-devel] [Bug 600589] " Jes Sorensen
2011-02-20 17:13 ` Aurelien Jarno

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=1278002541-16775-1-git-send-email-rth@twiddle.net \
    --to=rth@twiddle.net \
    --cc=600589@bugs.launchpad.net \
    --cc=aurelien@aurel32.net \
    --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).