qemu-e2k/target/arm
Peter Maydell 7142eb9e24 target/arm: Get correct MMU index for other-security-state
In arm_v7m_mmu_idx_for_secstate() we get the 'priv' level to pass to
armv7m_mmu_idx_for_secstate_and_priv() by calling arm_current_el().
This is incorrect when the security state being queried is not the
current one, because arm_current_el() uses the current security state
to determine which of the banked CONTROL.nPRIV bits to look at.
The effect was that if (for instance) Secure state was in privileged
mode but Non-Secure was not then we would return the wrong MMU index.

The only places where we are using this function in a way that could
trigger this bug are for the stack loads during a v8M function-return
and for the instruction fetch of a v8M SG insn.

Fix the bug by expanding out the M-profile version of the
arm_current_el() logic inline so it can use the passed in secstate
rather than env->v7m.secure.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20201022164408.13214-1-peter.maydell@linaro.org
2020-11-02 16:52:17 +00:00
..
a32-uncond.decode
a32.decode
arch_dump.c
arm_ldst.h
arm-powerctl.c
arm-powerctl.h
arm-semi.c
cpu64.c target/arm: Make '-cpu max' have a 48-bit PA 2020-10-08 21:40:01 +01:00
cpu_tcg.c
cpu-param.h
cpu-qom.h
cpu.c target/arm: Implement FPSCR.LTPSIZE for M-profile LOB extension 2020-10-20 16:12:01 +01:00
cpu.h linux-user: Set PAGE_TARGET_1 for TARGET_PROT_BTI 2020-10-27 10:44:02 +00:00
crypto_helper.c
debug_helper.c
gdbstub64.c
gdbstub.c
helper-a64.c
helper-a64.h
helper-sve.h
helper.c target/arm: fix LORID_EL1 access check 2020-11-02 16:52:16 +00:00
helper.h target/arm: AArch32 VCVT fixed-point to float is always round-to-nearest 2020-10-20 16:12:00 +01:00
idau.h
internals.h target/arm: Ignore HCR_EL2.ATA when {E2H,TGE} != 11 2020-10-20 16:12:00 +01:00
iwmmxt_helper.c
kvm64.c
kvm_arm.h
kvm-consts.h
kvm-stub.c
kvm.c
m_helper.c target/arm: Get correct MMU index for other-security-state 2020-11-02 16:52:17 +00:00
m-nocp.decode target/arm: Implement v8.1M NOCP handling 2020-10-20 16:12:01 +01:00
machine.c
meson.build
monitor.c
mte_helper.c target/arm: Fix reported EL for mte_check_fail 2020-10-20 16:12:00 +01:00
neon_helper.c
neon-dp.decode
neon-ls.decode
neon-shared.decode
op_addsub.h
op_helper.c
pauth_helper.c
psci.c
sve_helper.c
sve.decode
t16.decode
t32.decode target/arm: Implement v8.1M low-overhead-loop instructions 2020-10-20 16:12:01 +01:00
tlb_helper.c
trace-events
trace.h
translate-a64.c linux-user: Set PAGE_TARGET_1 for TARGET_PROT_BTI 2020-10-27 10:44:02 +00:00
translate-a64.h
translate-neon.c.inc target/arm: Improve do_prewiden_3d 2020-11-02 16:52:15 +00:00
translate-sve.c
translate-vfp.c.inc target/arm: Rename neon_load_reg64 to vfp_load_reg64 2020-11-02 16:52:14 +00:00
translate.c target/arm: Improve do_prewiden_3d 2020-11-02 16:52:15 +00:00
translate.h
vec_helper.c target/arm: Fix VUDOT/VSDOT (scalar) on big-endian hosts 2020-11-02 16:52:15 +00:00
vec_internal.h
vfp_helper.c target/arm: Implement FPSCR.LTPSIZE for M-profile LOB extension 2020-10-20 16:12:01 +01:00
vfp-uncond.decode
vfp.decode