From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:51833) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UgWOh-0004bI-LO for qemu-devel@nongnu.org; Sun, 26 May 2013 04:33:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UgWOg-00017d-Pk for qemu-devel@nongnu.org; Sun, 26 May 2013 04:33:47 -0400 Received: from mail-ea0-x22c.google.com ([2a00:1450:4013:c01::22c]:35096) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UgWOg-00017Z-Ik for qemu-devel@nongnu.org; Sun, 26 May 2013 04:33:46 -0400 Received: by mail-ea0-f172.google.com with SMTP id d10so3397819eaj.3 for ; Sun, 26 May 2013 01:33:45 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <51A1C8DF.506@redhat.com> Date: Sun, 26 May 2013 10:33:35 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1369431456-11887-1-git-send-email-lersek@redhat.com> <51A147DB.2020606@twiddle.net> In-Reply-To: <51A147DB.2020606@twiddle.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] i386/translate: ignore 0x67 (PREFIX_ADR) on TARGET_X86_64 && CODE64() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: Laszlo Ersek , qemu-devel@nongnu.org Il 26/05/2013 01:23, Richard Henderson ha scritto: > On 2013-05-24 14:37, Laszlo Ersek wrote: >> @@ -4813,7 +4813,11 @@ static target_ulong disas_insn(CPUX86State >> *env, DisasContext *s, >> /* 0x66 is ignored if rex.w is set */ >> dflag = 2; >> } >> - if (!(prefixes & PREFIX_ADR)) { >> + if (prefixes & PREFIX_ADR) { >> + /* flip it back, 0x67 should have no effect */ >> + aflag ^= 1; >> + } >> + else { >> aflag = 2; >> } >> } >> > > Agreed that there's a bug here. I'm thinking it would be clearer to not > write this as yet another flip, but understand that unlike dflag, aflag > can only be either 1 or 2 in 64-bit mode. > > I'm thinking of something more like this: > > diff --git a/target-i386/translate.c b/target-i386/translate.c > index 0aeccdb..bf772aa 100644 > --- a/target-i386/translate.c > +++ b/target-i386/translate.c > @@ -4813,9 +4813,8 @@ static target_ulong disas_insn(CPUX86State *env, > DisasContext *s, > /* 0x66 is ignored if rex.w is set */ > dflag = 2; > } > - if (!(prefixes & PREFIX_ADR)) { > - aflag = 2; > - } > + /* 0x67 toggles between 64-bit and 32-bit addressing. */ > + aflag = (prefixes & PREFIX_ADR ? 1 : 2); Isn't that just "aflag++"? Needs a comment of course ("toggle between 32- and 64-bit, not 16- and 32-bit."). Paolo