qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH 06/21] target-arm: add arm_is_secure() helper


From: Sergey Fedorov
Subject: [Qemu-devel] [RFC PATCH 06/21] target-arm: add arm_is_secure() helper
Date: Tue, 03 Dec 2013 12:48:40 +0400

arm_is_secure() helper allows to determine CPU security state.

Signed-off-by: Sergey Fedorov <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]