From: Richard Henderson <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
Message-id: [email protected]
Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
---
target/arm/helper.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 7974c46000b..78da51996e8 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -6078,8 +6078,21 @@ static CPAccessResult access_v7a_tid3(CPUARMState *env,
const ARMCPRegInfo *ri,
* Any other registers in the TID3 trap space should use access_tid3(),
* so that they trap on v8 and above, but not on v7.
*/
- if ((arm_current_el(env) < 2) && (arm_hcr_el2_eff(env) & HCR_TID3)) {
- return CP_ACCESS_TRAP_EL2;
+ switch (arm_current_el(env)) {
+ case 1:
+ if (arm_hcr_el2_eff(env) & HCR_TID3) {
+ return CP_ACCESS_TRAP_EL2;
+ }
+ /* fall through */
+ case 2:
+ if (env->cp15.scr_el3 & SCR_TID3) {
+ return CP_ACCESS_TRAP_EL3;
+ }
+ break;
+ case 3:
+ break;
+ default:
+ g_assert_not_reached();
}
return CP_ACCESS_OK;
--
2.43.0