Received: from eggs.gnu.org ([2001:4830:134:3::10]:45239) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vnlfn-0001AM-Om for qemu-devel@nongnu.org; Tue, 03 Dec 2013 03:49:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vnlfb-00076T-4G for qemu-devel@nongnu.org; Tue, 03 Dec 2013 03:49:39 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:36813) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vnlfa-00075V-Uc for qemu-devel@nongnu.org; Tue, 03 Dec 2013 03:49:27 -0500 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MX800FNE3699130@mailout4.w1.samsung.com> for qemu-devel@nongnu.org; Tue, 03 Dec 2013 08:49:21 +0000 (GMT) From: Sergey Fedorov Date: Tue, 03 Dec 2013 12:48:40 +0400 Message-id: <1386060535-15908-7-git-send-email-s.fedorov@samsung.com> In-reply-to: <1386060535-15908-1-git-send-email-s.fedorov@samsung.com> References: <1386060535-15908-1-git-send-email-s.fedorov@samsung.com> Subject: [Qemu-devel] [RFC PATCH 06/21] target-arm: add arm_is_secure() helper List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, a.basov@samsung.com, Sergey Fedorov , johannes.winter@iaik.tugraz.at arm_is_secure() helper allows to determine CPU security state. Signed-off-by: Sergey Fedorov --- target-arm/cpu.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/target-arm/cpu.h b/target-arm/cpu.h index 94d8bd1..a00c86f 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -474,6 +474,17 @@ static inline int arm_feature(CPUARMState *env, int feature) return (env->features & (1ULL << feature)) != 0; } +/* Return non-zero if the processor is in Secure state */ +static inline bool arm_is_secure(CPUARMState *env) +{ +#if !defined(CONFIG_USER_ONLY) + return ((env->uncached_cpsr & CPSR_M) == ARM_CPU_MODE_MON) || + !(env->cp15.c1_scr & 1); +#else + return false; +#endif +} + void arm_cpu_list(FILE *f, fprintf_function cpu_fprintf); /* Interface between CPU and Interrupt controller. */ -- 1.7.9.5