qemu/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 target/arm: Convert A32 coprocessor insns to decodetree 2020-08-24 10:02:07 +01:00
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 target/arm: Add ID register values for Cortex-M0 2020-10-01 15:31:00 +01:00
cpu-param.h target/arm: Don't use a TLB for ARMMMUIdx_Stage2 2020-05-04 10:32:46 +01:00
cpu-qom.h qom: Remove module_obj_name parameter from OBJECT_DECLARE* macros 2020-09-18 14:12:32 -04:00
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 target/arm: Split helper_crypto_sm3tt 2020-06-05 17:23:09 +01:00
debug_helper.c
gdbstub64.c
gdbstub.c target/arm: Use correct GDB XML for M-profile cores 2020-05-14 15:03:08 +01:00
helper-a64.c target/arm: Remove local definitions of float constants 2020-09-01 11:19:32 +01:00
helper-a64.h target/arm: Add helper_mte_check_zva 2020-06-26 14:31:12 +01:00
helper-sve.h target/arm: Merge helper_sve_clr_* and helper_sve_movz_* 2020-08-28 10:02:48 +01:00
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 Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
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 hw/arm/virt: Implement kvm-steal-time 2020-10-08 15:24:32 +01:00
kvm_arm.h hw/arm/virt: Implement kvm-steal-time 2020-10-08 15:24:32 +01:00
kvm-consts.h target/arm: Remove no-longer-reachable 32-bit KVM code 2020-09-14 14:23:19 +01:00
kvm-stub.c
kvm.c hw/arm/virt: Implement kvm-steal-time 2020-10-08 15:24:32 +01:00
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 target/arm: Remove KVM support for 32-bit Arm hosts 2020-09-14 14:23:19 +01:00
monitor.c hw/arm/virt: Implement kvm-steal-time 2020-10-08 15:24:32 +01:00
mte_helper.c target/arm: Fix reported EL for mte_check_fail 2020-10-20 16:12:00 +01:00
neon_helper.c target/arm: Convert Neon VADD, VSUB, VABD 3-reg-same insns to decodetree 2020-05-14 15:03:09 +01:00
neon-dp.decode target/arm: Convert Neon VCVT fp size field to MO_* in decode 2020-09-14 14:23:19 +01:00
neon-ls.decode target/arm: Convert Neon 'load/store single structure' to decodetree 2020-05-04 12:57:56 +01:00
neon-shared.decode target/arm: Convert VCMLA, VCADD size field to MO_* in decode 2020-09-14 14:23:19 +01:00
op_addsub.h
op_helper.c target/arm: Implement LDG, STG, ST2G instructions 2020-06-26 14:31:12 +01:00
pauth_helper.c target/arm: Fix AddPAC error indication 2020-08-03 17:55:03 +01:00
psci.c
sve_helper.c target/arm: Merge helper_sve_clr_* and helper_sve_movz_* 2020-08-28 10:02:48 +01:00
sve.decode target/arm: Tidy SVE tszimm shift formats 2020-08-28 10:02:49 +01:00
t16.decode
t32.decode target/arm: Implement v8.1M low-overhead-loop instructions 2020-10-20 16:12:01 +01:00
tlb_helper.c target/arm: Cache the Tagged bit for a page in MemTxAttrs 2020-06-26 14:31:12 +01:00
trace-events
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
translate-a64.c linux-user: Set PAGE_TARGET_1 for TARGET_PROT_BTI 2020-10-27 10:44:02 +00:00
translate-a64.h target/arm: Replace A64 get_fpstatus_ptr() with generic fpstatus_ptr() 2020-08-24 10:15:11 +01:00
translate-neon.c.inc target/arm: Improve do_prewiden_3d 2020-11-02 16:52:15 +00:00
translate-sve.c target/arm: Fix SVE splice 2020-10-01 15:31:00 +01:00
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 target/arm: Rearrange {sve,fp}_check_access assert 2020-08-28 10:02:47 +01:00
vec_helper.c target/arm: Fix VUDOT/VSDOT (scalar) on big-endian hosts 2020-11-02 16:52:15 +00:00
vec_internal.h target/arm: Convert aes and sm4 to gvec helpers 2020-06-05 17:23:09 +01:00
vfp_helper.c target/arm: Implement FPSCR.LTPSIZE for M-profile LOB extension 2020-10-20 16:12:01 +01:00
vfp-uncond.decode target/arm: Implement new VFP fp16 insn VMOVX 2020-09-01 11:19:32 +01:00
vfp.decode target/arm: Implement VFP fp16 VMOV between gp and halfprec registers 2020-09-01 11:19:32 +01:00