All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Whitehorn <nwhitehorn@freebsd.org>
To: qemu-devel@nongnu.org
Cc: Alexander Graf <agraf@suse.de>
Subject: [Qemu-devel] [PATCH2] ppc64: fix mtmsr behavior on 64-bit targets
Date: Sun, 12 Jun 2011 10:49:33 -0500	[thread overview]
Message-ID: <4DF4E00D.4030101@freebsd.org> (raw)
In-Reply-To: <AF2B342B-6B84-4F21-BE19-D8A55ECF3839@suse.de>

The mtmsr instruction is required not to modify the upper 32-bits of the 
machine state register, but checks the current value of MSR[SF] to 
decide whether to do this. This has the effect of zeroing the upper 32 
bits of the MSR whenever mtmsr is executed in 64-bit mode. 
Unconditionally preserve the upper 32-bits in mtmsr for TARGET_PPC64.

Signed-off-by: Nathan Whitehorn <nwhitehorn@freebsd.org>
---
  target-ppc/translate.c |    5 ++---
  1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 59aef85..38d2e2e 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -3884,18 +3884,17 @@ static void gen_mtmsr(DisasContext *ctx)
           */
          gen_update_nip(ctx, ctx->nip);
  #if defined(TARGET_PPC64)
-        if (!ctx->sf_mode) {
-            TCGv t0 = tcg_temp_new();
-            TCGv t1 = tcg_temp_new();
-            tcg_gen_andi_tl(t0, cpu_msr, 0xFFFFFFFF00000000ULL);
-            tcg_gen_ext32u_tl(t1, cpu_gpr[rS(ctx->opcode)]);
-            tcg_gen_or_tl(t0, t0, t1);
-            tcg_temp_free(t1);
-            gen_helper_store_msr(t0);
-            tcg_temp_free(t0);
-        } else
+        TCGv t0 = tcg_temp_new();
+        TCGv t1 = tcg_temp_new();
+        tcg_gen_andi_tl(t0, cpu_msr, 0xFFFFFFFF00000000ULL);
+        tcg_gen_ext32u_tl(t1, cpu_gpr[rS(ctx->opcode)]);
+        tcg_gen_or_tl(t0, t0, t1);
+        tcg_temp_free(t1);
+        gen_helper_store_msr(t0);
+        tcg_temp_free(t0);
+#else
+        gen_helper_store_msr(cpu_gpr[rS(ctx->opcode)]);
  #endif
-            gen_helper_store_msr(cpu_gpr[rS(ctx->opcode)]);
          /* Must stop the translation as machine state (may have) 
changed */
          /* Note that mtmsr is not always defined as 
context-synchronizing */
          gen_stop_exception(ctx);

  reply	other threads:[~2011-06-12 15:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-31 14:56 [Qemu-devel] [PATCH] ppc64: fix mtmsr behavior on 64-bit targets Nathan Whitehorn
2011-05-31 16:48 ` Alexander Graf
2011-05-31 17:40 ` Richard Henderson
2011-06-04 19:28   ` Nathan Whitehorn
2011-06-05  9:00     ` Alexander Graf
2011-06-05 13:33       ` Nathan Whitehorn
2011-06-05 13:36         ` Nathan Whitehorn
2011-06-05 13:45         ` Alexander Graf
2011-06-12 15:49           ` Nathan Whitehorn [this message]
2011-06-13 10:20             ` [Qemu-devel] [PATCH2] " Alexander Graf
2011-06-13 12:52               ` Nathan Whitehorn
2011-06-13 13:17                 ` Alexander Graf

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=4DF4E00D.4030101@freebsd.org \
    --to=nwhitehorn@freebsd.org \
    --cc=agraf@suse.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.