mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-31 01:24:12 +02:00
MdeModulePkg/Dxe/Core: Expose services tables early
The current image DxeCore re-uses the generic UEFI implementations of DxeServicesTableLib, UefiBootServicesTableLib, and UefiRuntimeServicesTableLib. As such, the respective pointers are not available till the library constructors have been called. Use the DxeCore library instances for the services tables for them to be available earlier. This for example allows the usage of DXE memory protection services by externally linked modules before reaching library construction stage. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Vitaly Cheptsov <vit9696@protonmail.com> Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
This commit is contained in:
parent
25204d87a7
commit
91f8b375ca
@ -374,6 +374,8 @@
|
||||
<LibraryClasses>
|
||||
NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
|
||||
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
|
||||
UefiBootServicesTableLib|MdeModulePkg/Library/DxeCoreUefiBootServicesTableLib/DxeCoreUefiBootServicesTableLib.inf
|
||||
UefiRuntimeServicesTableLib|MdeModulePkg/Library/DxeCoreUefiRuntimeServicesTableLib/DxeCoreUefiRuntimeServicesTableLib.inf
|
||||
}
|
||||
MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {
|
||||
<LibraryClasses>
|
||||
|
@ -453,7 +453,7 @@ CoreDispatcher (
|
||||
DEBUG ((DEBUG_INFO, "Loading driver %g\n", &DriverEntry->FileName));
|
||||
Status = CoreLoadImage (
|
||||
FALSE,
|
||||
gDxeCoreImageHandle,
|
||||
gImageHandle,
|
||||
DriverEntry->FvFileDevicePath,
|
||||
NULL,
|
||||
0,
|
||||
|
@ -231,14 +231,14 @@ typedef struct {
|
||||
//
|
||||
// DXE Core Global Variables
|
||||
//
|
||||
extern EFI_SYSTEM_TABLE *gDxeCoreST;
|
||||
extern EFI_RUNTIME_SERVICES *gDxeCoreRT;
|
||||
extern EFI_DXE_SERVICES *gDxeCoreDS;
|
||||
extern EFI_HANDLE gDxeCoreImageHandle;
|
||||
extern EFI_SYSTEM_TABLE *gST;
|
||||
extern EFI_RUNTIME_SERVICES *gRT;
|
||||
extern EFI_DXE_SERVICES *gDS;
|
||||
extern EFI_HANDLE gImageHandle;
|
||||
|
||||
extern BOOLEAN gMemoryMapTerminated;
|
||||
extern BOOLEAN gMemoryMapTerminated;
|
||||
|
||||
extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress;
|
||||
extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress;
|
||||
|
||||
extern EFI_RUNTIME_ARCH_PROTOCOL *gRuntime;
|
||||
extern EFI_CPU_ARCH_PROTOCOL *gCpu;
|
||||
@ -250,15 +250,15 @@ extern EFI_SECURITY2_ARCH_PROTOCOL *gSecurity2;
|
||||
extern EFI_BDS_ARCH_PROTOCOL *gBds;
|
||||
extern EFI_SMM_BASE2_PROTOCOL *gSmmBase2;
|
||||
|
||||
extern EFI_TPL gEfiCurrentTpl;
|
||||
extern EFI_TPL gEfiCurrentTpl;
|
||||
|
||||
extern EFI_GUID *gDxeCoreFileName;
|
||||
extern EFI_LOADED_IMAGE_PROTOCOL *gDxeCoreLoadedImage;
|
||||
extern EFI_GUID *gDxeCoreFileName;
|
||||
extern EFI_LOADED_IMAGE_PROTOCOL *gDxeCoreLoadedImage;
|
||||
|
||||
extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation[EfiMaxMemoryType + 1];
|
||||
extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation[EfiMaxMemoryType + 1];
|
||||
|
||||
extern BOOLEAN gDispatcherRunning;
|
||||
extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate;
|
||||
extern BOOLEAN gDispatcherRunning;
|
||||
extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate;
|
||||
|
||||
extern EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE gLoadModuleAtFixAddressConfigurationTable;
|
||||
extern BOOLEAN gLoadFixedAddressCodeMemoryReady;
|
||||
|
@ -120,28 +120,6 @@ EFI_DXE_SERVICES mDxeServices = {
|
||||
(EFI_SET_MEMORY_SPACE_CAPABILITIES)CoreSetMemorySpaceCapabilities, // SetMemorySpaceCapabilities
|
||||
};
|
||||
|
||||
EFI_SYSTEM_TABLE mEfiSystemTableTemplate = {
|
||||
{
|
||||
EFI_SYSTEM_TABLE_SIGNATURE, // Signature
|
||||
EFI_SYSTEM_TABLE_REVISION, // Revision
|
||||
sizeof (EFI_SYSTEM_TABLE), // HeaderSize
|
||||
0, // CRC32
|
||||
0 // Reserved
|
||||
},
|
||||
NULL, // FirmwareVendor
|
||||
0, // FirmwareRevision
|
||||
NULL, // ConsoleInHandle
|
||||
NULL, // ConIn
|
||||
NULL, // ConsoleOutHandle
|
||||
NULL, // ConOut
|
||||
NULL, // StandardErrorHandle
|
||||
NULL, // StdErr
|
||||
NULL, // RuntimeServices
|
||||
&mBootServices, // BootServices
|
||||
0, // NumberOfConfigurationTableEntries
|
||||
NULL // ConfigurationTable
|
||||
};
|
||||
|
||||
EFI_RUNTIME_SERVICES mEfiRuntimeServicesTableTemplate = {
|
||||
{
|
||||
EFI_RUNTIME_SERVICES_SIGNATURE, // Signature
|
||||
@ -166,6 +144,28 @@ EFI_RUNTIME_SERVICES mEfiRuntimeServicesTableTemplate = {
|
||||
(EFI_QUERY_VARIABLE_INFO)CoreEfiNotAvailableYetArg4 // QueryVariableInfo
|
||||
};
|
||||
|
||||
EFI_SYSTEM_TABLE mEfiSystemTableTemplate = {
|
||||
{
|
||||
EFI_SYSTEM_TABLE_SIGNATURE, // Signature
|
||||
EFI_SYSTEM_TABLE_REVISION, // Revision
|
||||
sizeof (EFI_SYSTEM_TABLE), // HeaderSize
|
||||
0, // CRC32
|
||||
0 // Reserved
|
||||
},
|
||||
NULL, // FirmwareVendor
|
||||
0, // FirmwareRevision
|
||||
NULL, // ConsoleInHandle
|
||||
NULL, // ConIn
|
||||
NULL, // ConsoleOutHandle
|
||||
NULL, // ConOut
|
||||
NULL, // StandardErrorHandle
|
||||
NULL, // StdErr
|
||||
&mEfiRuntimeServicesTableTemplate, // RuntimeServices
|
||||
&mBootServices, // BootServices
|
||||
0, // NumberOfConfigurationTableEntries
|
||||
NULL // ConfigurationTable
|
||||
};
|
||||
|
||||
EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate = {
|
||||
INITIALIZE_LIST_HEAD_VARIABLE (gRuntimeTemplate.ImageHead),
|
||||
INITIALIZE_LIST_HEAD_VARIABLE (gRuntimeTemplate.EventHead),
|
||||
@ -190,18 +190,19 @@ EFI_RUNTIME_ARCH_PROTOCOL *gRuntime = &gRuntimeTemplate;
|
||||
// DXE Core Global Variables for the EFI System Table, Boot Services Table,
|
||||
// DXE Services Table, and Runtime Services Table
|
||||
//
|
||||
EFI_DXE_SERVICES *gDxeCoreDS = &mDxeServices;
|
||||
EFI_SYSTEM_TABLE *gDxeCoreST = NULL;
|
||||
EFI_DXE_SERVICES *gDS = &mDxeServices;
|
||||
EFI_BOOT_SERVICES *gBS = &mBootServices;
|
||||
EFI_SYSTEM_TABLE *gST = &mEfiSystemTableTemplate;
|
||||
|
||||
//
|
||||
// For debug initialize gDxeCoreRT to template. gDxeCoreRT must be allocated from RT memory
|
||||
// but gDxeCoreRT is used for ASSERT () and DEBUG () type macros so lets give it
|
||||
// For debug initialize gRT to template. gRT must be allocated from RT memory
|
||||
// but gRT is used for ASSERT () and DEBUG () type macros so lets give it
|
||||
// a value that will not cause debug infrastructure to crash early on.
|
||||
//
|
||||
EFI_RUNTIME_SERVICES *gDxeCoreRT = &mEfiRuntimeServicesTableTemplate;
|
||||
EFI_HANDLE gDxeCoreImageHandle = NULL;
|
||||
EFI_RUNTIME_SERVICES *gRT = &mEfiRuntimeServicesTableTemplate;
|
||||
EFI_HANDLE gImageHandle = NULL;
|
||||
|
||||
BOOLEAN gMemoryMapTerminated = FALSE;
|
||||
BOOLEAN gMemoryMapTerminated = FALSE;
|
||||
|
||||
//
|
||||
// EFI Decompress Protocol
|
||||
@ -277,13 +278,13 @@ DxeMain (
|
||||
// Allocate the EFI System Table and EFI Runtime Service Table from EfiRuntimeServicesData
|
||||
// Use the templates to initialize the contents of the EFI System Table and EFI Runtime Services Table
|
||||
//
|
||||
gDxeCoreST = AllocateRuntimeCopyPool (sizeof (EFI_SYSTEM_TABLE), &mEfiSystemTableTemplate);
|
||||
ASSERT (gDxeCoreST != NULL);
|
||||
gST = AllocateRuntimeCopyPool (sizeof (EFI_SYSTEM_TABLE), &mEfiSystemTableTemplate);
|
||||
ASSERT (gST != NULL);
|
||||
|
||||
gDxeCoreRT = AllocateRuntimeCopyPool (sizeof (EFI_RUNTIME_SERVICES), &mEfiRuntimeServicesTableTemplate);
|
||||
ASSERT (gDxeCoreRT != NULL);
|
||||
gRT = AllocateRuntimeCopyPool (sizeof (EFI_RUNTIME_SERVICES), &mEfiRuntimeServicesTableTemplate);
|
||||
ASSERT (gRT != NULL);
|
||||
|
||||
gDxeCoreST->RuntimeServices = gDxeCoreRT;
|
||||
gST->RuntimeServices = gRT;
|
||||
|
||||
//
|
||||
// Start the Image Services.
|
||||
@ -302,7 +303,7 @@ DxeMain (
|
||||
//
|
||||
// Call constructor for all libraries
|
||||
//
|
||||
ProcessLibraryConstructorList (gDxeCoreImageHandle, gDxeCoreST);
|
||||
ProcessLibraryConstructorList (gImageHandle, gST);
|
||||
PERF_CROSSMODULE_END ("PEI");
|
||||
PERF_CROSSMODULE_BEGIN ("DXE");
|
||||
|
||||
@ -328,7 +329,7 @@ DxeMain (
|
||||
//
|
||||
// Install the DXE Services Table into the EFI System Tables's Configuration Table
|
||||
//
|
||||
Status = CoreInstallConfigurationTable (&gEfiDxeServicesTableGuid, gDxeCoreDS);
|
||||
Status = CoreInstallConfigurationTable (&gEfiDxeServicesTableGuid, gDS);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
@ -370,7 +371,7 @@ DxeMain (
|
||||
CoreNewDebugImageInfoEntry (
|
||||
EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL,
|
||||
gDxeCoreLoadedImage,
|
||||
gDxeCoreImageHandle,
|
||||
gImageHandle,
|
||||
&ImageContext
|
||||
);
|
||||
|
||||
@ -498,16 +499,16 @@ DxeMain (
|
||||
//
|
||||
// Produce Firmware Volume Protocols, one for each FV in the HOB list.
|
||||
//
|
||||
Status = FwVolBlockDriverInit (gDxeCoreImageHandle, gDxeCoreST);
|
||||
Status = FwVolBlockDriverInit (gImageHandle, gST);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = FwVolDriverInit (gDxeCoreImageHandle, gDxeCoreST);
|
||||
Status = FwVolDriverInit (gImageHandle, gST);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Produce the Section Extraction Protocol
|
||||
//
|
||||
Status = InitializeSectionExtraction (gDxeCoreImageHandle, gDxeCoreST);
|
||||
Status = InitializeSectionExtraction (gImageHandle, gST);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
@ -806,18 +807,18 @@ CoreExitBootServices (
|
||||
//
|
||||
// Clear the non-runtime values of the EFI System Table
|
||||
//
|
||||
gDxeCoreST->BootServices = NULL;
|
||||
gDxeCoreST->ConIn = NULL;
|
||||
gDxeCoreST->ConsoleInHandle = NULL;
|
||||
gDxeCoreST->ConOut = NULL;
|
||||
gDxeCoreST->ConsoleOutHandle = NULL;
|
||||
gDxeCoreST->StdErr = NULL;
|
||||
gDxeCoreST->StandardErrorHandle = NULL;
|
||||
gST->BootServices = NULL;
|
||||
gST->ConIn = NULL;
|
||||
gST->ConsoleInHandle = NULL;
|
||||
gST->ConOut = NULL;
|
||||
gST->ConsoleOutHandle = NULL;
|
||||
gST->StdErr = NULL;
|
||||
gST->StandardErrorHandle = NULL;
|
||||
|
||||
//
|
||||
// Recompute the 32-bit CRC of the EFI System Table
|
||||
//
|
||||
CalculateEfiHdrCrc (&gDxeCoreST->Hdr);
|
||||
CalculateEfiHdrCrc (&gST->Hdr);
|
||||
|
||||
//
|
||||
// Zero out the Boot Service Table
|
||||
|
@ -194,10 +194,10 @@ GenericProtocolNotify (
|
||||
//
|
||||
// It's over kill to do them all every time, but it saves a lot of code.
|
||||
//
|
||||
CalculateEfiHdrCrc (&gDxeCoreRT->Hdr);
|
||||
CalculateEfiHdrCrc (&gRT->Hdr);
|
||||
CalculateEfiHdrCrc (&gBS->Hdr);
|
||||
CalculateEfiHdrCrc (&gDxeCoreST->Hdr);
|
||||
CalculateEfiHdrCrc (&gDxeCoreDS->Hdr);
|
||||
CalculateEfiHdrCrc (&gST->Hdr);
|
||||
CalculateEfiHdrCrc (&gDS->Hdr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1483,7 +1483,7 @@ CoreAddMemorySpace (
|
||||
EFI_PAGE_SHIFT,
|
||||
PageLength,
|
||||
&PageBaseAddress,
|
||||
gDxeCoreImageHandle,
|
||||
gImageHandle,
|
||||
NULL
|
||||
);
|
||||
|
||||
@ -1502,7 +1502,7 @@ CoreAddMemorySpace (
|
||||
EFI_PAGE_SHIFT,
|
||||
EFI_PAGE_SIZE,
|
||||
&PageBaseAddress,
|
||||
gDxeCoreImageHandle,
|
||||
gImageHandle,
|
||||
NULL
|
||||
);
|
||||
|
||||
@ -2661,7 +2661,7 @@ CoreInitializeGcdServices (
|
||||
0,
|
||||
MemoryLength,
|
||||
&MemoryBaseAddress,
|
||||
gDxeCoreImageHandle,
|
||||
gImageHandle,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
@ -2682,7 +2682,7 @@ CoreInitializeGcdServices (
|
||||
0,
|
||||
MemoryHob->AllocDescriptor.MemoryLength,
|
||||
&BaseAddress,
|
||||
gDxeCoreImageHandle,
|
||||
gImageHandle,
|
||||
NULL
|
||||
);
|
||||
if (!EFI_ERROR (Status) &&
|
||||
@ -2708,7 +2708,7 @@ CoreInitializeGcdServices (
|
||||
0,
|
||||
FirmwareVolumeHob->Length,
|
||||
&BaseAddress,
|
||||
gDxeCoreImageHandle,
|
||||
gImageHandle,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
@ -2756,7 +2756,7 @@ CoreInitializeGcdServices (
|
||||
0,
|
||||
Length,
|
||||
&BaseAddress,
|
||||
gDxeCoreImageHandle,
|
||||
gImageHandle,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
@ -2798,7 +2798,7 @@ CoreInitializeGcdServices (
|
||||
0,
|
||||
Length,
|
||||
&BaseAddress,
|
||||
gDxeCoreImageHandle,
|
||||
gImageHandle,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
@ -928,7 +928,7 @@ CoreHandleProtocol (
|
||||
UserHandle,
|
||||
Protocol,
|
||||
Interface,
|
||||
gDxeCoreImageHandle,
|
||||
gImageHandle,
|
||||
NULL,
|
||||
EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL
|
||||
);
|
||||
|
@ -250,7 +250,7 @@ CoreInitializeImageServices (
|
||||
Image->ImageBasePage = DxeCoreImageBaseAddress;
|
||||
Image->NumberOfPages = (UINTN)(EFI_SIZE_TO_PAGES ((UINTN)(DxeCoreImageLength)));
|
||||
Image->Tpl = gEfiCurrentTpl;
|
||||
Image->Info.SystemTable = gDxeCoreST;
|
||||
Image->Info.SystemTable = gST;
|
||||
Image->Info.ImageBase = (VOID *)(UINTN)DxeCoreImageBaseAddress;
|
||||
Image->Info.ImageSize = DxeCoreImageLength;
|
||||
|
||||
@ -270,7 +270,7 @@ CoreInitializeImageServices (
|
||||
//
|
||||
// Fill in DXE globals
|
||||
//
|
||||
gDxeCoreImageHandle = Image->Handle;
|
||||
gImageHandle = Image->Handle;
|
||||
gDxeCoreLoadedImage = &Image->Info;
|
||||
|
||||
//
|
||||
@ -1272,7 +1272,7 @@ CoreLoadImageCommon (
|
||||
// Initialize the fields for an internal driver
|
||||
//
|
||||
Image->Signature = LOADED_IMAGE_PRIVATE_DATA_SIGNATURE;
|
||||
Image->Info.SystemTable = gDxeCoreST;
|
||||
Image->Info.SystemTable = gST;
|
||||
Image->Info.DeviceHandle = DeviceHandle;
|
||||
Image->Info.Revision = EFI_LOADED_IMAGE_PROTOCOL_REVISION;
|
||||
Image->Info.FilePath = DuplicateDevicePath (FilePath);
|
||||
|
@ -419,7 +419,7 @@ PromoteMemoryResource (
|
||||
}
|
||||
|
||||
Entry->Capabilities |= EFI_MEMORY_TESTED;
|
||||
Entry->ImageHandle = gDxeCoreImageHandle;
|
||||
Entry->ImageHandle = gImageHandle;
|
||||
Entry->DeviceHandle = NULL;
|
||||
|
||||
//
|
||||
|
@ -119,7 +119,7 @@ CoreInitializeDebugImageInfoTable (
|
||||
// Initialize EFI_SYSTEM_TABLE_POINTER structure
|
||||
//
|
||||
mDebugTable->Signature = EFI_SYSTEM_TABLE_SIGNATURE;
|
||||
mDebugTable->EfiSystemTableBase = (EFI_PHYSICAL_ADDRESS)(UINTN)gDxeCoreST;
|
||||
mDebugTable->EfiSystemTableBase = (EFI_PHYSICAL_ADDRESS)(UINTN)gST;
|
||||
mDebugTable->Crc32 = 0;
|
||||
|
||||
//
|
||||
|
@ -45,18 +45,18 @@ CoreInstallConfigurationTable (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
EfiConfigurationTable = gDxeCoreST->ConfigurationTable;
|
||||
EfiConfigurationTable = gST->ConfigurationTable;
|
||||
|
||||
//
|
||||
// Search all the table for an entry that matches Guid
|
||||
//
|
||||
for (Index = 0; Index < gDxeCoreST->NumberOfTableEntries; Index++) {
|
||||
if (CompareGuid (Guid, &(gDxeCoreST->ConfigurationTable[Index].VendorGuid))) {
|
||||
for (Index = 0; Index < gST->NumberOfTableEntries; Index++) {
|
||||
if (CompareGuid (Guid, &(gST->ConfigurationTable[Index].VendorGuid))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Index < gDxeCoreST->NumberOfTableEntries) {
|
||||
if (Index < gST->NumberOfTableEntries) {
|
||||
//
|
||||
// A match was found, so this is either a modify or a delete operation
|
||||
//
|
||||
@ -65,7 +65,7 @@ CoreInstallConfigurationTable (
|
||||
// If Table is not NULL, then this is a modify operation.
|
||||
// Modify the table entry and return.
|
||||
//
|
||||
gDxeCoreST->ConfigurationTable[Index].VendorTable = Table;
|
||||
gST->ConfigurationTable[Index].VendorTable = Table;
|
||||
|
||||
//
|
||||
// Signal Configuration Table change
|
||||
@ -78,15 +78,15 @@ CoreInstallConfigurationTable (
|
||||
//
|
||||
// A match was found and Table is NULL, so this is a delete operation.
|
||||
//
|
||||
gDxeCoreST->NumberOfTableEntries--;
|
||||
gST->NumberOfTableEntries--;
|
||||
|
||||
//
|
||||
// Copy over deleted entry
|
||||
//
|
||||
CopyMem (
|
||||
&(EfiConfigurationTable[Index]),
|
||||
&(gDxeCoreST->ConfigurationTable[Index + 1]),
|
||||
(gDxeCoreST->NumberOfTableEntries - Index) * sizeof (EFI_CONFIGURATION_TABLE)
|
||||
&(gST->ConfigurationTable[Index + 1]),
|
||||
(gST->NumberOfTableEntries - Index) * sizeof (EFI_CONFIGURATION_TABLE)
|
||||
);
|
||||
} else {
|
||||
//
|
||||
@ -101,7 +101,7 @@ CoreInstallConfigurationTable (
|
||||
}
|
||||
|
||||
//
|
||||
// Assume that Index == gDxeCoreST->NumberOfTableEntries
|
||||
// Assume that Index == gST->NumberOfTableEntries
|
||||
//
|
||||
if ((Index * sizeof (EFI_CONFIGURATION_TABLE)) >= mSystemTableAllocateSize) {
|
||||
//
|
||||
@ -116,30 +116,30 @@ CoreInstallConfigurationTable (
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
if (gDxeCoreST->ConfigurationTable != NULL) {
|
||||
if (gST->ConfigurationTable != NULL) {
|
||||
//
|
||||
// Copy the old table to the new table.
|
||||
//
|
||||
CopyMem (
|
||||
EfiConfigurationTable,
|
||||
gDxeCoreST->ConfigurationTable,
|
||||
gST->ConfigurationTable,
|
||||
Index * sizeof (EFI_CONFIGURATION_TABLE)
|
||||
);
|
||||
|
||||
//
|
||||
// Record the old table pointer.
|
||||
//
|
||||
OldTable = gDxeCoreST->ConfigurationTable;
|
||||
OldTable = gST->ConfigurationTable;
|
||||
|
||||
//
|
||||
// As the CoreInstallConfigurationTable() may be re-entered by CoreFreePool()
|
||||
// in its calling stack, updating System table to the new table pointer must
|
||||
// be done before calling CoreFreePool() to free the old table.
|
||||
// It can make sure the gDxeCoreST->ConfigurationTable point to the new table
|
||||
// It can make sure the gST->ConfigurationTable point to the new table
|
||||
// and avoid the errors of use-after-free to the old table by the reenter of
|
||||
// CoreInstallConfigurationTable() in CoreFreePool()'s calling stack.
|
||||
//
|
||||
gDxeCoreST->ConfigurationTable = EfiConfigurationTable;
|
||||
gST->ConfigurationTable = EfiConfigurationTable;
|
||||
|
||||
//
|
||||
// Free the old table after updating System Table to the new table pointer.
|
||||
@ -149,7 +149,7 @@ CoreInstallConfigurationTable (
|
||||
//
|
||||
// Update System Table
|
||||
//
|
||||
gDxeCoreST->ConfigurationTable = EfiConfigurationTable;
|
||||
gST->ConfigurationTable = EfiConfigurationTable;
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,13 +162,13 @@ CoreInstallConfigurationTable (
|
||||
//
|
||||
// This is an add operation, so increment the number of table entries
|
||||
//
|
||||
gDxeCoreST->NumberOfTableEntries++;
|
||||
gST->NumberOfTableEntries++;
|
||||
}
|
||||
|
||||
//
|
||||
// Fix up the CRC-32 in the EFI System Table
|
||||
//
|
||||
CalculateEfiHdrCrc (&gDxeCoreST->Hdr);
|
||||
CalculateEfiHdrCrc (&gST->Hdr);
|
||||
|
||||
//
|
||||
// Signal Configuration Table change
|
||||
|
@ -125,6 +125,9 @@
|
||||
HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf
|
||||
MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
|
||||
ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
|
||||
DxeServicesTableLib|MdeModulePkg/Library/DxeCoreDxeServicesTableLib/DxeCoreDxeServicesTableLib.inf
|
||||
UefiBootServicesTableLib|MdeModulePkg/Library/DxeCoreUefiBootServicesTableLib/DxeCoreUefiBootServicesTableLib.inf
|
||||
UefiRuntimeServicesTableLib|MdeModulePkg/Library/DxeCoreUefiRuntimeServicesTableLib/DxeCoreUefiRuntimeServicesTableLib.inf
|
||||
|
||||
[LibraryClasses.common.DXE_DRIVER]
|
||||
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
|
||||
|
@ -737,6 +737,8 @@
|
||||
<LibraryClasses>
|
||||
NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
|
||||
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
|
||||
UefiBootServicesTableLib|MdeModulePkg/Library/DxeCoreUefiBootServicesTableLib/DxeCoreUefiBootServicesTableLib.inf
|
||||
UefiRuntimeServicesTableLib|MdeModulePkg/Library/DxeCoreUefiRuntimeServicesTableLib/DxeCoreUefiRuntimeServicesTableLib.inf
|
||||
}
|
||||
|
||||
MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
|
||||
|
@ -753,6 +753,8 @@
|
||||
<LibraryClasses>
|
||||
NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
|
||||
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
|
||||
UefiBootServicesTableLib|MdeModulePkg/Library/DxeCoreUefiBootServicesTableLib/DxeCoreUefiBootServicesTableLib.inf
|
||||
UefiRuntimeServicesTableLib|MdeModulePkg/Library/DxeCoreUefiRuntimeServicesTableLib/DxeCoreUefiRuntimeServicesTableLib.inf
|
||||
}
|
||||
|
||||
MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
|
||||
|
@ -796,6 +796,8 @@
|
||||
<LibraryClasses>
|
||||
NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
|
||||
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
|
||||
UefiBootServicesTableLib|MdeModulePkg/Library/DxeCoreUefiBootServicesTableLib/DxeCoreUefiBootServicesTableLib.inf
|
||||
UefiRuntimeServicesTableLib|MdeModulePkg/Library/DxeCoreUefiRuntimeServicesTableLib/DxeCoreUefiRuntimeServicesTableLib.inf
|
||||
}
|
||||
|
||||
MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
|
||||
|
@ -616,6 +616,8 @@
|
||||
SerialPortLib|UefiPayloadPkg/Library/BaseSerialPortLibHob/BaseSerialPortLibHob.inf
|
||||
!endif
|
||||
NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
|
||||
UefiBootServicesTableLib|MdeModulePkg/Library/DxeCoreUefiBootServicesTableLib/DxeCoreUefiBootServicesTableLib.inf
|
||||
UefiRuntimeServicesTableLib|MdeModulePkg/Library/DxeCoreUefiRuntimeServicesTableLib/DxeCoreUefiRuntimeServicesTableLib.inf
|
||||
}
|
||||
|
||||
#
|
||||
|
Loading…
x
Reference in New Issue
Block a user