* [PATCH v3 0/3] XCODE5 toolchain binary patching fix
@ 2020-05-07 13:06 Lendacky, Thomas
2020-05-07 13:06 ` [PATCH v3 1/3] UefiCpuPkg/CpuExceptionHandler: Make XCODE5 changes toolchain specific Lendacky, Thomas
` (5 more replies)
0 siblings, 6 replies; 8+ messages in thread
From: Lendacky, Thomas @ 2020-05-07 13:06 UTC (permalink / raw)
To: devel
Cc: Jordan Justen, Laszlo Ersek, Ard Biesheuvel, Liming Gao,
Eric Dong, Ray Ni, Anthony Perard, Julien Grall, Brijesh Singh,
Andrew Fish
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2340
Commit 2db0ccc2d7fe ("UefiCpuPkg: Update CpuExceptionHandlerLib pass
XCODE5 tool chain") introduced binary patching in the
ExceptionHandlerAsm.nasm in order to support the XCODE5 toolchain.
However, the CpuExceptionHandlerLib can be used during SEC phase which
would result in binary patching of flash.
This series creates a new CpuExceptionHandlerLib file to support
the required binary patching for the XCODE5 toolchain, while reverting
the changes from commit 2db0ccc2d7fe in the standard file. As the Pei,
Dxe and SMM versions of the library operate in memory (as opposed to
flash), only the SEC/PEI version is of the library is updated to use the
version of the ExceptionHandlerAsm.nasm that does not perform binary
patching.
This is accomplished in phases:
- Create a new XCODE5 specific version of the ExceptionHandlerAsm.nasm
file and update all CpuExceptionHandler INF files to use it while also
creating a new SEC/PEI CpuExceptionHandler INF file specifically for
the XCODE5 toolchain.
- Update all package DSC files that use the SecPeiCpuExceptionHandlerLib
version of the library to use the XCODE5 version of the library,
Xcode5SecPeiCpuExceptionHandlerLib, when the XCODE5 toolchain is used.
- Revert the changes made by commit 2db0ccc2d7fe in the standard file
and update the SecPeiCpuExceptionHandlerLib.inf file to use the
standard file.
I don't have access to an XCODE5 toolchain setup, so I have not tested
this with XCODE5. I would like to request that someone who does please
test this.
---
These patches are based on commit:
faef5a367c83 ("ShellPkg: acpiview: Check if SBBR mandatory ACPI tables are installed")
Cc: Andrew Fish <afish@apple.com>
Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien@xen.org>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Changes since v2:
- Updated [Components] section of UefiCpuPkg.dsc to conditionally exclude
SecPeiCpuExceptionHandlerLib.inf for the XCODE5 toolchain.
- Added some missed Reviewed-by: and Acked-by: tags from previous
versions.
Changes since v1:
- Only apply the revert to the Sec/Pei CpuExceptionHandler library and
leave the Pei, Dxe and Smm versions using the binary patching version.
- Generate a unique file GUID for the new library INF file and create
a corresponding UNI file.
- Remove any references to SEV-ES (original patches accidentally submitted
from wrong tree).
Tom Lendacky (3):
UefiCpuPkg/CpuExceptionHandler: Make XCODE5 changes toolchain specific
OvmfPkg: Use toolchain appropriate CpuExceptionHandlerLib
UefiCpuPkg/CpuExceptionHandler: Revert CpuExceptionHandler binary
patching
OvmfPkg/OvmfPkgIa32.dsc | 4 +++
OvmfPkg/OvmfPkgIa32X64.dsc | 4 +++
OvmfPkg/OvmfPkgX64.dsc | 4 +++
OvmfPkg/OvmfXen.dsc | 4 +++
UefiCpuPkg/UefiCpuPkg.dsc | 7 ++++++
.../DxeCpuExceptionHandlerLib.inf | 2 +-
.../PeiCpuExceptionHandlerLib.inf | 2 +-
.../SmmCpuExceptionHandlerLib.inf | 2 +-
...=> Xcode5SecPeiCpuExceptionHandlerLib.inf} | 13 +++++++---
.../X64/ExceptionHandlerAsm.nasm | 25 +++++--------------
...sm.nasm => Xcode5ExceptionHandlerAsm.nasm} | 0
.../Xcode5SecPeiCpuExceptionHandlerLib.uni | 18 +++++++++++++
12 files changed, 59 insertions(+), 26 deletions(-)
copy UefiCpuPkg/Library/CpuExceptionHandlerLib/{SecPeiCpuExceptionHandlerLib.inf => Xcode5SecPeiCpuExceptionHandlerLib.inf} (64%)
copy UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/{ExceptionHandlerAsm.nasm => Xcode5ExceptionHandlerAsm.nasm} (100%)
create mode 100644 UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.uni
--
2.17.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 1/3] UefiCpuPkg/CpuExceptionHandler: Make XCODE5 changes toolchain specific
2020-05-07 13:06 [PATCH v3 0/3] XCODE5 toolchain binary patching fix Lendacky, Thomas
@ 2020-05-07 13:06 ` Lendacky, Thomas
2020-05-07 13:06 ` [PATCH v3 2/3] OvmfPkg: Use toolchain appropriate CpuExceptionHandlerLib Lendacky, Thomas
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Lendacky, Thomas @ 2020-05-07 13:06 UTC (permalink / raw)
To: devel
Cc: Jordan Justen, Laszlo Ersek, Ard Biesheuvel, Liming Gao,
Eric Dong, Ray Ni, Anthony Perard, Julien Grall, Brijesh Singh,
Andrew Fish
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2340
Commit 2db0ccc2d7fe ("UefiCpuPkg: Update CpuExceptionHandlerLib pass
XCODE5 tool chain") introduced binary patching into the exception handling
support. CPU exception handling is allowed during SEC and this results in
binary patching of flash, which should not be done.
Separate the changes from commit 2db0ccc2d7fe into an XCODE5 toolchain
specific file, Xcode5ExceptionHandlerAsm.nasm, and create a new SEC INF
file for the XCODE5 version of CpuExceptionHandlerLib.
Since binary patching is allowed when running outside of flash, switch
the Dxe, Pei and Smm versions of the CpuExceptionHandlerLib over to use
the Xcode5ExceptionHandlerAsm.nasm file to retain current functionality.
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
UefiCpuPkg/UefiCpuPkg.dsc | 7 +++++++
.../DxeCpuExceptionHandlerLib.inf | 2 +-
.../PeiCpuExceptionHandlerLib.inf | 2 +-
.../SmmCpuExceptionHandlerLib.inf | 2 +-
... => Xcode5SecPeiCpuExceptionHandlerLib.inf} | 13 +++++++++----
...Asm.nasm => Xcode5ExceptionHandlerAsm.nasm} | 0
.../Xcode5SecPeiCpuExceptionHandlerLib.uni | 18 ++++++++++++++++++
7 files changed, 37 insertions(+), 7 deletions(-)
copy UefiCpuPkg/Library/CpuExceptionHandlerLib/{SecPeiCpuExceptionHandlerLib.inf => Xcode5SecPeiCpuExceptionHandlerLib.inf} (64%)
copy UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/{ExceptionHandlerAsm.nasm => Xcode5ExceptionHandlerAsm.nasm} (100%)
create mode 100644 UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.uni
diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc
index d28cb5cccb52..afa304128221 100644
--- a/UefiCpuPkg/UefiCpuPkg.dsc
+++ b/UefiCpuPkg/UefiCpuPkg.dsc
@@ -59,7 +59,11 @@ [LibraryClasses]
[LibraryClasses.common.SEC]
PlatformSecLib|UefiCpuPkg/Library/PlatformSecLibNull/PlatformSecLibNull.inf
+!if $(TOOL_CHAIN_TAG) == "XCODE5"
+ CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf
+!else
CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
+!endif
HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
@@ -123,9 +127,12 @@ [Components.IA32, Components.X64]
UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.inf
UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
+!if $(TOOL_CHAIN_TAG) != "XCODE5"
UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
+!endif
UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf
UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf
+ UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf
UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
index e41383573043..61e2ec30b089 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
@@ -28,7 +28,7 @@ [Sources.Ia32]
Ia32/ArchInterruptDefs.h
[Sources.X64]
- X64/ExceptionHandlerAsm.nasm
+ X64/Xcode5ExceptionHandlerAsm.nasm
X64/ArchExceptionHandler.c
X64/ArchInterruptDefs.h
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf
index f31423ac0f91..093374944df6 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf
@@ -28,7 +28,7 @@ [Sources.Ia32]
Ia32/ArchInterruptDefs.h
[Sources.X64]
- X64/ExceptionHandlerAsm.nasm
+ X64/Xcode5ExceptionHandlerAsm.nasm
X64/ArchExceptionHandler.c
X64/ArchInterruptDefs.h
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf
index 66c7f59e3c91..2ffbbccc302f 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf
@@ -28,7 +28,7 @@ [Sources.Ia32]
Ia32/ArchInterruptDefs.h
[Sources.X64]
- X64/ExceptionHandlerAsm.nasm
+ X64/Xcode5ExceptionHandlerAsm.nasm
X64/ArchExceptionHandler.c
X64/ArchInterruptDefs.h
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf
similarity index 64%
copy from UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
copy to UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf
index 6d25cafe2ca3..7e21beaab6f2 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf
@@ -1,16 +1,21 @@
## @file
# CPU Exception Handler library instance for SEC/PEI modules.
#
+# Copyright (C) 2020, Advanced Micro Devices, Inc. All rights reserved.<BR>
# Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
+# This is the XCODE5 variant of the SEC/PEI CpuExceptionHandlerLib. This
+# variant performs binary patching to fix up addresses that allow the
+# XCODE5 toolchain to be used.
+#
##
[Defines]
INF_VERSION = 0x00010005
- BASE_NAME = SecPeiCpuExceptionHandlerLib
- MODULE_UNI_FILE = SecPeiCpuExceptionHandlerLib.uni
- FILE_GUID = CA4BBC99-DFC6-4234-B553-8B6586B7B113
+ BASE_NAME = Xcode5SecPeiCpuExceptionHandlerLib
+ MODULE_UNI_FILE = Xcode5SecPeiCpuExceptionHandlerLib.uni
+ FILE_GUID = 49C481AF-1621-42F3-8FA1-27C64143E304
MODULE_TYPE = PEIM
VERSION_STRING = 1.1
LIBRARY_CLASS = CpuExceptionHandlerLib|SEC PEI_CORE PEIM
@@ -28,7 +33,7 @@ [Sources.Ia32]
Ia32/ArchInterruptDefs.h
[Sources.X64]
- X64/ExceptionHandlerAsm.nasm
+ X64/Xcode5ExceptionHandlerAsm.nasm
X64/ArchExceptionHandler.c
X64/ArchInterruptDefs.h
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/Xcode5ExceptionHandlerAsm.nasm
similarity index 100%
copy from UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm
copy to UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/Xcode5ExceptionHandlerAsm.nasm
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.uni b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.uni
new file mode 100644
index 000000000000..a63b25f39d99
--- /dev/null
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.uni
@@ -0,0 +1,18 @@
+// /** @file
+// XCODE5 CPU Exception Handler library instance for SEC/PEI modules.
+//
+// CPU Exception Handler library instance for SEC/PEI modules when built
+// using the XCODE5 toolchain.
+//
+// Copyright (C) 2020, Advanced Micro Devices, Inc. All rights reserved.<BR>
+// Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+
+#string STR_MODULE_ABSTRACT #language en-US "CPU Exception Handler library instance for SEC/PEI modules with the XCODE5 toolchain."
+
+#string STR_MODULE_DESCRIPTION #language en-US "CPU Exception Handler library instance for SEC/PEI modules with the XCODE5 toolchain."
+
--
2.17.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v3 2/3] OvmfPkg: Use toolchain appropriate CpuExceptionHandlerLib
2020-05-07 13:06 [PATCH v3 0/3] XCODE5 toolchain binary patching fix Lendacky, Thomas
2020-05-07 13:06 ` [PATCH v3 1/3] UefiCpuPkg/CpuExceptionHandler: Make XCODE5 changes toolchain specific Lendacky, Thomas
@ 2020-05-07 13:06 ` Lendacky, Thomas
2020-05-07 13:06 ` [PATCH v3 3/3] UefiCpuPkg/CpuExceptionHandler: Revert CpuExceptionHandler binary patching Lendacky, Thomas
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Lendacky, Thomas @ 2020-05-07 13:06 UTC (permalink / raw)
To: devel
Cc: Jordan Justen, Laszlo Ersek, Ard Biesheuvel, Liming Gao,
Eric Dong, Ray Ni, Anthony Perard, Julien Grall, Brijesh Singh,
Andrew Fish, Ard Biesheuvel
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2340
During the SEC phase, use the XCODE5 CpuExceptionHandlerLib library in
place of the standard library when building with the XCODE5 toolchain.
The SEC XCODE5 version of the library performs binary patching and should
only be used when building with the XCODE5 toolchain.
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Julien Grall <julien@xen.org>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
OvmfPkg/OvmfPkgIa32.dsc | 4 ++++
OvmfPkg/OvmfPkgIa32X64.dsc | 4 ++++
OvmfPkg/OvmfPkgX64.dsc | 4 ++++
OvmfPkg/OvmfXen.dsc | 4 ++++
4 files changed, 16 insertions(+)
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 7c8b51f43b66..41ac3202961b 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -246,7 +246,11 @@ [LibraryClasses.common.SEC]
PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
+!if $(TOOL_CHAIN_TAG) == "XCODE5"
+ CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf
+!else
CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
+!endif
[LibraryClasses.common.PEI_CORE]
HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index a0596c44168c..c2f11aee2cec 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -250,7 +250,11 @@ [LibraryClasses.common.SEC]
PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
+!if $(TOOL_CHAIN_TAG) == "XCODE5"
+ CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf
+!else
CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
+!endif
[LibraryClasses.common.PEI_CORE]
HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 2e764b6b7233..643e6041ad53 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -250,7 +250,11 @@ [LibraryClasses.common.SEC]
PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
+!if $(TOOL_CHAIN_TAG) == "XCODE5"
+ CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf
+!else
CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
+!endif
[LibraryClasses.common.PEI_CORE]
HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
index 8b3615e0b07e..143dc6d5a766 100644
--- a/OvmfPkg/OvmfXen.dsc
+++ b/OvmfPkg/OvmfXen.dsc
@@ -228,7 +228,11 @@ [LibraryClasses.common.SEC]
PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
+!if $(TOOL_CHAIN_TAG) == "XCODE5"
+ CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf
+!else
CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
+!endif
[LibraryClasses.common.PEI_CORE]
HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
--
2.17.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v3 3/3] UefiCpuPkg/CpuExceptionHandler: Revert CpuExceptionHandler binary patching
2020-05-07 13:06 [PATCH v3 0/3] XCODE5 toolchain binary patching fix Lendacky, Thomas
2020-05-07 13:06 ` [PATCH v3 1/3] UefiCpuPkg/CpuExceptionHandler: Make XCODE5 changes toolchain specific Lendacky, Thomas
2020-05-07 13:06 ` [PATCH v3 2/3] OvmfPkg: Use toolchain appropriate CpuExceptionHandlerLib Lendacky, Thomas
@ 2020-05-07 13:06 ` Lendacky, Thomas
2020-05-08 11:28 ` [PATCH v3 0/3] XCODE5 toolchain binary patching fix Laszlo Ersek
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Lendacky, Thomas @ 2020-05-07 13:06 UTC (permalink / raw)
To: devel
Cc: Jordan Justen, Laszlo Ersek, Ard Biesheuvel, Liming Gao,
Eric Dong, Ray Ni, Anthony Perard, Julien Grall, Brijesh Singh,
Andrew Fish
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2340
Now that an XCODE5 specific CpuExceptionHandlerLib library is in place,
revert the changes made to the ExceptionHandlerAsm.nasm in commit
2db0ccc2d7fe ("UefiCpuPkg: Update CpuExceptionHandlerLib pass XCODE5 tool
chain") so that binary patching of flash code is not performed.
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Liming Gao <liming.gao@intel.com>
Acked-by: Bret Barkelew <bret.barkelew@microsoft.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
.../X64/ExceptionHandlerAsm.nasm | 25 +++++--------------
1 file changed, 6 insertions(+), 19 deletions(-)
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm
index 19198f273137..3814f9de3703 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm
@@ -34,7 +34,7 @@ AsmIdtVectorBegin:
db 0x6a ; push #VectorNum
db ($ - AsmIdtVectorBegin) / ((AsmIdtVectorEnd - AsmIdtVectorBegin) / 32) ; VectorNum
push rax
- mov rax, strict qword 0 ; mov rax, ASM_PFX(CommonInterruptEntry)
+ mov rax, ASM_PFX(CommonInterruptEntry)
jmp rax
%endrep
AsmIdtVectorEnd:
@@ -44,8 +44,7 @@ HookAfterStubHeaderBegin:
@VectorNum:
db 0 ; 0 will be fixed
push rax
- mov rax, strict qword 0 ; mov rax, HookAfterStubHeaderEnd
-JmpAbsoluteAddress:
+ mov rax, HookAfterStubHeaderEnd
jmp rax
HookAfterStubHeaderEnd:
mov rax, rsp
@@ -257,7 +256,8 @@ HasErrorCode:
; and make sure RSP is 16-byte aligned
;
sub rsp, 4 * 8 + 8
- call ASM_PFX(CommonExceptionHandler)
+ mov rax, ASM_PFX(CommonExceptionHandler)
+ call rax
add rsp, 4 * 8 + 8
cli
@@ -365,24 +365,11 @@ DoIret:
; comments here for definition of address map
global ASM_PFX(AsmGetTemplateAddressMap)
ASM_PFX(AsmGetTemplateAddressMap):
- lea rax, [AsmIdtVectorBegin]
+ mov rax, AsmIdtVectorBegin
mov qword [rcx], rax
mov qword [rcx + 0x8], (AsmIdtVectorEnd - AsmIdtVectorBegin) / 32
- lea rax, [HookAfterStubHeaderBegin]
+ mov rax, HookAfterStubHeaderBegin
mov qword [rcx + 0x10], rax
-
-; Fix up CommonInterruptEntry address
- lea rax, [ASM_PFX(CommonInterruptEntry)]
- lea rcx, [AsmIdtVectorBegin]
-%rep 32
- mov qword [rcx + (JmpAbsoluteAddress - 8 - HookAfterStubHeaderBegin)], rax
- add rcx, (AsmIdtVectorEnd - AsmIdtVectorBegin) / 32
-%endrep
-; Fix up HookAfterStubHeaderEnd
- lea rax, [HookAfterStubHeaderEnd]
- lea rcx, [JmpAbsoluteAddress]
- mov qword [rcx - 8], rax
-
ret
;-------------------------------------------------------------------------------------
--
2.17.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v3 0/3] XCODE5 toolchain binary patching fix
2020-05-07 13:06 [PATCH v3 0/3] XCODE5 toolchain binary patching fix Lendacky, Thomas
` (2 preceding siblings ...)
2020-05-07 13:06 ` [PATCH v3 3/3] UefiCpuPkg/CpuExceptionHandler: Revert CpuExceptionHandler binary patching Lendacky, Thomas
@ 2020-05-08 11:28 ` Laszlo Ersek
2020-05-08 14:11 ` Liming Gao
2020-05-09 2:17 ` [edk2-devel] " Dong, Eric
2020-05-11 20:06 ` Laszlo Ersek
5 siblings, 1 reply; 8+ messages in thread
From: Laszlo Ersek @ 2020-05-08 11:28 UTC (permalink / raw)
To: Jordan Justen, Liming Gao, Eric Dong, Ray Ni
Cc: Tom Lendacky, devel, Ard Biesheuvel, Anthony Perard, Julien Grall,
Brijesh Singh, Andrew Fish, Chasel Chiu, Kelly Steele,
Michael D Kinney, Nate DeSimone, Yi Qian, Zailiang Sun
Eric, Ray, Liming -- do you have comments please?
I'm ready to push the series (it has two UefiCpuPkg patches and one
OvmfPkg patch).
Please consider specifically whether we should push the last patch at
once. The last patch would prevent the following "edk2-platforms" DSC
files from building with XCODE5:
Platform/Intel/MinPlatformPkg/Include/Dsc/CorePeiLib.dsc
Platform/Intel/QuarkPlatformPkg/Quark.dsc
Platform/Intel/QuarkPlatformPkg/QuarkMin.dsc
Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
That could be prevented if Tom sent patches for them like the middle
(OvmfPkg) patch in this series. But we don't know if those platforms
above are ever built with XCODE5.
Adding their maintainers to the CC list as well.
Thanks,
Laszlo
On 05/07/20 15:06, Tom Lendacky wrote:
>
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2340
>
> Commit 2db0ccc2d7fe ("UefiCpuPkg: Update CpuExceptionHandlerLib pass
> XCODE5 tool chain") introduced binary patching in the
> ExceptionHandlerAsm.nasm in order to support the XCODE5 toolchain.
> However, the CpuExceptionHandlerLib can be used during SEC phase which
> would result in binary patching of flash.
>
> This series creates a new CpuExceptionHandlerLib file to support
> the required binary patching for the XCODE5 toolchain, while reverting
> the changes from commit 2db0ccc2d7fe in the standard file. As the Pei,
> Dxe and SMM versions of the library operate in memory (as opposed to
> flash), only the SEC/PEI version is of the library is updated to use the
> version of the ExceptionHandlerAsm.nasm that does not perform binary
> patching.
>
> This is accomplished in phases:
> - Create a new XCODE5 specific version of the ExceptionHandlerAsm.nasm
> file and update all CpuExceptionHandler INF files to use it while also
> creating a new SEC/PEI CpuExceptionHandler INF file specifically for
> the XCODE5 toolchain.
> - Update all package DSC files that use the SecPeiCpuExceptionHandlerLib
> version of the library to use the XCODE5 version of the library,
> Xcode5SecPeiCpuExceptionHandlerLib, when the XCODE5 toolchain is used.
> - Revert the changes made by commit 2db0ccc2d7fe in the standard file
> and update the SecPeiCpuExceptionHandlerLib.inf file to use the
> standard file.
>
> I don't have access to an XCODE5 toolchain setup, so I have not tested
> this with XCODE5. I would like to request that someone who does please
> test this.
>
> ---
>
> These patches are based on commit:
> faef5a367c83 ("ShellPkg: acpiview: Check if SBBR mandatory ACPI tables are installed")
>
> Cc: Andrew Fish <afish@apple.com>
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Brijesh Singh <brijesh.singh@amd.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien@xen.org>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
>
> Changes since v2:
> - Updated [Components] section of UefiCpuPkg.dsc to conditionally exclude
> SecPeiCpuExceptionHandlerLib.inf for the XCODE5 toolchain.
> - Added some missed Reviewed-by: and Acked-by: tags from previous
> versions.
>
> Changes since v1:
> - Only apply the revert to the Sec/Pei CpuExceptionHandler library and
> leave the Pei, Dxe and Smm versions using the binary patching version.
> - Generate a unique file GUID for the new library INF file and create
> a corresponding UNI file.
> - Remove any references to SEV-ES (original patches accidentally submitted
> from wrong tree).
>
> Tom Lendacky (3):
> UefiCpuPkg/CpuExceptionHandler: Make XCODE5 changes toolchain specific
> OvmfPkg: Use toolchain appropriate CpuExceptionHandlerLib
> UefiCpuPkg/CpuExceptionHandler: Revert CpuExceptionHandler binary
> patching
>
> OvmfPkg/OvmfPkgIa32.dsc | 4 +++
> OvmfPkg/OvmfPkgIa32X64.dsc | 4 +++
> OvmfPkg/OvmfPkgX64.dsc | 4 +++
> OvmfPkg/OvmfXen.dsc | 4 +++
> UefiCpuPkg/UefiCpuPkg.dsc | 7 ++++++
> .../DxeCpuExceptionHandlerLib.inf | 2 +-
> .../PeiCpuExceptionHandlerLib.inf | 2 +-
> .../SmmCpuExceptionHandlerLib.inf | 2 +-
> ...=> Xcode5SecPeiCpuExceptionHandlerLib.inf} | 13 +++++++---
> .../X64/ExceptionHandlerAsm.nasm | 25 +++++--------------
> ...sm.nasm => Xcode5ExceptionHandlerAsm.nasm} | 0
> .../Xcode5SecPeiCpuExceptionHandlerLib.uni | 18 +++++++++++++
> 12 files changed, 59 insertions(+), 26 deletions(-)
> copy UefiCpuPkg/Library/CpuExceptionHandlerLib/{SecPeiCpuExceptionHandlerLib.inf => Xcode5SecPeiCpuExceptionHandlerLib.inf} (64%)
> copy UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/{ExceptionHandlerAsm.nasm => Xcode5ExceptionHandlerAsm.nasm} (100%)
> create mode 100644 UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.uni
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 0/3] XCODE5 toolchain binary patching fix
2020-05-08 11:28 ` [PATCH v3 0/3] XCODE5 toolchain binary patching fix Laszlo Ersek
@ 2020-05-08 14:11 ` Liming Gao
0 siblings, 0 replies; 8+ messages in thread
From: Liming Gao @ 2020-05-08 14:11 UTC (permalink / raw)
To: Laszlo Ersek, Justen, Jordan L, Dong, Eric, Ni, Ray
Cc: Tom Lendacky, devel@edk2.groups.io, Ard Biesheuvel,
Anthony Perard, Julien Grall, Brijesh Singh, Andrew Fish,
Chiu, Chasel, Steele, Kelly, Kinney, Michael D,
Desimone, Nathaniel L, Qian, Yi, Sun, Zailiang
Laszlo:
This change is OK to me. It doesn't impact those platforms, because their SEC and PEI are IA32 only. This patch is to update SecPei library instance for X64 arch.
Reviewed-by: Liming Gao <liming.gao@intel.com>
Thanks
Liming
> -----Original Message-----
> From: Laszlo Ersek <lersek@redhat.com>
> Sent: Friday, May 8, 2020 7:29 PM
> To: Justen, Jordan L <jordan.l.justen@intel.com>; Gao, Liming <liming.gao@intel.com>; Dong, Eric <eric.dong@intel.com>; Ni, Ray
> <ray.ni@intel.com>
> Cc: Tom Lendacky <thomas.lendacky@amd.com>; devel@edk2.groups.io; Ard Biesheuvel <ard.biesheuvel@linaro.org>; Anthony
> Perard <anthony.perard@citrix.com>; Julien Grall <julien@xen.org>; Brijesh Singh <brijesh.singh@amd.com>; Andrew Fish
> <afish@apple.com>; Chiu, Chasel <chasel.chiu@intel.com>; Steele, Kelly <kelly.steele@intel.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Qian, Yi <yi.qian@intel.com>; Sun, Zailiang
> <zailiang.sun@intel.com>
> Subject: Re: [PATCH v3 0/3] XCODE5 toolchain binary patching fix
>
> Eric, Ray, Liming -- do you have comments please?
>
> I'm ready to push the series (it has two UefiCpuPkg patches and one
> OvmfPkg patch).
>
> Please consider specifically whether we should push the last patch at
> once. The last patch would prevent the following "edk2-platforms" DSC
> files from building with XCODE5:
>
> Platform/Intel/MinPlatformPkg/Include/Dsc/CorePeiLib.dsc
> Platform/Intel/QuarkPlatformPkg/Quark.dsc
> Platform/Intel/QuarkPlatformPkg/QuarkMin.dsc
> Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
>
> That could be prevented if Tom sent patches for them like the middle
> (OvmfPkg) patch in this series. But we don't know if those platforms
> above are ever built with XCODE5.
>
> Adding their maintainers to the CC list as well.
>
> Thanks,
> Laszlo
>
> On 05/07/20 15:06, Tom Lendacky wrote:
> >
> > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2340
> >
> > Commit 2db0ccc2d7fe ("UefiCpuPkg: Update CpuExceptionHandlerLib pass
> > XCODE5 tool chain") introduced binary patching in the
> > ExceptionHandlerAsm.nasm in order to support the XCODE5 toolchain.
> > However, the CpuExceptionHandlerLib can be used during SEC phase which
> > would result in binary patching of flash.
> >
> > This series creates a new CpuExceptionHandlerLib file to support
> > the required binary patching for the XCODE5 toolchain, while reverting
> > the changes from commit 2db0ccc2d7fe in the standard file. As the Pei,
> > Dxe and SMM versions of the library operate in memory (as opposed to
> > flash), only the SEC/PEI version is of the library is updated to use the
> > version of the ExceptionHandlerAsm.nasm that does not perform binary
> > patching.
> >
> > This is accomplished in phases:
> > - Create a new XCODE5 specific version of the ExceptionHandlerAsm.nasm
> > file and update all CpuExceptionHandler INF files to use it while also
> > creating a new SEC/PEI CpuExceptionHandler INF file specifically for
> > the XCODE5 toolchain.
> > - Update all package DSC files that use the SecPeiCpuExceptionHandlerLib
> > version of the library to use the XCODE5 version of the library,
> > Xcode5SecPeiCpuExceptionHandlerLib, when the XCODE5 toolchain is used.
> > - Revert the changes made by commit 2db0ccc2d7fe in the standard file
> > and update the SecPeiCpuExceptionHandlerLib.inf file to use the
> > standard file.
> >
> > I don't have access to an XCODE5 toolchain setup, so I have not tested
> > this with XCODE5. I would like to request that someone who does please
> > test this.
> >
> > ---
> >
> > These patches are based on commit:
> > faef5a367c83 ("ShellPkg: acpiview: Check if SBBR mandatory ACPI tables are installed")
> >
> > Cc: Andrew Fish <afish@apple.com>
> > Cc: Anthony Perard <anthony.perard@citrix.com>
> > Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > Cc: Brijesh Singh <brijesh.singh@amd.com>
> > Cc: Eric Dong <eric.dong@intel.com>
> > Cc: Jordan Justen <jordan.l.justen@intel.com>
> > Cc: Julien Grall <julien@xen.org>
> > Cc: Laszlo Ersek <lersek@redhat.com>
> > Cc: Liming Gao <liming.gao@intel.com>
> > Cc: Ray Ni <ray.ni@intel.com>
> >
> > Changes since v2:
> > - Updated [Components] section of UefiCpuPkg.dsc to conditionally exclude
> > SecPeiCpuExceptionHandlerLib.inf for the XCODE5 toolchain.
> > - Added some missed Reviewed-by: and Acked-by: tags from previous
> > versions.
> >
> > Changes since v1:
> > - Only apply the revert to the Sec/Pei CpuExceptionHandler library and
> > leave the Pei, Dxe and Smm versions using the binary patching version.
> > - Generate a unique file GUID for the new library INF file and create
> > a corresponding UNI file.
> > - Remove any references to SEV-ES (original patches accidentally submitted
> > from wrong tree).
> >
> > Tom Lendacky (3):
> > UefiCpuPkg/CpuExceptionHandler: Make XCODE5 changes toolchain specific
> > OvmfPkg: Use toolchain appropriate CpuExceptionHandlerLib
> > UefiCpuPkg/CpuExceptionHandler: Revert CpuExceptionHandler binary
> > patching
> >
> > OvmfPkg/OvmfPkgIa32.dsc | 4 +++
> > OvmfPkg/OvmfPkgIa32X64.dsc | 4 +++
> > OvmfPkg/OvmfPkgX64.dsc | 4 +++
> > OvmfPkg/OvmfXen.dsc | 4 +++
> > UefiCpuPkg/UefiCpuPkg.dsc | 7 ++++++
> > .../DxeCpuExceptionHandlerLib.inf | 2 +-
> > .../PeiCpuExceptionHandlerLib.inf | 2 +-
> > .../SmmCpuExceptionHandlerLib.inf | 2 +-
> > ...=> Xcode5SecPeiCpuExceptionHandlerLib.inf} | 13 +++++++---
> > .../X64/ExceptionHandlerAsm.nasm | 25 +++++--------------
> > ...sm.nasm => Xcode5ExceptionHandlerAsm.nasm} | 0
> > .../Xcode5SecPeiCpuExceptionHandlerLib.uni | 18 +++++++++++++
> > 12 files changed, 59 insertions(+), 26 deletions(-)
> > copy UefiCpuPkg/Library/CpuExceptionHandlerLib/{SecPeiCpuExceptionHandlerLib.inf => Xcode5SecPeiCpuExceptionHandlerLib.inf}
> (64%)
> > copy UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/{ExceptionHandlerAsm.nasm => Xcode5ExceptionHandlerAsm.nasm} (100%)
> > create mode 100644 UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.uni
> >
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [edk2-devel] [PATCH v3 0/3] XCODE5 toolchain binary patching fix
2020-05-07 13:06 [PATCH v3 0/3] XCODE5 toolchain binary patching fix Lendacky, Thomas
` (3 preceding siblings ...)
2020-05-08 11:28 ` [PATCH v3 0/3] XCODE5 toolchain binary patching fix Laszlo Ersek
@ 2020-05-09 2:17 ` Dong, Eric
2020-05-11 20:06 ` Laszlo Ersek
5 siblings, 0 replies; 8+ messages in thread
From: Dong, Eric @ 2020-05-09 2:17 UTC (permalink / raw)
To: devel@edk2.groups.io, thomas.lendacky@amd.com
Cc: Justen, Jordan L, Laszlo Ersek, Ard Biesheuvel, Gao, Liming,
Ni, Ray, Anthony Perard, Julien Grall, Brijesh Singh, Andrew Fish
For this patch series: Reviewed-by: Eric Dong <eric.dong@intel.com>
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
> Lendacky, Thomas
> Sent: Thursday, May 7, 2020 9:07 PM
> To: devel@edk2.groups.io
> Cc: Justen, Jordan L <jordan.l.justen@intel.com>; Laszlo Ersek
> <lersek@redhat.com>; Ard Biesheuvel <ard.biesheuvel@linaro.org>; Gao,
> Liming <liming.gao@intel.com>; Dong, Eric <eric.dong@intel.com>; Ni, Ray
> <ray.ni@intel.com>; Anthony Perard <anthony.perard@citrix.com>; Julien
> Grall <julien@xen.org>; Brijesh Singh <brijesh.singh@amd.com>; Andrew
> Fish <afish@apple.com>
> Subject: [edk2-devel] [PATCH v3 0/3] XCODE5 toolchain binary patching fix
>
>
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2340
>
> Commit 2db0ccc2d7fe ("UefiCpuPkg: Update CpuExceptionHandlerLib pass
> XCODE5 tool chain") introduced binary patching in the
> ExceptionHandlerAsm.nasm in order to support the XCODE5 toolchain.
> However, the CpuExceptionHandlerLib can be used during SEC phase which
> would result in binary patching of flash.
>
> This series creates a new CpuExceptionHandlerLib file to support the
> required binary patching for the XCODE5 toolchain, while reverting the
> changes from commit 2db0ccc2d7fe in the standard file. As the Pei, Dxe and
> SMM versions of the library operate in memory (as opposed to flash), only
> the SEC/PEI version is of the library is updated to use the version of the
> ExceptionHandlerAsm.nasm that does not perform binary patching.
>
> This is accomplished in phases:
> - Create a new XCODE5 specific version of the ExceptionHandlerAsm.nasm
> file and update all CpuExceptionHandler INF files to use it while also
> creating a new SEC/PEI CpuExceptionHandler INF file specifically for
> the XCODE5 toolchain.
> - Update all package DSC files that use the SecPeiCpuExceptionHandlerLib
> version of the library to use the XCODE5 version of the library,
> Xcode5SecPeiCpuExceptionHandlerLib, when the XCODE5 toolchain is used.
> - Revert the changes made by commit 2db0ccc2d7fe in the standard file
> and update the SecPeiCpuExceptionHandlerLib.inf file to use the
> standard file.
>
> I don't have access to an XCODE5 toolchain setup, so I have not tested this
> with XCODE5. I would like to request that someone who does please test this.
>
> ---
>
> These patches are based on commit:
> faef5a367c83 ("ShellPkg: acpiview: Check if SBBR mandatory ACPI tables are
> installed")
>
> Cc: Andrew Fish <afish@apple.com>
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Brijesh Singh <brijesh.singh@amd.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien@xen.org>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
>
> Changes since v2:
> - Updated [Components] section of UefiCpuPkg.dsc to conditionally exclude
> SecPeiCpuExceptionHandlerLib.inf for the XCODE5 toolchain.
> - Added some missed Reviewed-by: and Acked-by: tags from previous
> versions.
>
> Changes since v1:
> - Only apply the revert to the Sec/Pei CpuExceptionHandler library and
> leave the Pei, Dxe and Smm versions using the binary patching version.
> - Generate a unique file GUID for the new library INF file and create
> a corresponding UNI file.
> - Remove any references to SEV-ES (original patches accidentally submitted
> from wrong tree).
>
> Tom Lendacky (3):
> UefiCpuPkg/CpuExceptionHandler: Make XCODE5 changes toolchain specific
> OvmfPkg: Use toolchain appropriate CpuExceptionHandlerLib
> UefiCpuPkg/CpuExceptionHandler: Revert CpuExceptionHandler binary
> patching
>
> OvmfPkg/OvmfPkgIa32.dsc | 4 +++
> OvmfPkg/OvmfPkgIa32X64.dsc | 4 +++
> OvmfPkg/OvmfPkgX64.dsc | 4 +++
> OvmfPkg/OvmfXen.dsc | 4 +++
> UefiCpuPkg/UefiCpuPkg.dsc | 7 ++++++
> .../DxeCpuExceptionHandlerLib.inf | 2 +-
> .../PeiCpuExceptionHandlerLib.inf | 2 +-
> .../SmmCpuExceptionHandlerLib.inf | 2 +-
> ...=> Xcode5SecPeiCpuExceptionHandlerLib.inf} | 13 +++++++---
> .../X64/ExceptionHandlerAsm.nasm | 25 +++++--------------
> ...sm.nasm => Xcode5ExceptionHandlerAsm.nasm} | 0
> .../Xcode5SecPeiCpuExceptionHandlerLib.uni | 18 +++++++++++++
> 12 files changed, 59 insertions(+), 26 deletions(-) copy
> UefiCpuPkg/Library/CpuExceptionHandlerLib/{SecPeiCpuExceptionHandlerLi
> b.inf => Xcode5SecPeiCpuExceptionHandlerLib.inf} (64%) copy
> UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/{ExceptionHandlerAsm.na
> sm => Xcode5ExceptionHandlerAsm.nasm} (100%) create mode 100644
> UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHa
> ndlerLib.uni
>
> --
> 2.17.1
>
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [edk2-devel] [PATCH v3 0/3] XCODE5 toolchain binary patching fix
2020-05-07 13:06 [PATCH v3 0/3] XCODE5 toolchain binary patching fix Lendacky, Thomas
` (4 preceding siblings ...)
2020-05-09 2:17 ` [edk2-devel] " Dong, Eric
@ 2020-05-11 20:06 ` Laszlo Ersek
5 siblings, 0 replies; 8+ messages in thread
From: Laszlo Ersek @ 2020-05-11 20:06 UTC (permalink / raw)
To: devel, thomas.lendacky
Cc: Jordan Justen, Ard Biesheuvel, Liming Gao, Eric Dong, Ray Ni,
Anthony Perard, Julien Grall, Brijesh Singh, Andrew Fish
On 05/07/20 15:06, Lendacky, Thomas wrote:
>
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2340
>
> Commit 2db0ccc2d7fe ("UefiCpuPkg: Update CpuExceptionHandlerLib pass
> XCODE5 tool chain") introduced binary patching in the
> ExceptionHandlerAsm.nasm in order to support the XCODE5 toolchain.
> However, the CpuExceptionHandlerLib can be used during SEC phase which
> would result in binary patching of flash.
>
> This series creates a new CpuExceptionHandlerLib file to support
> the required binary patching for the XCODE5 toolchain, while reverting
> the changes from commit 2db0ccc2d7fe in the standard file. As the Pei,
> Dxe and SMM versions of the library operate in memory (as opposed to
> flash), only the SEC/PEI version is of the library is updated to use the
> version of the ExceptionHandlerAsm.nasm that does not perform binary
> patching.
>
> This is accomplished in phases:
> - Create a new XCODE5 specific version of the ExceptionHandlerAsm.nasm
> file and update all CpuExceptionHandler INF files to use it while also
> creating a new SEC/PEI CpuExceptionHandler INF file specifically for
> the XCODE5 toolchain.
> - Update all package DSC files that use the SecPeiCpuExceptionHandlerLib
> version of the library to use the XCODE5 version of the library,
> Xcode5SecPeiCpuExceptionHandlerLib, when the XCODE5 toolchain is used.
> - Revert the changes made by commit 2db0ccc2d7fe in the standard file
> and update the SecPeiCpuExceptionHandlerLib.inf file to use the
> standard file.
>
> I don't have access to an XCODE5 toolchain setup, so I have not tested
> this with XCODE5. I would like to request that someone who does please
> test this.
>
> ---
>
> These patches are based on commit:
> faef5a367c83 ("ShellPkg: acpiview: Check if SBBR mandatory ACPI tables are installed")
>
> Cc: Andrew Fish <afish@apple.com>
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Brijesh Singh <brijesh.singh@amd.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien@xen.org>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
>
> Changes since v2:
> - Updated [Components] section of UefiCpuPkg.dsc to conditionally exclude
> SecPeiCpuExceptionHandlerLib.inf for the XCODE5 toolchain.
> - Added some missed Reviewed-by: and Acked-by: tags from previous
> versions.
>
> Changes since v1:
> - Only apply the revert to the Sec/Pei CpuExceptionHandler library and
> leave the Pei, Dxe and Smm versions using the binary patching version.
> - Generate a unique file GUID for the new library INF file and create
> a corresponding UNI file.
> - Remove any references to SEV-ES (original patches accidentally submitted
> from wrong tree).
>
> Tom Lendacky (3):
> UefiCpuPkg/CpuExceptionHandler: Make XCODE5 changes toolchain specific
> OvmfPkg: Use toolchain appropriate CpuExceptionHandlerLib
> UefiCpuPkg/CpuExceptionHandler: Revert CpuExceptionHandler binary
> patching
>
> OvmfPkg/OvmfPkgIa32.dsc | 4 +++
> OvmfPkg/OvmfPkgIa32X64.dsc | 4 +++
> OvmfPkg/OvmfPkgX64.dsc | 4 +++
> OvmfPkg/OvmfXen.dsc | 4 +++
> UefiCpuPkg/UefiCpuPkg.dsc | 7 ++++++
> .../DxeCpuExceptionHandlerLib.inf | 2 +-
> .../PeiCpuExceptionHandlerLib.inf | 2 +-
> .../SmmCpuExceptionHandlerLib.inf | 2 +-
> ...=> Xcode5SecPeiCpuExceptionHandlerLib.inf} | 13 +++++++---
> .../X64/ExceptionHandlerAsm.nasm | 25 +++++--------------
> ...sm.nasm => Xcode5ExceptionHandlerAsm.nasm} | 0
> .../Xcode5SecPeiCpuExceptionHandlerLib.uni | 18 +++++++++++++
> 12 files changed, 59 insertions(+), 26 deletions(-)
> copy UefiCpuPkg/Library/CpuExceptionHandlerLib/{SecPeiCpuExceptionHandlerLib.inf => Xcode5SecPeiCpuExceptionHandlerLib.inf} (64%)
> copy UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/{ExceptionHandlerAsm.nasm => Xcode5ExceptionHandlerAsm.nasm} (100%)
> create mode 100644 UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.uni
>
Merged via <https://github.com/tianocore/edk2/pull/602>; commit range
c8543b8d830d..9378310dd877.
Thanks!
Laszlo
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-05-11 20:07 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-07 13:06 [PATCH v3 0/3] XCODE5 toolchain binary patching fix Lendacky, Thomas
2020-05-07 13:06 ` [PATCH v3 1/3] UefiCpuPkg/CpuExceptionHandler: Make XCODE5 changes toolchain specific Lendacky, Thomas
2020-05-07 13:06 ` [PATCH v3 2/3] OvmfPkg: Use toolchain appropriate CpuExceptionHandlerLib Lendacky, Thomas
2020-05-07 13:06 ` [PATCH v3 3/3] UefiCpuPkg/CpuExceptionHandler: Revert CpuExceptionHandler binary patching Lendacky, Thomas
2020-05-08 11:28 ` [PATCH v3 0/3] XCODE5 toolchain binary patching fix Laszlo Ersek
2020-05-08 14:11 ` Liming Gao
2020-05-09 2:17 ` [edk2-devel] " Dong, Eric
2020-05-11 20:06 ` Laszlo Ersek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox