Received: from eggs.gnu.org ([2001:4830:134:3::10]:43048) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGuFT-0006KV-PH for qemu-devel@nongnu.org; Thu, 29 Jan 2015 13:55:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGuFS-0002mA-H7 for qemu-devel@nongnu.org; Thu, 29 Jan 2015 13:55:27 -0500 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:54881) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGuFS-0002k2-B6 for qemu-devel@nongnu.org; Thu, 29 Jan 2015 13:55:26 -0500 From: Peter Maydell Date: Thu, 29 Jan 2015 18:55:08 +0000 Message-Id: <1422557717-19120-3-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1422557717-19120-1-git-send-email-peter.maydell@linaro.org> References: <1422557717-19120-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH v2 02/11] target-arm: Make arm_current_el() return sensible values for M profile List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , Andrew Jones , Greg Bellows , =?UTF-8?q?Alex=20Benn=C3=A9e?= , patches@linaro.org Although M profile doesn't have the same concept of exception level as A profile, it does have a notion of privileged versus not, which we currently track in the privmode TB flag. Support returning this information if arm_current_el() is called on an M profile core, so that we can identify the correct MMU index to use (and put the MMU index in the TB flags) without having to special-case M profile. Signed-off-by: Peter Maydell Reviewed-by: Greg Bellows --- target-arm/cpu.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target-arm/cpu.h b/target-arm/cpu.h index cd7a9e8..3eb00f4 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -1211,6 +1211,10 @@ static inline bool cptype_valid(int cptype) */ static inline int arm_current_el(CPUARMState *env) { + if (arm_feature(env, ARM_FEATURE_M)) { + return !((env->v7m.exception == 0) && (env->v7m.control & 1)); + } + if (is_a64(env)) { return extract32(env->pstate, 2, 2); } -- 1.9.1