From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55883) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhYj8-00076B-6B for qemu-devel@nongnu.org; Tue, 06 May 2014 02:19:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WhYj2-0003bY-6d for qemu-devel@nongnu.org; Tue, 06 May 2014 02:19:42 -0400 Received: from mail-qa0-x230.google.com ([2607:f8b0:400d:c00::230]:57581) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhYj2-0003bL-2a for qemu-devel@nongnu.org; Tue, 06 May 2014 02:19:36 -0400 Received: by mail-qa0-f48.google.com with SMTP id i13so3358326qae.7 for ; Mon, 05 May 2014 23:19:35 -0700 (PDT) From: "Edgar E. Iglesias" Date: Tue, 6 May 2014 16:08:20 +1000 Message-Id: <1399356506-5609-17-git-send-email-edgar.iglesias@gmail.com> In-Reply-To: <1399356506-5609-1-git-send-email-edgar.iglesias@gmail.com> References: <1399356506-5609-1-git-send-email-edgar.iglesias@gmail.com> Subject: [Qemu-devel] [PATCH v1 16/22] target-arm: A64: Forbid ERET to unimplemented ELs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, peter.maydell@linaro.org Cc: rob.herring@linaro.org, peter.crosthwaite@xilinx.com, john.williams@xilinx.com, alex.bennee@linaro.org, agraf@suse.de From: "Edgar E. Iglesias" Check for EL2 support before returning to it. Signed-off-by: Edgar E. Iglesias --- target-arm/op_helper.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c index 770c776..f1ae05e 100644 --- a/target-arm/op_helper.c +++ b/target-arm/op_helper.c @@ -411,12 +411,10 @@ void HELPER(exception_return)(CPUARMState *env) env->regs[15] = env->elr_el[ELR_EL_IDX(1)] & ~0x1; } else { new_el = extract32(spsr, 2, 2); - if (new_el > cur_el) { + if (new_el > cur_el + || (new_el == 2 && !arm_feature(env, ARM_FEATURE_EL2))) { /* Disallow returns to higher ELs than the current one. */ - goto illegal_return; - } - if (new_el > 1) { - /* Return to unimplemented EL */ + /* Disallow returns to unimplemented ELs. */ goto illegal_return; } if (extract32(spsr, 1, 1)) { -- 1.8.3.2