diff mbox

i386/translate: ignore 0x67 (PREFIX_ADR) on TARGET_X86_64 && CODE64()

Message ID 1369431456-11887-1-git-send-email-lersek@redhat.com
State New
Headers show

Commit Message

Laszlo Ersek May 24, 2013, 9:37 p.m. UTC
The code reorganization in commit 4a6fd938 broke handling of PREFIX_ADR.
Restore the previous behavior:

If TARGET_X86_64 *and* CODE64():
  (a) PREFIX_ADR set: no effect, "aflag" should stay at the original
      "s->code32" value,
  (b) PREFIX_ADR clear: "aflag" should be set to constant 2.

Otherwise:
  (c) PREFIX_ADR set: the least significant bit in "aflag" (originally
      initialized form "s->code32") should be negated,
  (d) PREFIX_ADR clear: no effect, "aflag" should stay at the original
      "s->code32" value.

Currently branch (a) is mishandled as branch (c).

Please-review: Richard Henderson <rth@twiddle.net>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 target-i386/translate.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
diff mbox

Patch

diff --git a/target-i386/translate.c b/target-i386/translate.c
index 0aeccdb..86f2678 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -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;
         }
     }