From ea1312a5b443b0d3691d825c2dc8cf2227120ba3 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Sat, 25 Mar 2023 17:36:28 +0100 Subject: [PATCH] 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 Reviewed-by: Leif Lindholm Reviewed-by: Oliver Smith-Denny --- MdePkg/Library/BaseIoLibIntrinsic/AArch64/ArmVirtMmio.S | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/MdePkg/Library/BaseIoLibIntrinsic/AArch64/ArmVirtMmio.S b/MdePkg/Library/BaseIoLibIntrinsic/AArch64/ArmVirtMmio.S index 00f1abec15..77f562697e 100644 --- a/MdePkg/Library/BaseIoLibIntrinsic/AArch64/ArmVirtMmio.S +++ b/MdePkg/Library/BaseIoLibIntrinsic/AArch64/ArmVirtMmio.S @@ -29,6 +29,7 @@ GCC_ASM_EXPORT(MmioWrite64Internal) // @return The value read. // ASM_PFX(MmioRead8Internal): + AARCH64_BTI(c) ldrb w0, [x0] dmb ld ret @@ -44,6 +45,7 @@ ASM_PFX(MmioRead8Internal): // @param Value The value to write to the MMIO register. // ASM_PFX(MmioWrite8Internal): + AARCH64_BTI(c) dmb st strb w1, [x0] ret @@ -60,6 +62,7 @@ ASM_PFX(MmioWrite8Internal): // @return The value read. // ASM_PFX(MmioRead16Internal): + AARCH64_BTI(c) ldrh w0, [x0] dmb ld ret @@ -75,6 +78,7 @@ ASM_PFX(MmioRead16Internal): // @param Value The value to write to the MMIO register. // ASM_PFX(MmioWrite16Internal): + AARCH64_BTI(c) dmb st strh w1, [x0] ret @@ -91,6 +95,7 @@ ASM_PFX(MmioWrite16Internal): // @return The value read. // ASM_PFX(MmioRead32Internal): + AARCH64_BTI(c) ldr w0, [x0] dmb ld ret @@ -106,6 +111,7 @@ ASM_PFX(MmioRead32Internal): // @param Value The value to write to the MMIO register. // ASM_PFX(MmioWrite32Internal): + AARCH64_BTI(c) dmb st str w1, [x0] ret @@ -122,6 +128,7 @@ ASM_PFX(MmioWrite32Internal): // @return The value read. // ASM_PFX(MmioRead64Internal): + AARCH64_BTI(c) ldr x0, [x0] dmb ld ret @@ -137,6 +144,7 @@ ASM_PFX(MmioRead64Internal): // @param Value The value to write to the MMIO register. // ASM_PFX(MmioWrite64Internal): + AARCH64_BTI(c) dmb st str x1, [x0] ret