mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +02:00
StandaloneMmPkg/Core: Install Loaded Image Protocol for MM drivers
Install Loaded Image Protocol into MM handle database for each MM driver. Change EFI_MM_DRIVER_ENTRY structure definition to hold the Loaded Image Protocol data directly, instead a pointer to the protocol, to avoid allocating pool for each MM driver. Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
This commit is contained in:
parent
6dc14fb5b4
commit
a44830727a
@ -185,6 +185,31 @@ MmLoadImage (
|
||||
DriverEntry->ImageBuffer = DstBuffer;
|
||||
DriverEntry->NumberOfPage = PageCount;
|
||||
|
||||
//
|
||||
// Fill in the remaining fields of the Loaded Image Protocol instance.
|
||||
// Note: ImageBase is an SMRAM address that can not be accessed outside of SMRAM if SMRAM window is closed.
|
||||
//
|
||||
DriverEntry->LoadedImage.Revision = EFI_LOADED_IMAGE_PROTOCOL_REVISION;
|
||||
DriverEntry->LoadedImage.ParentHandle = NULL;
|
||||
DriverEntry->LoadedImage.SystemTable = NULL;
|
||||
DriverEntry->LoadedImage.DeviceHandle = NULL;
|
||||
DriverEntry->LoadedImage.FilePath = NULL;
|
||||
|
||||
DriverEntry->LoadedImage.ImageBase = (VOID *)(UINTN)DriverEntry->ImageBuffer;
|
||||
DriverEntry->LoadedImage.ImageSize = ImageContext.ImageSize;
|
||||
DriverEntry->LoadedImage.ImageCodeType = EfiRuntimeServicesCode;
|
||||
DriverEntry->LoadedImage.ImageDataType = EfiRuntimeServicesData;
|
||||
|
||||
//
|
||||
// Install Loaded Image protocol into MM handle database for the MM Driver
|
||||
//
|
||||
MmInstallProtocolInterface (
|
||||
&DriverEntry->ImageHandle,
|
||||
&gEfiLoadedImageProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
&DriverEntry->LoadedImage
|
||||
);
|
||||
|
||||
//
|
||||
// Print the load address and the PDB file name if it is available
|
||||
//
|
||||
@ -430,6 +455,13 @@ MmDispatcher (
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_INFO, "StartImage Status - %r\n", Status));
|
||||
MmFreePages (DriverEntry->ImageBuffer, DriverEntry->NumberOfPage);
|
||||
if (DriverEntry->ImageHandle != NULL) {
|
||||
MmUninstallProtocolInterface (
|
||||
DriverEntry->ImageHandle,
|
||||
&gEfiLoadedImageProtocolGuid,
|
||||
&DriverEntry->LoadedImage
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ typedef struct {
|
||||
BOOLEAN DepexProtocolError;
|
||||
|
||||
EFI_HANDLE ImageHandle;
|
||||
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
|
||||
EFI_LOADED_IMAGE_PROTOCOL LoadedImage;
|
||||
//
|
||||
// Image EntryPoint in MMRAM
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user