mirror of https://github.com/acidanthera/audk.git
MdePkg/BaseLib AARCH64: Make asm files BTI compatible
Add the BTI instructions and the associated note to make the AArch64 asm objects compatible with BTI enforcement. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com> Reviewed-by: Oliver Smith-Denny <osd@smith-denny.com>
This commit is contained in:
parent
e504b3917e
commit
c4c7fb2174
|
@ -27,5 +27,6 @@ GCC_ASM_EXPORT(CpuBreakpoint)
|
|||
# );
|
||||
#
|
||||
ASM_PFX(CpuBreakpoint):
|
||||
AARCH64_BTI(c)
|
||||
svc 0xdbdb // Superviser exception. Takes 16bit arg -> Armv7 had 'swi' here.
|
||||
ret
|
||||
|
|
|
@ -26,5 +26,6 @@ GCC_ASM_EXPORT(DisableInterrupts)
|
|||
# );
|
||||
#
|
||||
ASM_PFX(DisableInterrupts):
|
||||
AARCH64_BTI(c)
|
||||
msr daifset, #DAIF_WR_IRQ_BIT
|
||||
ret
|
||||
|
|
|
@ -26,5 +26,6 @@ GCC_ASM_EXPORT(EnableInterrupts)
|
|||
# );
|
||||
#
|
||||
ASM_PFX(EnableInterrupts):
|
||||
AARCH64_BTI(c)
|
||||
msr daifclr, #DAIF_WR_IRQ_BIT
|
||||
ret
|
||||
|
|
|
@ -33,6 +33,7 @@ GCC_ASM_EXPORT(GetInterruptState)
|
|||
# );
|
||||
#
|
||||
ASM_PFX(GetInterruptState):
|
||||
AARCH64_BTI(c)
|
||||
mrs x0, daif
|
||||
tst x0, #DAIF_RD_IRQ_BIT // Check IRQ mask; set Z=1 if clear/unmasked
|
||||
cset w0, eq // if Z=1 (eq) return 1, else 0
|
||||
|
|
|
@ -28,6 +28,7 @@ GCC_ASM_EXPORT(MemoryFence)
|
|||
# );
|
||||
#
|
||||
ASM_PFX(MemoryFence):
|
||||
AARCH64_BTI(c)
|
||||
// System wide Data Memory Barrier.
|
||||
dmb sy
|
||||
ret
|
||||
|
|
|
@ -46,6 +46,7 @@ GCC_ASM_EXPORT(InternalLongJump)
|
|||
# );
|
||||
#
|
||||
ASM_PFX(SetJump):
|
||||
AARCH64_BTI(c)
|
||||
mov x16, sp // use IP0 so save SP
|
||||
#define REG_PAIR(REG1, REG2, OFFS) stp REG1, REG2, [x0, OFFS]
|
||||
#define REG_ONE(REG1, OFFS) str REG1, [x0, OFFS]
|
||||
|
@ -75,6 +76,7 @@ ASM_PFX(SetJump):
|
|||
# );
|
||||
#
|
||||
ASM_PFX(InternalLongJump):
|
||||
AARCH64_BTI(c)
|
||||
#define REG_PAIR(REG1, REG2, OFFS) ldp REG1, REG2, [x0, OFFS]
|
||||
#define REG_ONE(REG1, OFFS) ldr REG1, [x0, OFFS]
|
||||
GPR_LAYOUT
|
||||
|
|
|
@ -28,6 +28,7 @@ GCC_ASM_EXPORT(SpeculationBarrier)
|
|||
# );
|
||||
#
|
||||
ASM_PFX(SpeculationBarrier):
|
||||
AARCH64_BTI(c)
|
||||
dsb sy
|
||||
isb
|
||||
ret
|
||||
|
|
|
@ -35,6 +35,7 @@ GCC_ASM_EXPORT(CpuPause)
|
|||
# );
|
||||
#
|
||||
ASM_PFX(InternalSwitchStackAsm):
|
||||
AARCH64_BTI(c)
|
||||
mov x29, #0
|
||||
mov x30, x0
|
||||
mov sp, x3
|
||||
|
@ -57,6 +58,7 @@ ASM_PFX(InternalSwitchStackAsm):
|
|||
# )
|
||||
#
|
||||
ASM_PFX(CpuPause):
|
||||
AARCH64_BTI(c)
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
|
|
Loading…
Reference in New Issue