diff options
author | Ard Biesheuvel <ardb@kernel.org> | 2023-03-25 17:37:30 +0100 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2023-03-30 11:05:22 +0000 |
commit | 0ee255f50a7d612f157ab95db00dc49406b7a627 (patch) | |
tree | d55a74db6a81102f93748afb5a61e56e2616f28a /MdePkg | |
parent | c4c7fb21744788e40de85630280e1c101b85294e (diff) | |
download | edk2-0ee255f50a7d612f157ab95db00dc49406b7a627.tar.gz edk2-0ee255f50a7d612f157ab95db00dc49406b7a627.tar.bz2 edk2-0ee255f50a7d612f157ab95db00dc49406b7a627.zip |
MdePkg/BaseMemoryLibOptDxe 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>
Diffstat (limited to 'MdePkg')
5 files changed, 9 insertions, 0 deletions
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CompareGuid.S b/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CompareGuid.S index b7a566fdaf..7f058e94b3 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CompareGuid.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CompareGuid.S @@ -8,6 +8,7 @@ .align 5
ASM_GLOBAL ASM_PFX(InternalMemCompareGuid)
ASM_PFX(InternalMemCompareGuid):
+ AARCH64_BTI(c)
mov x2, xzr
ldp x3, x4, [x0]
cbz x1, 0f
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CompareMem.S b/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CompareMem.S index ffe4b7a0b0..707e06b050 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CompareMem.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CompareMem.S @@ -32,6 +32,7 @@ .p2align 6
ASM_GLOBAL ASM_PFX(InternalMemCompareMem)
ASM_PFX(InternalMemCompareMem):
+ AARCH64_BTI(c)
eor tmp1, src1, src2
tst tmp1, #7
b.ne .Lmisaligned8
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CopyMem.S b/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CopyMem.S index 9fad6d1f26..59a6593d96 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CopyMem.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CopyMem.S @@ -178,6 +178,7 @@ L(copy_long): ASM_GLOBAL ASM_PFX(InternalMemCopyMem)
ASM_PFX(InternalMemCopyMem):
+ AARCH64_BTI(c)
sub tmp2, dstin, src
cmp count, 96
ccmp tmp2, count, 2, hi
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/ScanMem.S b/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/ScanMem.S index 8673b76eca..55aaf89f56 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/ScanMem.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/ScanMem.S @@ -45,6 +45,7 @@ ASM_GLOBAL ASM_PFX(InternalMemScanMem8)
ASM_PFX(InternalMemScanMem8):
+ AARCH64_BTI(c)
// Do not dereference srcin if no bytes to compare.
cbz cntin, .Lzero_length
//
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/SetMem.S b/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/SetMem.S index f974840559..b5618bf09d 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/SetMem.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/SetMem.S @@ -29,29 +29,34 @@ ASM_GLOBAL ASM_PFX(InternalMemSetMem16)
ASM_PFX(InternalMemSetMem16):
+ AARCH64_BTI(c)
dup v0.8H, valw
lsl count, count, #1
b 0f
ASM_GLOBAL ASM_PFX(InternalMemSetMem32)
ASM_PFX(InternalMemSetMem32):
+ AARCH64_BTI(c)
dup v0.4S, valw
lsl count, count, #2
b 0f
ASM_GLOBAL ASM_PFX(InternalMemSetMem64)
ASM_PFX(InternalMemSetMem64):
+ AARCH64_BTI(c)
dup v0.2D, val
lsl count, count, #3
b 0f
ASM_GLOBAL ASM_PFX(InternalMemZeroMem)
ASM_PFX(InternalMemZeroMem):
+ AARCH64_BTI(c)
movi v0.16B, #0
b 0f
ASM_GLOBAL ASM_PFX(InternalMemSetMem)
ASM_PFX(InternalMemSetMem):
+ AARCH64_BTI(c)
dup v0.16B, valw
0: add dstend, dstin, count
mov val, v0.D[0]
|