All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
To: laurent@vivier.eu, richard.henderson@linaro.org,
	lucienmp.qemu@gmail.com, qemu-devel@nongnu.org
Subject: [PATCH 4/4] target/m68k: always call gen_exit_tb() after writes to SR
Date: Sat, 17 Sep 2022 12:25:15 +0100	[thread overview]
Message-ID: <20220917112515.83905-5-mark.cave-ayland@ilande.co.uk> (raw)
In-Reply-To: <20220917112515.83905-1-mark.cave-ayland@ilande.co.uk>

Any write to SR can change the security state so always call gen_exit_tb() when
this occurs. In particular MacOS makes use of andiw/oriw in a few places to
handle the switch between user and supervisor mode.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 target/m68k/translate.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/target/m68k/translate.c b/target/m68k/translate.c
index be5561e1e9..892473d01f 100644
--- a/target/m68k/translate.c
+++ b/target/m68k/translate.c
@@ -2373,6 +2373,7 @@ DISAS_INSN(arith_im)
         tcg_gen_or_i32(dest, src1, im);
         if (with_SR) {
             gen_set_sr(s, dest, opsize == OS_BYTE);
+            gen_exit_tb(s);
         } else {
             DEST_EA(env, insn, opsize, dest, &addr);
             gen_logic_cc(s, dest, opsize);
@@ -2382,6 +2383,7 @@ DISAS_INSN(arith_im)
         tcg_gen_and_i32(dest, src1, im);
         if (with_SR) {
             gen_set_sr(s, dest, opsize == OS_BYTE);
+            gen_exit_tb(s);
         } else {
             DEST_EA(env, insn, opsize, dest, &addr);
             gen_logic_cc(s, dest, opsize);
@@ -2405,6 +2407,7 @@ DISAS_INSN(arith_im)
         tcg_gen_xor_i32(dest, src1, im);
         if (with_SR) {
             gen_set_sr(s, dest, opsize == OS_BYTE);
+            gen_exit_tb(s);
         } else {
             DEST_EA(env, insn, opsize, dest, &addr);
             gen_logic_cc(s, dest, opsize);
@@ -4592,6 +4595,7 @@ DISAS_INSN(strldsr)
     }
     gen_push(s, gen_get_sr(s));
     gen_set_sr_im(s, ext, 0);
+    gen_exit_tb(s);
 }
 
 DISAS_INSN(move_from_sr)
-- 
2.30.2



  parent reply	other threads:[~2022-09-17 11:34 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-17 11:25 [PATCH 0/4] target/m68k: MacOS supervisor/user mode switch fixes Mark Cave-Ayland
2022-09-17 11:25 ` [PATCH 1/4] target/m68k: rename M68K_FEATURE_M68000 to M68K_FEATURE_M68K Mark Cave-Ayland
2022-09-17 22:21   ` Philippe Mathieu-Daudé via
2022-09-19  8:15   ` Richard Henderson
2022-09-21 13:04   ` Laurent Vivier
2022-09-17 11:25 ` [PATCH 2/4] target/m68k: increase size of m68k CPU features from uint32_t to uint64_t Mark Cave-Ayland
2022-09-17 12:09   ` BALATON Zoltan
2022-09-17 22:27     ` Philippe Mathieu-Daudé via
2022-09-20 16:30       ` Mark Cave-Ayland
2022-09-20 16:34         ` Philippe Mathieu-Daudé via
2022-09-20 19:01         ` BALATON Zoltan
2022-09-21 13:14         ` Laurent Vivier
2022-09-20 16:25     ` Mark Cave-Ayland
2022-09-17 11:25 ` [PATCH 3/4] target/m68k: use M68K_FEATURE_MOVEFROMSR_PRIV feature for move_from_sr privilege check Mark Cave-Ayland
2022-09-19  8:15   ` Richard Henderson
2022-09-17 11:25 ` Mark Cave-Ayland [this message]
2022-09-17 22:29   ` [PATCH 4/4] target/m68k: always call gen_exit_tb() after writes to SR Philippe Mathieu-Daudé via
2022-09-19  8:13     ` Richard Henderson
2022-09-20 17:47       ` Philippe Mathieu-Daudé via
2022-09-19  8:13   ` Richard Henderson
2022-09-21 13:11   ` Laurent Vivier

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=20220917112515.83905-5-mark.cave-ayland@ilande.co.uk \
    --to=mark.cave-ayland@ilande.co.uk \
    --cc=laurent@vivier.eu \
    --cc=lucienmp.qemu@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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.