qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
	richard.henderson@linaro.org, lucienmp.qemu@gmail.com,
	qemu-devel@nongnu.org
Subject: Re: [PATCH 4/4] target/m68k: always call gen_exit_tb() after writes to SR
Date: Wed, 21 Sep 2022 15:11:20 +0200	[thread overview]
Message-ID: <e1bb22cd-e530-c27e-b4f9-17ca578fabbf@vivier.eu> (raw)
In-Reply-To: <20220917112515.83905-5-mark.cave-ayland@ilande.co.uk>

Le 17/09/2022 à 13:25, Mark Cave-Ayland a écrit :
> 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)

Applied to my m68k-for-7.2 branch

Thanks,
Laurent



      parent reply	other threads:[~2022-09-21 13:49 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 ` [PATCH 4/4] target/m68k: always call gen_exit_tb() after writes to SR Mark Cave-Ayland
2022-09-17 22:29   ` 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 [this message]

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=e1bb22cd-e530-c27e-b4f9-17ca578fabbf@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=lucienmp.qemu@gmail.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --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 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).