X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=IntelFrameworkPkg%2FLibrary%2FDxeSmmDriverEntryPoint%2FDriverEntryPoint.c;h=d1491655fe629a7a63806653ea71b49657c22b97;hp=f77bce1610046409509f0760c5eb7895ecfdd1b9;hb=d0def00d33fa5d4a70c427dfc9a36d826b42967d;hpb=a6d5e5f7f31202966f48cd6f32a98f02c9eabbc3 diff --git a/IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DriverEntryPoint.c b/IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DriverEntryPoint.c index f77bce1610..d1491655fe 100644 --- a/IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DriverEntryPoint.c +++ b/IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DriverEntryPoint.c @@ -3,8 +3,8 @@ EfiMain() is common driver entry point for all SMM driver who uses DxeSmmDriverEntryPoint library class. -Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php @@ -136,9 +136,9 @@ _DriverUnloadHandler ( { // // Call the unload handlers for all the modules. - // - // Note: All libraries were constructed in SMM space, - // therefore we can not destruct them in Unload + // + // Note: All libraries were constructed in SMM space, + // therefore we can not destruct them in Unload // handler. // return ProcessModuleUnloadList (ImageHandle); @@ -174,16 +174,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 // @@ -204,7 +194,16 @@ _ModuleEntryPoint ( // if (!InSmm) { // - // Retrieve the Device Path Protocol from the DeviceHandle tha this driver was loaded from + // 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 ( LoadedImage->DeviceHandle, @@ -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; } @@ -232,19 +244,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 //