MdePkg/BaseSynchronizationLib 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:
Ard Biesheuvel 2023-03-25 17:37:55 +01:00 committed by mergify[bot]
parent 0ee255f50a
commit 35318c2eb9

View File

@ -41,6 +41,7 @@ GCC_ASM_EXPORT(InternalSyncDecrement)
// IN UINT16 ExchangeValue // IN UINT16 ExchangeValue
// ) // )
ASM_PFX(InternalSyncCompareExchange16): ASM_PFX(InternalSyncCompareExchange16):
AARCH64_BTI(c)
uxth w1, w1 uxth w1, w1
uxth w2, w2 uxth w2, w2
dmb sy dmb sy
@ -84,6 +85,7 @@ InternalSyncCompareExchange16Fail:
// IN UINT32 ExchangeValue // IN UINT32 ExchangeValue
// ) // )
ASM_PFX(InternalSyncCompareExchange32): ASM_PFX(InternalSyncCompareExchange32):
AARCH64_BTI(c)
dmb sy dmb sy
InternalSyncCompareExchange32Again: InternalSyncCompareExchange32Again:
@ -124,6 +126,7 @@ InternalSyncCompareExchange32Fail:
// IN UINT64 ExchangeValue // IN UINT64 ExchangeValue
// ) // )
ASM_PFX(InternalSyncCompareExchange64): ASM_PFX(InternalSyncCompareExchange64):
AARCH64_BTI(c)
dmb sy dmb sy
InternalSyncCompareExchange64Again: InternalSyncCompareExchange64Again:
@ -159,6 +162,7 @@ InternalSyncCompareExchange64Fail:
// IN volatile UINT32 *Value // IN volatile UINT32 *Value
// ) // )
ASM_PFX(InternalSyncIncrement): ASM_PFX(InternalSyncIncrement):
AARCH64_BTI(c)
dmb sy dmb sy
TryInternalSyncIncrement: TryInternalSyncIncrement:
ldxr w1, [x0] ldxr w1, [x0]
@ -188,6 +192,7 @@ TryInternalSyncIncrement:
// IN volatile UINT32 *Value // IN volatile UINT32 *Value
// ) // )
ASM_PFX(InternalSyncDecrement): ASM_PFX(InternalSyncDecrement):
AARCH64_BTI(c)
dmb sy dmb sy
TryInternalSyncDecrement: TryInternalSyncDecrement:
ldxr w1, [x0] ldxr w1, [x0]