summaryrefslogtreecommitdiffstats
path: root/arch/arm/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-03-14 10:55:03 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2018-03-29 08:16:40 +0200
commit04177bad21165fea1825d0cfceef40a71e4333d6 (patch)
tree2f6b3a185b6894df7bdebdb8180bb956f8d8cf53 /arch/arm/include
parentc2024e4ee8136febbe7ea537c98049b9fe79204b (diff)
downloadbarebox-04177bad21165fea1825d0cfceef40a71e4333d6.tar.gz
barebox-04177bad21165fea1825d0cfceef40a71e4333d6.tar.xz
ARM: aarch64: fix exception level mixup
When entering an exception the we currently jump to the code handling EL1 when we are actually at EL3 and the other way round. Fix this by introducing and using the switch_el macro from U-Boot. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/include')
-rw-r--r--arch/arm/include/asm/assembler64.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/arm/include/asm/assembler64.h b/arch/arm/include/asm/assembler64.h
new file mode 100644
index 0000000000..26182aa5f6
--- /dev/null
+++ b/arch/arm/include/asm/assembler64.h
@@ -0,0 +1,21 @@
+#ifndef __ASM_ARCH_ASSEMBLY_H
+#define __ASM_ARCH_ASSEMBLY_H
+
+#ifndef __ASSEMBLY__
+#error "Only include this from assembly code"
+#endif
+
+/*
+ * Branch according to exception level
+ */
+.macro switch_el, xreg, el3_label, el2_label, el1_label
+ mrs \xreg, CurrentEL
+ cmp \xreg, 0xc
+ b.eq \el3_label
+ cmp \xreg, 0x8
+ b.eq \el2_label
+ cmp \xreg, 0x4
+ b.eq \el1_label
+.endm
+
+#endif /* __ASM_ARCH_ASSEMBLY_H */ \ No newline at end of file