[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 15/35] target/arm: Set SPSR_EL1.M correctly when nested virt is e
From: |
Peter Maydell |
Subject: |
[PATCH 15/35] target/arm: Set SPSR_EL1.M correctly when nested virt is enabled |
Date: |
Mon, 18 Dec 2023 11:32:45 +0000 |
FEAT_NV requires that when HCR_EL2.{NV,NV1} == {1,0} and an exception
is taken from EL1 to EL1 then the reported EL in SPSR_EL1.M should be
EL2, not EL1. Implement this behaviour.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target/arm/helper.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 44005665d12..220ee64df0d 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -11327,6 +11327,12 @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs)
old_mode = pstate_read(env);
aarch64_save_sp(env, arm_current_el(env));
env->elr_el[new_el] = env->pc;
+
+ if (cur_el == 1 && new_el == 1 &&
+ ((arm_hcr_el2_eff(env) & (HCR_NV | HCR_NV1)) == HCR_NV)) {
+ /* I_ZJRNN: report EL2 in the SPSR by setting M[3:2] to 0b10 */
+ old_mode = deposit32(old_mode, 2, 2, 2);
+ }
} else {
old_mode = cpsr_read_for_spsr_elx(env);
env->elr_el[new_el] = env->regs[15];
--
2.34.1
- [PATCH 13/35] target/arm: Trap sysreg accesses for FEAT_NV, (continued)
- [PATCH 13/35] target/arm: Trap sysreg accesses for FEAT_NV, Peter Maydell, 2023/12/18
- [PATCH 18/35] target/arm: Don't honour PSTATE.PAN when HCR_EL2.{NV, NV1} == {1, 1}, Peter Maydell, 2023/12/18
- [PATCH 19/35] target/arm: Treat LDTR* and STTR* as LDR/STR when NV, NV1 is 1, 1, Peter Maydell, 2023/12/18
- [PATCH 22/35] target/arm: Handle HCR_EL2 accesses for FEAT_NV2 bits, Peter Maydell, 2023/12/18
- [PATCH 16/35] target/arm: Trap registers when HCR_EL2.{NV, NV1} == {1, 1}, Peter Maydell, 2023/12/18
- [PATCH 15/35] target/arm: Set SPSR_EL1.M correctly when nested virt is enabled,
Peter Maydell <=
- [PATCH 14/35] target/arm: Make NV reads of CurrentEL return EL2, Peter Maydell, 2023/12/18
- [PATCH 17/35] target/arm: Always use arm_pan_enabled() when checking if PAN is enabled, Peter Maydell, 2023/12/18
- [PATCH 20/35] target/arm: Handle FEAT_NV page table attribute changes, Peter Maydell, 2023/12/18
- [PATCH 23/35] target/arm: Implement VNCR_EL2 register, Peter Maydell, 2023/12/18
- [PATCH 25/35] target/arm: Handle FEAT_NV2 redirection of SPSR_EL2, ELR_EL2, ESR_EL2, FAR_EL2, Peter Maydell, 2023/12/18