diff options
author | Ray Ni <ray.ni@intel.com> | 2022-05-20 19:12:35 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2022-06-10 07:54:48 +0000 |
commit | e7abb94d1fb8a0e7725b983bbf5ab1334afe7ed1 (patch) | |
tree | 71a796f7e823b8c3c0f068d5337603617eb330d5 /UefiCpuPkg/CpuMpPei | |
parent | 2a09527ebcb459b40bc3661d85aa11c3905526dc (diff) | |
download | edk2-e7abb94d1fb8a0e7725b983bbf5ab1334afe7ed1.tar.gz edk2-e7abb94d1fb8a0e7725b983bbf5ab1334afe7ed1.tar.bz2 edk2-e7abb94d1fb8a0e7725b983bbf5ab1334afe7ed1.zip |
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.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Diffstat (limited to 'UefiCpuPkg/CpuMpPei')
-rw-r--r-- | UefiCpuPkg/CpuMpPei/CpuMpPei.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/UefiCpuPkg/CpuMpPei/CpuMpPei.c b/UefiCpuPkg/CpuMpPei/CpuMpPei.c index 1e68c91d95..d4786979fa 100644 --- a/UefiCpuPkg/CpuMpPei/CpuMpPei.c +++ b/UefiCpuPkg/CpuMpPei/CpuMpPei.c @@ -432,7 +432,7 @@ GetGdtr ( /**
Initializes CPU exceptions handlers for the sake of stack switch requirement.
- This function is a wrapper of InitializeCpuExceptionHandlersEx. It's mainly
+ This function is a wrapper of InitializeSeparateExceptionStacks. It's mainly
for the sake of AP's init because of EFI_AP_PROCEDURE API requirement.
@param[in,out] Buffer The pointer to private data buffer.
@@ -456,7 +456,7 @@ InitializeExceptionStackSwitchHandlers ( AsmReadIdtr (&Idtr);
EssData->Ia32.IdtTable = (VOID *)Idtr.Base;
EssData->Ia32.IdtTableSize = Idtr.Limit + 1;
- Status = InitializeCpuExceptionHandlersEx (NULL, EssData);
+ Status = InitializeSeparateExceptionStacks (EssData);
ASSERT_EFI_ERROR (Status);
}
|