aboutsummaryrefslogtreecommitdiff
path: root/target-arm
diff options
context:
space:
mode:
Diffstat (limited to 'target-arm')
-rw-r--r--target-arm/op_helper.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c
index b9f51e0822..40224a8dfa 100644
--- a/target-arm/op_helper.c
+++ b/target-arm/op_helper.c
@@ -719,6 +719,16 @@ void HELPER(exception_return)(CPUARMState *env)
goto illegal_return;
}
+ if (new_el == 2 && arm_is_secure_below_el3(env)) {
+ /* Return to the non-existent secure-EL2 */
+ goto illegal_return;
+ }
+
+ if (new_el == 1 && (env->cp15.hcr_el2 & HCR_TGE)
+ && !arm_is_secure_below_el3(env)) {
+ goto illegal_return;
+ }
+
if (!return_to_aa64) {
env->aarch64 = 0;
env->uncached_cpsr = spsr & CPSR_M;