summaryrefslogtreecommitdiff
path: root/IntelFrameworkPkg
diff options
context:
space:
mode:
Diffstat (limited to 'IntelFrameworkPkg')
-rw-r--r--IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DriverEntryPoint.c47
1 files changed, 23 insertions, 24 deletions
diff --git a/IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DriverEntryPoint.c b/IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DriverEntryPoint.c
index ed3d2c667a..afa09e75a6 100644
--- a/IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DriverEntryPoint.c
+++ b/IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DriverEntryPoint.c
@@ -175,16 +175,6 @@ _ModuleEntryPoint (
gBS = SystemTable->BootServices;
//
- // Retrieve the Loaded Image Protocol
- //
- Status = gBS->HandleProtocol (
- ImageHandle,
- &gEfiLoadedImageProtocolGuid,
- (VOID*)&LoadedImage
- );
- ASSERT_EFI_ERROR (Status);
-
- //
// Retrieve SMM Base Protocol
//
Status = gBS->LocateProtocol (
@@ -204,6 +194,15 @@ _ModuleEntryPoint (
//
if (!InSmm) {
//
+ // Retrieve the Loaded Image Protocol
+ //
+ Status = gBS->HandleProtocol (
+ ImageHandle,
+ &gEfiLoadedImageProtocolGuid,
+ (VOID*)&LoadedImage
+ );
+ ASSERT_EFI_ERROR (Status);
+ //
// Retrieve the Device Path Protocol from the DeviceHandle from which this driver was loaded
//
Status = gBS->HandleProtocol (
@@ -222,8 +221,21 @@ _ModuleEntryPoint (
// Load the image in memory to SMRAM; it will automatically generate the
// SMI.
//
- Status = SmmBase->Register (SmmBase, CompleteFilePath, NULL, 0, &Handle, FALSE);
+ Status = SmmBase->Register (SmmBase, CompleteFilePath, LoadedImage->ImageBase, 0, &Handle, FALSE);
ASSERT_EFI_ERROR (Status);
+ //
+ // Optionally install the unload handler
+ //
+ if (_gDriverUnloadImageCount > 0) {
+ Status = gBS->HandleProtocol (
+ ImageHandle,
+ &gEfiLoadedImageProtocolGuid,
+ (VOID **)&LoadedImage
+ );
+ ASSERT_EFI_ERROR (Status);
+ LoadedImage->Unload = _DriverUnloadHandler;
+ }
+
return Status;
}
@@ -233,19 +245,6 @@ _ModuleEntryPoint (
ProcessLibraryConstructorList (ImageHandle, SystemTable);
//
- // Optionally install the unload handler
- //
- if (_gDriverUnloadImageCount > 0) {
- Status = gBS->HandleProtocol (
- ImageHandle,
- &gEfiLoadedImageProtocolGuid,
- (VOID **)&LoadedImage
- );
- ASSERT_EFI_ERROR (Status);
- LoadedImage->Unload = _DriverUnloadHandler;
- }
-
- //
// Call the list of driver entry points
//
Status = ProcessModuleEntryPointList (ImageHandle, SystemTable);