From: "Ni, Ray" <ray.ni@intel.com>
To: Ard Biesheuvel <ardb@kernel.org>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Andrew Fish <afish@apple.com>,
"Kinney, Michael D" <michael.d.kinney@intel.com>,
"Liu, Zhiguang" <zhiguang.liu@intel.com>,
Rebecca Cran <rebecca@bsdio.com>,
Tom Lendacky <thomas.lendacky@amd.com>
Subject: Re: [RFT PATCH v2 3/6] UefiCpuPkg/CpuExceptionHandlerLib: Use single SEC/PEI version
Date: Fri, 31 Mar 2023 04:21:30 +0000 [thread overview]
Message-ID: <MN6PR11MB82442D7CD6E43529B69F9BEC8C8F9@MN6PR11MB8244.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20230330212101.1566931-4-ardb@kernel.org>
Thanks for the change.
But it doesn't highlight another impact due to this change: CET logic is removed from the SEC/PEI version.
It's not an issue because CET is only enabled in SMM environment today.
But better to highlight the impact in the commit message, and explicitly say that limitation in the SecPeiCpuExceptionHandlerLib.inf file.
Thanks,
Ray
-----Original Message-----
From: Ard Biesheuvel <ardb@kernel.org>
Sent: Friday, March 31, 2023 5:21 AM
To: devel@edk2.groups.io
Cc: Ard Biesheuvel <ardb@kernel.org>; Ni; Ni, Ray <ray.ni@intel.com>; Andrew Fish <afish@apple.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Liu, Zhiguang <zhiguang.liu@intel.com>; Rebecca Cran <rebecca@bsdio.com>; Tom Lendacky <thomas.lendacky@amd.com>
Subject: [RFT PATCH v2 3/6] UefiCpuPkg/CpuExceptionHandlerLib: Use single SEC/PEI version
Currently, we use the non-Xcode5 version of ExceptionHandlerAsm.nasm
only for the SEC and PEI phases, and this version was not compatible
with the XCODE or LLD linkers, which do not permit absolute relocations
in read-only sections by default. This has been fixed now, so we can use
it for all toolchains.
Let's rename the .nasm file to reflect the fact that is used for the
SecPei flavor of this library only, and while at it, remove some
unnecessary absolute references.
Since this makes the generic version compatible with the XCODE, let's
use this [smaller] version for XCODE5 builds too.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf | 2 +-
UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/{ExceptionHandlerAsm.nasm => SecPeiExceptionHandlerAsm.nasm} | 7 +++----
UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf | 2 +-
3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
index df44371fe018e06d..10c5c5f2e5d203f6 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
@@ -28,7 +28,7 @@ [Sources.Ia32]
Ia32/ArchInterruptDefs.h
[Sources.X64]
- X64/ExceptionHandlerAsm.nasm
+ X64/SecPeiExceptionHandlerAsm.nasm
X64/ArchExceptionHandler.c
X64/ArchInterruptDefs.h
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/SecPeiExceptionHandlerAsm.nasm
similarity index 95%
rename from UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm
rename to UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/SecPeiExceptionHandlerAsm.nasm
index aaf8d622e6f3b8f1..585298768a66af6a 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/SecPeiExceptionHandlerAsm.nasm
@@ -276,8 +276,7 @@ DrFinish:
; and make sure RSP is 16-byte aligned
;
sub rsp, 4 * 8 + 8
- mov rax, ASM_PFX(CommonExceptionHandler)
- call rax
+ call ASM_PFX(CommonExceptionHandler)
add rsp, 4 * 8 + 8
cli
@@ -384,10 +383,10 @@ DoIret:
; comments here for definition of address map
global ASM_PFX(AsmGetTemplateAddressMap)
ASM_PFX(AsmGetTemplateAddressMap):
- mov rax, AsmIdtVectorBegin
+ lea rax, [AsmIdtVectorBegin]
mov qword [rcx], rax
mov qword [rcx + 0x8], (AsmIdtVectorEnd - AsmIdtVectorBegin) / 32
- mov rax, HookAfterStubHeaderBegin
+ lea rax, [HookAfterStubHeaderBegin]
mov qword [rcx + 0x10], rax
ret
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf
index 619b39d7f1de9ae3..c58fbb0d74500e48 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf
@@ -33,7 +33,7 @@ [Sources.Ia32]
Ia32/ArchInterruptDefs.h
[Sources.X64]
- X64/Xcode5ExceptionHandlerAsm.nasm
+ X64/SecPeiExceptionHandlerAsm.nasm
X64/ArchExceptionHandler.c
X64/ArchInterruptDefs.h
--
2.39.2
next prev parent reply other threads:[~2023-03-31 4:24 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-30 21:20 [RFT PATCH v2 0/6] UefiCpuPkg, OvmfPkf: Simplify CpuExceptionHandlerLib Ard Biesheuvel
2023-03-30 21:20 ` [RFT PATCH v2 1/6] BaseTools/tools_def XCODE: Link X64 with -read_only_relocs suppress Ard Biesheuvel
2023-03-30 21:54 ` [edk2-devel] " Marvin Häuser
2023-03-31 7:39 ` Ard Biesheuvel
2023-03-31 8:29 ` Marvin Häuser
2023-03-31 8:59 ` Ard Biesheuvel
2023-03-31 9:27 ` Marvin Häuser
2023-03-31 9:36 ` Ard Biesheuvel
2023-03-31 10:35 ` Marvin Häuser
2023-03-31 10:52 ` Gerd Hoffmann
2023-03-31 10:58 ` Ard Biesheuvel
2023-03-31 11:00 ` Marvin Häuser
2023-03-31 9:16 ` Gerd Hoffmann
2023-03-31 14:58 ` Rebecca Cran
2023-03-31 15:08 ` Marvin Häuser
2023-03-30 21:20 ` [RFT PATCH v2 2/6] BaseTools/tools_def CLANGDWARF: Permit text relocations Ard Biesheuvel
2023-03-30 21:20 ` [RFT PATCH v2 3/6] UefiCpuPkg/CpuExceptionHandlerLib: Use single SEC/PEI version Ard Biesheuvel
2023-03-31 4:21 ` Ni, Ray [this message]
2023-03-31 7:40 ` [edk2-devel] " Ard Biesheuvel
2023-03-31 8:01 ` Ni, Ray
2023-03-30 21:20 ` [RFT PATCH v2 4/6] UefiCpuPkg/CpuExceptionHandlerLib: Remove needless runtime fixups Ard Biesheuvel
2023-03-30 22:04 ` [edk2-devel] " Marvin Häuser
2023-03-31 5:08 ` Ni, Ray
2023-03-31 8:06 ` Marvin Häuser
2023-03-31 4:22 ` Ni, Ray
2023-03-30 21:21 ` [RFT PATCH v2 5/6] OvmfPkg: Drop special Xcode5 version of exception handler library Ard Biesheuvel
2023-03-31 0:37 ` [edk2-devel] " Yao, Jiewen
2023-03-30 21:21 ` [RFT PATCH v2 6/6] UefiCpuPkg/CpuExceptionHandlerLib: Drop special XCODE5 version Ard Biesheuvel
2023-03-31 4:23 ` [edk2-devel] " Ni, Ray
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=MN6PR11MB82442D7CD6E43529B69F9BEC8C8F9@MN6PR11MB8244.namprd11.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox