qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: laurent@vivier.eu, mark.cave-ayland@ilande.co.uk
Subject: [PATCH 1/2] target/m68k: Fix MACSR to CCR
Date: Tue, 13 Sep 2022 15:28:17 +0100	[thread overview]
Message-ID: <20220913142818.7802-2-richard.henderson@linaro.org> (raw)
In-Reply-To: <20220913142818.7802-1-richard.henderson@linaro.org>

First, we were writing to the entire SR register, instead
of only the flags portion.  Second, we were not clearing C
as per the documentation (X was cleared via the 0xf mask).

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/m68k/translate.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/target/m68k/translate.c b/target/m68k/translate.c
index 5098f7e570..87044382c3 100644
--- a/target/m68k/translate.c
+++ b/target/m68k/translate.c
@@ -5892,8 +5892,10 @@ DISAS_INSN(from_mext)
 DISAS_INSN(macsr_to_ccr)
 {
     TCGv tmp = tcg_temp_new();
-    tcg_gen_andi_i32(tmp, QREG_MACSR, 0xf);
-    gen_helper_set_sr(cpu_env, tmp);
+
+    /* Note that X and C are always cleared. */
+    tcg_gen_andi_i32(tmp, QREG_MACSR, CCF_N | CCF_Z | CCF_V);
+    gen_helper_set_ccr(cpu_env, tmp);
     tcg_temp_free(tmp);
     set_cc_op(s, CC_OP_FLAGS);
 }
-- 
2.34.1



  reply	other threads:[~2022-09-13 14:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-13 14:28 [PATCH 0/2] target/m68k: fix two writes to %sr Richard Henderson
2022-09-13 14:28 ` Richard Henderson [this message]
2022-09-13 14:59   ` [PATCH 1/2] target/m68k: Fix MACSR to CCR Laurent Vivier
2022-09-21 13:01   ` Laurent Vivier
2022-09-13 14:28 ` [PATCH 2/2] target/m68k: Perform writback before modifying SR Richard Henderson
2022-09-13 14:47   ` Laurent Vivier
2022-09-13 16:24   ` Mark Cave-Ayland
2022-09-21 13:02   ` Laurent Vivier
2022-09-13 16:29 ` [PATCH 0/2] target/m68k: fix two writes to %sr Mark Cave-Ayland
2022-09-13 16:35   ` Laurent Vivier
2022-09-13 17:15   ` Richard Henderson
2022-09-14 16:48   ` Howard Spoelstra
2022-09-14 17:08     ` Howard Spoelstra

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=20220913142818.7802-2-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=laurent@vivier.eu \
    --cc=mark.cave-ayland@ilande.co.uk \
    --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).