Re: [PATCH v3 0/3] XCODE5 toolchain binary patching fix

Dong, Eric

For this patch series: Reviewed-by: Eric Dong <eric.dong@...>

-----Original Message-----
From: <> On Behalf Of
Lendacky, Thomas
Sent: Thursday, May 7, 2020 9:07 PM
Cc: Justen, Jordan L <jordan.l.justen@...>; Laszlo Ersek
<lersek@...>; Ard Biesheuvel <ard.biesheuvel@...>; Gao,
Liming <liming.gao@...>; Dong, Eric <eric.dong@...>; Ni, Ray
<>; Anthony Perard <anthony.perard@...>; Julien
Grall <julien@...>; Brijesh Singh <brijesh.singh@...>; Andrew
Fish <afish@...>
Subject: [edk2-devel] [PATCH v3 0/3] XCODE5 toolchain binary patching fix


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

Cc: Andrew Fish <afish@...>
Cc: Anthony Perard <anthony.perard@...>
Cc: Ard Biesheuvel <ard.biesheuvel@...>
Cc: Brijesh Singh <brijesh.singh@...>
Cc: Eric Dong <eric.dong@...>
Cc: Jordan Justen <jordan.l.justen@...>
Cc: Julien Grall <julien@...>
Cc: Laszlo Ersek <lersek@...>
Cc: Liming Gao <liming.gao@...>
Cc: Ray Ni <>

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

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

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 +++++-------------- => Xcode5ExceptionHandlerAsm.nasm} | 0
.../Xcode5SecPeiCpuExceptionHandlerLib.uni | 18 +++++++++++++
12 files changed, 59 insertions(+), 26 deletions(-) copy
b.inf => Xcode5SecPeiCpuExceptionHandlerLib.inf} (64%) copy
sm => Xcode5ExceptionHandlerAsm.nasm} (100%) create mode 100644


Join to automatically receive all group messages.