qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 0/4] target/m68k: MacOS supervisor/user mode switch fixes


From: Mark Cave-Ayland
Subject: [PATCH 0/4] target/m68k: MacOS supervisor/user mode switch fixes
Date: Sat, 17 Sep 2022 12:25:11 +0100

This series fixes a couple of bugs that were discovered when trying to boot
MacOS on my github q800 branch with virtual memory enabled.

Patch 1 renames M68K_FEATURE_M68000 to M68K_FEATURE_M68K in order to clarify
that this feature indicates any Motorola 68K CPU rather than the 68000
specifically [1].

Patch 2 increases the size of the M68K features bitmap since there are already
32 features present, and we need to add one more.

Patch 3 fixes up the MOVE-from-SR instruction which is privileged from the
68010 CPU onwards to use a newly introduced M68K_FEATURE_MOVEFROMSR_PRIV
feature [2].

Patch 4 ensures that we always call gen_exit_tb() after writes to the SR
register since any change of the S bit can change the security context.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

Notes:

[1] The m68k code currently contains a mix of real CPU features and pseudo
    features that represent each 680X0 CPU. In general QEMU maps features to
    CPUs which is why I've introduced the new M68K_FEATURE_MOVEFROMSR_PRIV
    feature, but there are still checks for specific 680X0 CPU models. This
    could do with a tidy-up, but without a specific set of test images across
    68K and Coldfire I don't feel I'm confident enough to do this.
    
[2] The existing code in MOVE-from-SR uses !m68k_feature(env, 
M68K_FEATURE_M68000)
    to suggest that the condition should match for any CPU that isn't a 68000 
(i.e.
    68010 and later) but as we see from this series, this is not the case 
according
    to the code. Some of the Mac 68K folk have suggested there are likely other
    cases in target/m68k where the same assumption has been used and the check
    logic is incorrect, but again without specific examples it's difficult for 
me to
    test.


Mark Cave-Ayland (4):
  target/m68k: rename M68K_FEATURE_M68000 to M68K_FEATURE_M68K
  target/m68k: increase size of m68k CPU features from uint32_t to
    uint64_t
  target/m68k: use M68K_FEATURE_MOVEFROMSR_PRIV feature for move_from_sr
    privilege check
  target/m68k: always call gen_exit_tb() after writes to SR

 target/m68k/cpu.c       |  11 +++-
 target/m68k/cpu.h       |  13 ++--
 target/m68k/helper.c    |   2 +-
 target/m68k/op_helper.c |   2 +-
 target/m68k/translate.c | 142 +++++++++++++++++++++-------------------
 5 files changed, 91 insertions(+), 79 deletions(-)

-- 
2.30.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]