From befa49ffb777fadf3e07f0f70d29346158f00b13 Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Thu, 15 Aug 2019 13:27:19 +0100 Subject: arch-arm: Rewrite the currEL helper method to use opModeToEL Direct use of cpsr.el should be discouraged: it should be used when in AArch64 only; when in AArch32 it won't return the matching EL. Eg: when in Supervisor Mode (EL1), CPSR.M<3,0> (mode) is 0b0011, and cpsr.el will return 0 (EL0) Change-Id: I5504bd1f59980f79b2607cce435ea09245de12e5 Signed-off-by: Giacomo Travaglini Reviewed-by: Andreas Sandberg Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/20249 Maintainer: Andreas Sandberg Tested-by: kokoro --- src/arch/arm/utility.hh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/arch/arm') diff --git a/src/arch/arm/utility.hh b/src/arch/arm/utility.hh index 15daeb8cf..ded5aa36c 100644 --- a/src/arch/arm/utility.hh +++ b/src/arch/arm/utility.hh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2012-2013, 2016-2018 ARM Limited + * Copyright (c) 2010, 2012-2013, 2016-2019 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -153,8 +153,7 @@ currOpMode(ThreadContext *tc) static inline ExceptionLevel currEL(ThreadContext *tc) { - CPSR cpsr = tc->readMiscReg(MISCREG_CPSR); - return (ExceptionLevel) (uint8_t) cpsr.el; + return opModeToEL(currOpMode(tc)); } /** -- cgit v1.2.3