From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web10.31890.1679914910783170318 for ; Mon, 27 Mar 2023 04:01:50 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ohJWV2Sz; spf=pass (domain: kernel.org, ip: 139.178.84.217, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4E749611B1; Mon, 27 Mar 2023 11:01:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38D4FC433A1; Mon, 27 Mar 2023 11:01:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679914909; bh=RMgj96efskYUPcvmH1jip+vwg0L2CLvqifWfk2LlCNk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ohJWV2SzynnPIgzhZcApnQtLa2020hsLkSJibwCLBtyKLniLGjb5HwzIOP+nzTm0u xGteiADS607uuNZnBPS2mcyySHqIeB2VZ4vNu2iQeZgvg9LQaCUqpb4IjuwohVrI9P heq+5wD4S1bgudYjDcNavIujsTWTLINb33WGq/ARFNqrNxZE4R7BYDEFNbIEuD4KDO iVhJUmKLK0Hv9lfw4Ii/gDVI79g9y1qRag//L0oHAmb5o4UrCwyf3LUoWg5oU+n+4E D5CZ2FLMOYcMfJ/6Jh4bOuAS5dCpQF/Xe+cVSkO/+Oz8UMePnu0E6r3gDP8cQDA8X/ Oz5543c8+DqdA== From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Michael Kinney , Liming Gao , Jiewen Yao , Michael Kubacki , Sean Brogan , Rebecca Cran , Leif Lindholm , Sami Mujawar , Taylor Beebe , =?UTF-8?q?Marvin=20H=C3=A4user?= , Bob Feng Subject: [PATCH v2 06/17] MdePkg/BaseMemoryLibOptDxe AARCH64: Make asm files BTI compatible Date: Mon, 27 Mar 2023 13:01:01 +0200 Message-Id: <20230327110112.262503-7-ardb@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230327110112.262503-1-ardb@kernel.org> References: <20230327110112.262503-1-ardb@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Add the BTI instructions and the associated note to make the AArch64 asm objects compatible with BTI enforcement. Signed-off-by: Ard Biesheuvel --- MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CompareGuid.S | 1 + MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CompareMem.S | 1 + MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CopyMem.S | 1 + MdePkg/Library/BaseMemoryLibOptDxe/AArch64/ScanMem.S | 1 + MdePkg/Library/BaseMemoryLibOptDxe/AArch64/SetMem.S | 5 +++++ 5 files changed, 9 insertions(+) diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CompareGuid.S b/Mde= Pkg/Library/BaseMemoryLibOptDxe/AArch64/CompareGuid.S index b7a566fdafacc8a6..7f058e94b3b7023a 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CompareGuid.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CompareGuid.S @@ -8,6 +8,7 @@ .align 5=0D ASM_GLOBAL ASM_PFX(InternalMemCompareGuid)=0D ASM_PFX(InternalMemCompareGuid):=0D + AARCH64_BTI(c)=0D mov x2, xzr=0D ldp x3, x4, [x0]=0D cbz x1, 0f=0D diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CompareMem.S b/MdeP= kg/Library/BaseMemoryLibOptDxe/AArch64/CompareMem.S index ffe4b7a0b058cc85..707e06b0505a19cd 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CompareMem.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CompareMem.S @@ -32,6 +32,7 @@ .p2align 6=0D ASM_GLOBAL ASM_PFX(InternalMemCompareMem)=0D ASM_PFX(InternalMemCompareMem):=0D + AARCH64_BTI(c)=0D eor tmp1, src1, src2=0D tst tmp1, #7=0D b.ne .Lmisaligned8=0D diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CopyMem.S b/MdePkg/= Library/BaseMemoryLibOptDxe/AArch64/CopyMem.S index 9fad6d1f267c1bcf..59a6593d96cae907 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CopyMem.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/CopyMem.S @@ -178,6 +178,7 @@ L(copy_long): =0D ASM_GLOBAL ASM_PFX(InternalMemCopyMem)=0D ASM_PFX(InternalMemCopyMem):=0D + AARCH64_BTI(c)=0D sub tmp2, dstin, src=0D cmp count, 96=0D ccmp tmp2, count, 2, hi=0D diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/ScanMem.S b/MdePkg/= Library/BaseMemoryLibOptDxe/AArch64/ScanMem.S index 8673b76eca857b8e..55aaf89f56b43fad 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/ScanMem.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/ScanMem.S @@ -45,6 +45,7 @@ =0D ASM_GLOBAL ASM_PFX(InternalMemScanMem8)=0D ASM_PFX(InternalMemScanMem8):=0D + AARCH64_BTI(c)=0D // Do not dereference srcin if no bytes to compare.=0D cbz cntin, .Lzero_length=0D //=0D diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/SetMem.S b/MdePkg/L= ibrary/BaseMemoryLibOptDxe/AArch64/SetMem.S index f9748405592057f0..b5618bf09d8bae2f 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/SetMem.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/AArch64/SetMem.S @@ -29,29 +29,34 @@ =0D ASM_GLOBAL ASM_PFX(InternalMemSetMem16)=0D ASM_PFX(InternalMemSetMem16):=0D + AARCH64_BTI(c)=0D dup v0.8H, valw=0D lsl count, count, #1=0D b 0f=0D =0D ASM_GLOBAL ASM_PFX(InternalMemSetMem32)=0D ASM_PFX(InternalMemSetMem32):=0D + AARCH64_BTI(c)=0D dup v0.4S, valw=0D lsl count, count, #2=0D b 0f=0D =0D ASM_GLOBAL ASM_PFX(InternalMemSetMem64)=0D ASM_PFX(InternalMemSetMem64):=0D + AARCH64_BTI(c)=0D dup v0.2D, val=0D lsl count, count, #3=0D b 0f=0D =0D ASM_GLOBAL ASM_PFX(InternalMemZeroMem)=0D ASM_PFX(InternalMemZeroMem):=0D + AARCH64_BTI(c)=0D movi v0.16B, #0=0D b 0f=0D =0D ASM_GLOBAL ASM_PFX(InternalMemSetMem)=0D ASM_PFX(InternalMemSetMem):=0D + AARCH64_BTI(c)=0D dup v0.16B, valw=0D 0: add dstend, dstin, count=0D mov val, v0.D[0]=0D --=20 2.39.2