From a6b7bc7a87bc7690f7f5fd48cfcd79f14676896e Mon Sep 17 00:00:00 2001 From: Michael Kinney Date: Mon, 5 Dec 2016 16:53:33 -0800 Subject: [PATCH] UefiCpuPkg/PiSmmCpuDxeSmm: Always initialze PSD The following commit moved the initialization of the default PROCESSOR_SMM_DESCRIPTOR from MpService.c to SmramSaveState.c and made this initialization conditional on the value returned by the SmmCpuFeaturesGetSmiHandlerSize() library function. https://github.com/tianocore/edk2/commit/f12367a0b1de7838f1cb8e0839e168ed7b862333 This changed the behavior of the PiSmmCpuDxeSmm module. The initialization of the PROCESSOR_SMM_DESCRIPTOR is moved before the call to SmmCpuFeaturesGetSmiHandlerSize() to preserve the previous behavior. Cc: Jiewen Yao Cc: Jeff Fan Cc: Feng Tian Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Michael Kinney Reviewed-by: Jeff Fan Reviewed-by: Feng Tian --- UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c b/UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c index c37e9e8302..b4bc0ec6a5 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c @@ -687,6 +687,14 @@ InstallSmiHandler ( { PROCESSOR_SMM_DESCRIPTOR *Psd; + // + // Initialize PROCESSOR_SMM_DESCRIPTOR + // + Psd = (PROCESSOR_SMM_DESCRIPTOR *)(VOID *)(UINTN)(SmBase + SMM_PSD_OFFSET); + CopyMem (Psd, &gcPsd, sizeof (gcPsd)); + Psd->SmmGdtPtr = (UINT64)GdtBase; + Psd->SmmGdtSize = (UINT32)GdtSize; + if (SmmCpuFeaturesGetSmiHandlerSize () != 0) { // // Install SMI handler provided by library @@ -705,14 +713,6 @@ InstallSmiHandler ( return; } - // - // Initialize PROCESSOR_SMM_DESCRIPTOR - // - Psd = (PROCESSOR_SMM_DESCRIPTOR *)(VOID *)(UINTN)(SmBase + SMM_PSD_OFFSET); - CopyMem (Psd, &gcPsd, sizeof (gcPsd)); - Psd->SmmGdtPtr = (UINT64)GdtBase; - Psd->SmmGdtSize = (UINT32)GdtSize; - // // Initialize values in template before copy // -- 2.39.2