From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=36267 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OURiQ-0003RA-Vq for qemu-devel@nongnu.org; Thu, 01 Jul 2010 17:54:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OURiI-0003Ij-My for qemu-devel@nongnu.org; Thu, 01 Jul 2010 17:54:38 -0400 Received: from hall.aurel32.net ([88.191.82.174]:48294) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OURiI-0003Ic-Hz for qemu-devel@nongnu.org; Thu, 01 Jul 2010 17:54:30 -0400 Date: Thu, 1 Jul 2010 23:52:48 +0200 From: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH] target-i386: Fix xchg rax,r8 Message-ID: <20100701215248.GD25251@ohm.aurel32.net> References: <4C2CBF86.4060100@twiddle.net> <1278002541-16775-1-git-send-email-rth@twiddle.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <1278002541-16775-1-git-send-email-rth@twiddle.net> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: qemu-devel@nongnu.org, 600589@bugs.launchpad.net On Thu, Jul 01, 2010 at 09:42:21AM -0700, Richard Henderson wrote: > We were ignoring REX_B while special-casing NOP, i.e. xchg eax,eax. > > Signed-off-by: Richard Henderson > --- > target-i386/translate.c | 9 +++++++-- > 1 files changed, 7 insertions(+), 2 deletions(-) Applied, thanks. > 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 > > > -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net