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 //