MdePkg/BaseIoLibIntrinsic 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:36:28 +01:00 committed by mergify[bot]
parent c5cd360277
commit ea1312a5b4
1 changed files with 8 additions and 0 deletions

View File

@ -29,6 +29,7 @@ GCC_ASM_EXPORT(MmioWrite64Internal)
// @return The value read. // @return The value read.
// //
ASM_PFX(MmioRead8Internal): ASM_PFX(MmioRead8Internal):
AARCH64_BTI(c)
ldrb w0, [x0] ldrb w0, [x0]
dmb ld dmb ld
ret ret
@ -44,6 +45,7 @@ ASM_PFX(MmioRead8Internal):
// @param Value The value to write to the MMIO register. // @param Value The value to write to the MMIO register.
// //
ASM_PFX(MmioWrite8Internal): ASM_PFX(MmioWrite8Internal):
AARCH64_BTI(c)
dmb st dmb st
strb w1, [x0] strb w1, [x0]
ret ret
@ -60,6 +62,7 @@ ASM_PFX(MmioWrite8Internal):
// @return The value read. // @return The value read.
// //
ASM_PFX(MmioRead16Internal): ASM_PFX(MmioRead16Internal):
AARCH64_BTI(c)
ldrh w0, [x0] ldrh w0, [x0]
dmb ld dmb ld
ret ret
@ -75,6 +78,7 @@ ASM_PFX(MmioRead16Internal):
// @param Value The value to write to the MMIO register. // @param Value The value to write to the MMIO register.
// //
ASM_PFX(MmioWrite16Internal): ASM_PFX(MmioWrite16Internal):
AARCH64_BTI(c)
dmb st dmb st
strh w1, [x0] strh w1, [x0]
ret ret
@ -91,6 +95,7 @@ ASM_PFX(MmioWrite16Internal):
// @return The value read. // @return The value read.
// //
ASM_PFX(MmioRead32Internal): ASM_PFX(MmioRead32Internal):
AARCH64_BTI(c)
ldr w0, [x0] ldr w0, [x0]
dmb ld dmb ld
ret ret
@ -106,6 +111,7 @@ ASM_PFX(MmioRead32Internal):
// @param Value The value to write to the MMIO register. // @param Value The value to write to the MMIO register.
// //
ASM_PFX(MmioWrite32Internal): ASM_PFX(MmioWrite32Internal):
AARCH64_BTI(c)
dmb st dmb st
str w1, [x0] str w1, [x0]
ret ret
@ -122,6 +128,7 @@ ASM_PFX(MmioWrite32Internal):
// @return The value read. // @return The value read.
// //
ASM_PFX(MmioRead64Internal): ASM_PFX(MmioRead64Internal):
AARCH64_BTI(c)
ldr x0, [x0] ldr x0, [x0]
dmb ld dmb ld
ret ret
@ -137,6 +144,7 @@ ASM_PFX(MmioRead64Internal):
// @param Value The value to write to the MMIO register. // @param Value The value to write to the MMIO register.
// //
ASM_PFX(MmioWrite64Internal): ASM_PFX(MmioWrite64Internal):
AARCH64_BTI(c)
dmb st dmb st
str x1, [x0] str x1, [x0]
ret ret