qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Laszlo Ersek <lersek@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] i386/translate: ignore 0x67 (PREFIX_ADR) on TARGET_X86_64 && CODE64()
Date: Sat, 25 May 2013 16:23:07 -0700	[thread overview]
Message-ID: <51A147DB.2020606@twiddle.net> (raw)
In-Reply-To: <1369431456-11887-1-git-send-email-lersek@redhat.com>

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

  reply	other threads:[~2013-05-25 23:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-24 21:37 [Qemu-devel] [PATCH] i386/translate: ignore 0x67 (PREFIX_ADR) on TARGET_X86_64 && CODE64() Laszlo Ersek
2013-05-25 23:23 ` Richard Henderson [this message]
2013-05-26  8:33   ` Paolo Bonzini
2013-05-26 23:45     ` Laszlo Ersek
2013-05-27  6:29       ` Paolo Bonzini

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=51A147DB.2020606@twiddle.net \
    --to=rth@twiddle.net \
    --cc=lersek@redhat.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).