mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-27 07:34:06 +02:00
ArmPkg/AsmMacroIoLibV8: remove undocumented assumption from ELx macros
The macros EL1_OR_EL2() and EL1_OR_EL2_OR_EL3() allow conditional execution of assembly sequences based on the current exception level, by jumping to caller supplied labels 1f, 2f or 3f. However, the jump to 1f is actually a fallthrough, which means the EL1 code needs to follow right after the macro invocation, and the 1f label is ignored. So let's fix this by making all jumps explicit. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Eugene Cohen <eugene@hp.com>
This commit is contained in:
parent
725cdb8fbf
commit
a34608ca96
@ -24,23 +24,23 @@
|
|||||||
#define EL1_OR_EL2(SAFE_XREG) \
|
#define EL1_OR_EL2(SAFE_XREG) \
|
||||||
mrs SAFE_XREG, CurrentEL ;\
|
mrs SAFE_XREG, CurrentEL ;\
|
||||||
cmp SAFE_XREG, #0x8 ;\
|
cmp SAFE_XREG, #0x8 ;\
|
||||||
|
b.gt . ;\
|
||||||
b.eq 2f ;\
|
b.eq 2f ;\
|
||||||
cmp SAFE_XREG, #0x4 ;\
|
cbnz SAFE_XREG, 1f ;\
|
||||||
b.ne . ;// We should never get here
|
b . ;// We should never get here
|
||||||
// EL1 code starts here
|
|
||||||
|
|
||||||
// CurrentEL : 0xC = EL3; 8 = EL2; 4 = EL1
|
// CurrentEL : 0xC = EL3; 8 = EL2; 4 = EL1
|
||||||
// This only selects between EL1 and EL2 and EL3, else we die.
|
// This only selects between EL1 and EL2 and EL3, else we die.
|
||||||
// Provide the Macro with a safe temp xreg to use.
|
// Provide the Macro with a safe temp xreg to use.
|
||||||
#define EL1_OR_EL2_OR_EL3(SAFE_XREG) \
|
#define EL1_OR_EL2_OR_EL3(SAFE_XREG) \
|
||||||
mrs SAFE_XREG, CurrentEL ;\
|
mrs SAFE_XREG, CurrentEL ;\
|
||||||
cmp SAFE_XREG, #0xC ;\
|
|
||||||
b.eq 3f ;\
|
|
||||||
cmp SAFE_XREG, #0x8 ;\
|
cmp SAFE_XREG, #0x8 ;\
|
||||||
|
b.gt 3f ;\
|
||||||
b.eq 2f ;\
|
b.eq 2f ;\
|
||||||
cmp SAFE_XREG, #0x4 ;\
|
cbnz SAFE_XREG, 1f ;\
|
||||||
b.ne . ;// We should never get here
|
b . ;// We should never get here
|
||||||
// EL1 code starts here
|
|
||||||
#if defined(__clang__)
|
#if defined(__clang__)
|
||||||
|
|
||||||
// load x0 with _Data
|
// load x0 with _Data
|
||||||
|
Loading…
x
Reference in New Issue
Block a user