From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41215) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEiqa-0002ed-Pd for qemu-devel@nongnu.org; Fri, 23 Jan 2015 13:20:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YEiqZ-0000xt-Uj for qemu-devel@nongnu.org; Fri, 23 Jan 2015 13:20:44 -0500 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:54980) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEiqZ-0000ph-PN for qemu-devel@nongnu.org; Fri, 23 Jan 2015 13:20:43 -0500 From: Peter Maydell Date: Fri, 23 Jan 2015 18:20:19 +0000 Message-Id: <1422037228-5363-3-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1422037228-5363-1-git-send-email-peter.maydell@linaro.org> References: <1422037228-5363-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH 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 --- 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