From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45254) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UgNnw-0004m8-O3 for qemu-devel@nongnu.org; Sat, 25 May 2013 19:23:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UgNns-0006h2-UJ for qemu-devel@nongnu.org; Sat, 25 May 2013 19:23:16 -0400 Received: from mail-pd0-f172.google.com ([209.85.192.172]:39635) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UgNns-0006eR-N4 for qemu-devel@nongnu.org; Sat, 25 May 2013 19:23:12 -0400 Received: by mail-pd0-f172.google.com with SMTP id 10so5390780pdi.17 for ; Sat, 25 May 2013 16:23:11 -0700 (PDT) Sender: Richard Henderson Message-ID: <51A147DB.2020606@twiddle.net> Date: Sat, 25 May 2013 16:23:07 -0700 From: Richard Henderson MIME-Version: 1.0 References: <1369431456-11887-1-git-send-email-lersek@redhat.com> In-Reply-To: <1369431456-11887-1-git-send-email-lersek@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed 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: Laszlo Ersek Cc: qemu-devel@nongnu.org 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: r~ 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); } #endif