Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions MdeModulePkg/Core/PiSmmCore/Dispatcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -919,8 +919,6 @@ SmmDispatcher (
//
// Cache state of SmmEntryPointRegistered before calling entry point
//
// MU_CHANGE: Decouple Core private and IPL mailbox
// PreviousSmmEntryPointRegistered = gSmmCorePrivate->SmmEntryPointRegistered;
PreviousSmmEntryPointRegistered = gSmmCoreMailbox->SmmEntryPointRegistered;

//
Expand Down Expand Up @@ -974,8 +972,6 @@ SmmDispatcher (
sizeof (DriverEntry->ImageHandle)
);

// MU_CHANGE: Decouple Core private and IPL mailbox
// if (!PreviousSmmEntryPointRegistered && gSmmCorePrivate->SmmEntryPointRegistered) {
if (!PreviousSmmEntryPointRegistered && gSmmCoreMailbox->SmmEntryPointRegistered) {
//
// Return immediately if the SMM Entry Point was registered by the SMM
Expand Down
26 changes: 14 additions & 12 deletions MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,15 @@
//
// Physical pointer to private structure shared between SMM IPL and the SMM Core
//
// WARNING: The mailbox is exposed to the normal world. Its contents must be
// carefully validated before use.
//
SMM_CORE_PRIVATE_DATA *gSmmCoreMailbox;
//
// Pointer to the SMM Core's private copy of the mailbox in MMRAM. The SMM Core
// uses this copy for internal operations.
//
SMM_CORE_PRIVATE_DATA *gSmmCorePrivate;
SMM_CORE_PRIVATE_DATA *gSmmCoreMailbox; // MU_CHANGE: Decouple Core private and IPL mailbox

//
// SMM Core global variable for SMM System Table. Only accessed as a physical structure in SMRAM.
Expand Down Expand Up @@ -713,8 +720,6 @@ SmmEntryPoint (
//
// Mark the InSmm flag as TRUE, it will be used by SmmBase2 protocol
//
// MU_CHANGE Starts: Decouple Core private and IPL mailbox
// gSmmCorePrivate->InSmm = TRUE;
gSmmCoreMailbox->InSmm = TRUE;

if (gSmmCorePrivate == NULL) {
Expand All @@ -738,7 +743,7 @@ SmmEntryPoint (
IsOverlapped = InternalIsBufferOverlapped (
(UINT8 *)CommunicationBuffer,
BufferSize,
(UINT8 *)gSmmCoreMailbox, // MU_CHANGE Starts: Decouple Core private and IPL mailbox
(UINT8 *)gSmmCoreMailbox,
sizeof (*gSmmCoreMailbox)
);
//
Expand Down Expand Up @@ -816,17 +821,14 @@ SmmEntryPoint (
// If a legacy boot has occurred, then make sure gSmmCorePrivate is not accessed
//
if (!InLegacyBoot) {
// MU_CHANGE Starts: Decouple Core private and IPL mailbox
if (gSmmCorePrivate != NULL) {
CopyMem (gSmmCoreMailbox, gSmmCorePrivate, sizeof (*gSmmCoreMailbox));
}

//
// Clear the InSmm flag as we are going to leave SMM
//
// gSmmCorePrivate->InSmm = FALSE;
gSmmCoreMailbox->InSmm = FALSE;
// MU_CHANGE Ends
}

PERF_FUNCTION_END ();
Expand Down Expand Up @@ -942,12 +944,12 @@ SmmMain (
//
// Get SMM Core Private context passed in from SMM IPL in ImageHandle.
//
// MU_CHANGE Starts: Decouple Core private and IPL mailbox
// gSmmCorePrivate = (SMM_CORE_PRIVATE_DATA *)ImageHandle;
gSmmCoreMailbox = (SMM_CORE_PRIVATE_DATA *)ImageHandle;
gSmmCorePrivate = AllocateCopyPool (sizeof (*gSmmCoreMailbox), gSmmCoreMailbox);
ASSERT (gSmmCorePrivate != NULL);
// MU_CHANGE Ends
if (gSmmCorePrivate == NULL) {
return EFI_OUT_OF_RESOURCES;
}

//
// Fill in SMRAM physical address for the SMM Services Table and the SMM Entry Point.
Expand Down Expand Up @@ -1007,8 +1009,8 @@ SmmMain (

SmmCoreInitializeSmiHandlerProfile ();

// MU_CHANGE: Decouple Core private and IPL mailbox
CopyMem (gSmmCoreMailbox, gSmmCorePrivate, sizeof (*gSmmCoreMailbox));
gSmmCoreMailbox->Smst = gSmmCorePrivate->Smst;
gSmmCoreMailbox->SmmEntryPoint = gSmmCorePrivate->SmmEntryPoint;

return EFI_SUCCESS;
}
2 changes: 1 addition & 1 deletion MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ typedef struct {
// SMM Core Global Variables
//
extern SMM_CORE_PRIVATE_DATA *gSmmCorePrivate;
extern SMM_CORE_PRIVATE_DATA *gSmmCoreMailbox; // MU_CHANGE: Decouple Core private and IPL mailbox
extern SMM_CORE_PRIVATE_DATA *gSmmCoreMailbox;
extern EFI_SMM_SYSTEM_TABLE2 gSmmCoreSmst;
extern LIST_ENTRY gHandleList;
extern EFI_PHYSICAL_ADDRESS gLoadModuleAtFixAddressSmramBase;
Expand Down
Loading