]> Git Repo - qemu.git/commit
target/arm: Get correct MMU index for other-security-state
authorPeter Maydell <[email protected]>
Mon, 2 Nov 2020 16:52:17 +0000 (16:52 +0000)
committerPeter Maydell <[email protected]>
Mon, 2 Nov 2020 16:52:17 +0000 (16:52 +0000)
commit7142eb9e24b4aa5118cd67038057f15694d782aa
treea4267893e31bac3833fa29e43657090680cd03eb
parent18520fa465a08b81972afd9a25056f102f0180c9
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 <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 20201022164408[email protected]
target/arm/m_helper.c
This page took 0.026843 seconds and 4 git commands to generate.