aboutsummaryrefslogtreecommitdiff
path: root/target-arm
diff options
context:
space:
mode:
authorEdgar E. Iglesias <edgar.iglesias@xilinx.com>2014-05-27 17:09:53 +0100
committerPeter Maydell <peter.maydell@linaro.org>2014-05-27 17:09:53 +0100
commit7ab6c10d008c79d92b0b62e36fb0edc4066d37d6 (patch)
tree9708432d41a146758f33e47af1c9750ef2fc37cd /target-arm
parent81547d663030cfd3508bc8126d015030ddbe9c96 (diff)
target-arm: A64: Forbid ERET to higher or unimplemented ELs
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Message-id: 1400980132-25949-18-git-send-email-edgar.iglesias@gmail.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target-arm')
-rw-r--r--target-arm/op_helper.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c
index c2b4bf0fd7..e95a7f401f 100644
--- a/target-arm/op_helper.c
+++ b/target-arm/op_helper.c
@@ -389,6 +389,7 @@ void HELPER(exception_return)(CPUARMState *env)
unsigned int spsr_idx = aarch64_banked_spsr_index(1);
uint32_t spsr = env->banked_spsr[spsr_idx];
int new_el, i;
+ int cur_el = arm_current_pl(env);
if (env->pstate & PSTATE_SP) {
env->sp_el[1] = env->xregs[31];
@@ -410,8 +411,11 @@ void HELPER(exception_return)(CPUARMState *env)
env->regs[15] = env->elr_el[1] & ~0x1;
} else {
new_el = extract32(spsr, 2, 2);
- if (new_el > 1) {
- /* Return to unimplemented EL */
+ if (new_el > cur_el
+ || (new_el == 2 && !arm_feature(env, ARM_FEATURE_EL2))) {
+ /* Disallow return to an EL which is unimplemented or higher
+ * than the current one.
+ */
goto illegal_return;
}
if (extract32(spsr, 1, 1)) {