Branch: refs/heads/master Home: https://github.com/tianocore/edk2 Commit: 21a9b605b846902833f4818e1b3b37b12a245b8c https://github.com/tianocore/edk2/commit/21a9b605b846902833f4818e1b3b37b12a245b8c Author: Ray Ni <ray...@intel.com> Date: 2022-06-10 (Fri, 10 Jun 2022)
Changed paths: M UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c M UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ExceptionHandlerAsm.nasm M UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm M UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/Xcode5ExceptionHandlerAsm.nasm Log Message: ----------- CpuException: Avoid allocating code pages for DXE instance Today the DXE instance allocates code page and then copies the IDT vectors to the allocated code page. Then it fixes up the vector number in the IDT vector. But if we update the NASM file to generate 256 IDT vectors, there is no need to do the copy and fix-up. A side effect is 4096 bytes (HOOKAFTER_STUB_SIZE * 256) is used for 256 IDT vectors while 32 IDT vectors only require 512 bytes without this change, in following library instances: 1. 32bit SecPeiCpuExceptionHandlerLib and PeiCpuExceptionHandlerLib 2. 64bit PeiCpuExceptionHandlerLib But considering the code logic simplification, 3.5K extra space is not a big deal. If 3.5K is too much, we can enhance the code further to generate 32 vectors for above mentioned library instances. Signed-off-by: Ray Ni <ray...@intel.com> Reviewed-by: Jian J Wang <jian.j.w...@intel.com> Acked-by: Eric Dong <eric.d...@intel.com> Commit: 34d505123e4e7690b29a0926949a1868c49f8b44 https://github.com/tianocore/edk2/commit/34d505123e4e7690b29a0926949a1868c49f8b44 Author: Ray Ni <ray...@intel.com> Date: 2022-06-10 (Fri, 10 Jun 2022) Changed paths: M UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c M UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmException.c Log Message: ----------- CpuException: Init global variables in-place Additionally removed two useless global variables: "SPIN_LOCK mDisplayMessageSpinLock" from SMM instance. "UINTN mEnabledInterruptNum" from DXE instance. Signed-off-by: Ray Ni <ray...@intel.com> Cc: Eric Dong <eric.d...@intel.com> Commit: 2fbc5ff0a517b73aecf26ece6a040f265d878f81 https://github.com/tianocore/edk2/commit/2fbc5ff0a517b73aecf26ece6a040f265d878f81 Author: Ray Ni <ray...@intel.com> Date: 2022-06-10 (Fri, 10 Jun 2022) Changed paths: M UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c Log Message: ----------- CpuException: Avoid allocating page but using global variables Signed-off-by: Ray Ni <ray...@intel.com> Cc: Eric Dong <eric.d...@intel.com> Commit: 2a09527ebcb459b40bc3661d85aa11c3905526dc https://github.com/tianocore/edk2/commit/2a09527ebcb459b40bc3661d85aa11c3905526dc Author: Ray Ni <ray...@intel.com> Date: 2022-06-10 (Fri, 10 Jun 2022) Changed paths: M MdeModulePkg/Include/Library/CpuExceptionHandlerLib.h M MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.c M UefiCpuPkg/CpuDxe/CpuDxe.c M UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c M UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c M UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c M UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c M UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmException.c Log Message: ----------- CpuException: Remove InitializeCpuInterruptHandlers InitializeCpuExceptionHandlers() expects caller allocates IDT while InitializeCpuInterruptHandlers() allocates 256 IDT entries itself. InitializeCpuExceptionHandlers() fills max 32 IDT entries allocated by caller. If caller allocates 10 entries, the API just fills 10 IDT entries. The inconsistency between the two APIs makes code hard to unerstand and hard to share. Because there is only one caller (CpuDxe) for InitializeCpuInterruptHandler(), this patch updates CpuDxe driver to allocates 256 IDT entries then call InitializeCpuExceptionHandlers(). This is also a backward compatible change. With this change, InitializeCpuInterruptHandlers() is removed completely. And InitializeCpuExceptionHandlers() fills max 32 entries for PEI and SMM instance, max 256 entries for DXE instance. Such behavior matches to the original one. Signed-off-by: Ray Ni <ray...@intel.com> Cc: Eric Dong <eric.d...@intel.com> Commit: e7abb94d1fb8a0e7725b983bbf5ab1334afe7ed1 https://github.com/tianocore/edk2/commit/e7abb94d1fb8a0e7725b983bbf5ab1334afe7ed1 Author: Ray Ni <ray...@intel.com> Date: 2022-06-10 (Fri, 10 Jun 2022) Changed paths: M MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c M MdeModulePkg/Include/Library/CpuExceptionHandlerLib.h M MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.c M UefiCpuPkg/CpuDxe/CpuMp.c M UefiCpuPkg/CpuMpPei/CpuMpPei.c M UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c M UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c M UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c M UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmException.c Log Message: ----------- CpuException: Add InitializeSeparateExceptionStacks Today InitializeCpuExceptionHandlersEx is called from three modules: 1. DxeCore (links to DxeCpuExceptionHandlerLib) DxeCore expects it initializes the IDT entries as well as assigning separate stacks for #DF and #PF. 2. CpuMpPei (links to PeiCpuExceptionHandlerLib) and CpuDxe (links to DxeCpuExceptionHandlerLib) It's called for each thread for only assigning separate stacks for #DF and #PF. The IDT entries initialization is skipped because caller sets InitData->X64.InitDefaultHandlers to FALSE. Additionally, SecPeiCpuExceptionHandlerLib, SmmCpuExceptionHandlerLib also implement such API and the behavior of the API is simply to initialize IDT entries only. Because it mixes the IDT entries initialization and separate stacks assignment for certain exception handlers together, in order to know whether the function call only initializes IDT entries, or assigns stacks, we need to check: 1. value of InitData->X64.InitDefaultHandlers 2. library instance This patch cleans up the code to separate the stack assignment to a new API: InitializeSeparateExceptionStacks(). Only when caller calls the new API, the separate stacks are assigned. With this change, the SecPei and Smm instance can return unsupported which gives caller a very clear status. The old API InitializeCpuExceptionHandlersEx() is removed in this patch. Because no platform module is consuming the old API, the impact is none. Signed-off-by: Ray Ni <ray...@intel.com> Cc: Eric Dong <eric.d...@intel.com> Cc: Jian J Wang <jian.j.w...@intel.com> Compare: https://github.com/tianocore/edk2/compare/ff36b2550f94...e7abb94d1fb8 _______________________________________________ edk2-commits mailing list edk2-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-commits