summaryrefslogtreecommitdiff
path: root/arch/arm/include/asm/macro.h
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2022-02-11 14:29:38 +0300
committerTom Rini <trini@konsulko.com>2022-03-02 21:59:29 +0300
commitf660fe0bd3a8cfa7fc6271bbf27b1530e7348b85 (patch)
tree01d04927334a9a8870adb37ff47059c5f448223b /arch/arm/include/asm/macro.h
parent7ab2e47d27c93b3dd8e006fb2b0c762b171454cb (diff)
downloadu-boot-f660fe0bd3a8cfa7fc6271bbf27b1530e7348b85.tar.xz
armv8: Simplify switch_el macro
The switch_el macro is a neat contraption to handle cases where we need different code depending on the current exception level, but its implementation was longer than needed. Simplify it by doing just one comparison, then using the different condition codes to branch to the desired target. PState.CurrentEL just holds two bits, and since we don't care about EL0, we can use >, =, < to select EL3, EL2 and EL1, respectively. Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Diffstat (limited to 'arch/arm/include/asm/macro.h')
-rw-r--r--arch/arm/include/asm/macro.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/arch/arm/include/asm/macro.h b/arch/arm/include/asm/macro.h
index ec0171e0e6..acd519020d 100644
--- a/arch/arm/include/asm/macro.h
+++ b/arch/arm/include/asm/macro.h
@@ -69,12 +69,10 @@ lr .req x30
*/
.macro switch_el, xreg, el3_label, el2_label, el1_label
mrs \xreg, CurrentEL
- cmp \xreg, 0xc
- b.eq \el3_label
- cmp \xreg, 0x8
+ cmp \xreg, #0x8
+ b.gt \el3_label
b.eq \el2_label
- cmp \xreg, 0x4
- b.eq \el1_label
+ b.lt \el1_label
.endm
/*