summaryrefslogtreecommitdiff
path: root/include/lib
diff options
context:
space:
mode:
authorSandrine Bailleux <sandrine.bailleux@arm.com>2014-05-09 11:23:11 +0100
committerSandrine Bailleux <sandrine.bailleux@arm.com>2014-05-09 11:23:11 +0100
commitb3254e8547707ff57ed7766aba53933884bd6a1c (patch)
treece10aa2b21b36c307b7cb643ae21904bc226ae56 /include/lib
parent60bc4bbd0bf705f30327e3c37973bcf1e1851110 (diff)
Introduce IS_IN_ELX() macros
The goal of these macros is to improve code readability by providing a concise way to check whether we are running in the expected exception level. Change-Id: If9aebadfb6299a5196e9a582b442f0971d9909b1
Diffstat (limited to 'include/lib')
-rw-r--r--include/lib/aarch64/arch_helpers.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/lib/aarch64/arch_helpers.h b/include/lib/aarch64/arch_helpers.h
index 517e25a..67b452b 100644
--- a/include/lib/aarch64/arch_helpers.h
+++ b/include/lib/aarch64/arch_helpers.h
@@ -264,5 +264,10 @@ extern void write_cpuectlr(unsigned long);
extern void write_cptr_el2(unsigned long);
extern void write_cptr_el3(unsigned long);
+#define IS_IN_EL(x) \
+ (GET_EL(read_current_el()) == MODE_EL##x)
+
+#define IS_IN_EL1() IS_IN_EL(1)
+#define IS_IN_EL3() IS_IN_EL(3)
#endif /* __ARCH_HELPERS_H__ */