target/arm: Handle FEAT_NV2 changes to when SPSR_EL1.M reports EL2

With FEAT_NV2, the condition for when SPSR_EL1.M should report that
an exception was taken from EL2 changes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Miguel Luis <miguel.luis@oracle.com>
This commit is contained in:
Peter Maydell 2024-01-09 14:43:52 +00:00
parent b5ba6c99a8
commit ef8a4a8816

View File

@ -11328,10 +11328,18 @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs)
aarch64_save_sp(env, arm_current_el(env)); aarch64_save_sp(env, arm_current_el(env));
env->elr_el[new_el] = env->pc; env->elr_el[new_el] = env->pc;
if (cur_el == 1 && new_el == 1 && if (cur_el == 1 && new_el == 1) {
((arm_hcr_el2_eff(env) & (HCR_NV | HCR_NV1)) == HCR_NV)) { uint64_t hcr = arm_hcr_el2_eff(env);
/* I_ZJRNN: report EL2 in the SPSR by setting M[3:2] to 0b10 */ if ((hcr & (HCR_NV | HCR_NV1 | HCR_NV2)) == HCR_NV ||
old_mode = deposit32(old_mode, 2, 2, 2); (hcr & (HCR_NV | HCR_NV2)) == (HCR_NV | HCR_NV2)) {
/*
* FEAT_NV, FEAT_NV2 may need to report EL2 in the SPSR
* by setting M[3:2] to 0b10.
* If NV2 is disabled, change SPSR when NV,NV1 == 1,0 (I_ZJRNN)
* If NV2 is enabled, change SPSR when NV is 1 (I_DBTLM)
*/
old_mode = deposit32(old_mode, 2, 2, 2);
}
} }
} else { } else {
old_mode = cpsr_read_for_spsr_elx(env); old_mode = cpsr_read_for_spsr_elx(env);