Received: from eggs.gnu.org ([2001:4830:134:3::10]:41065) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abo7Y-0005Hh-7Z for qemu-devel@nongnu.org; Fri, 04 Mar 2016 06:42:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1abo7X-0001CX-AJ for qemu-devel@nongnu.org; Fri, 04 Mar 2016 06:42:12 -0500 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:56108) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abo7X-0001CA-4C for qemu-devel@nongnu.org; Fri, 04 Mar 2016 06:42:11 -0500 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.84) (envelope-from ) id 1abo7W-00021s-OO for qemu-devel@nongnu.org; Fri, 04 Mar 2016 11:42:10 +0000 From: Peter Maydell Date: Fri, 4 Mar 2016 11:41:53 +0000 Message-Id: <1457091713-10138-31-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1457091713-10138-1-git-send-email-peter.maydell@linaro.org> References: <1457091713-10138-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PULL 30/30] target-arm: Only trap SRS from S-EL1 if specified mode is MON List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org From: Ralf-Philipp Weinmann Commit cbc0326b6fb9 caused SRS instructions executed from Secure EL1 to trap to EL3 even if the specified mode was not monitor mode. According to the ARMv8 Architecture reference manual [F6.1.203], ALL of the following conditions need to be met for SRS to trap to EL3: * It is executed at Secure PL1. * The specified mode is monitor mode. * EL3 is using AArch64. Correct the condition governing the trap to EL3 to check the specified mode. Signed-off-by: Ralf-Philipp Weinmann Message-id: 20160222224251.GA11654@beta.comsecuris.com Reviewed-by: Peter Maydell [PMM: tweaked comment text to read 'specified mode'; edited commit message] Signed-off-by: Peter Maydell --- target-arm/translate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target-arm/translate.c b/target-arm/translate.c index 25db09e..025c7a5 100644 --- a/target-arm/translate.c +++ b/target-arm/translate.c @@ -7655,6 +7655,7 @@ static void gen_srs(DisasContext *s, /* SRS is: * - trapped to EL3 if EL3 is AArch64 and we are at Secure EL1 + * and specified mode is monitor mode * - UNDEFINED in Hyp mode * - UNPREDICTABLE in User or System mode * - UNPREDICTABLE if the specified mode is: @@ -7664,7 +7665,7 @@ static void gen_srs(DisasContext *s, * -- Monitor, if we are Non-secure * For the UNPREDICTABLE cases we choose to UNDEF. */ - if (s->current_el == 1 && !s->ns) { + if (s->current_el == 1 && !s->ns && mode == ARM_CPU_MODE_MON) { gen_exception_insn(s, 4, EXCP_UDEF, syn_uncategorized(), 3); return; } -- 1.9.1