diff options
author | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-09-22 09:41:40 +0000 |
---|---|---|
committer | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-09-22 09:41:40 +0000 |
commit | 834a2e41fb7e3b3aadd0040e1b684caf01f4f4d2 (patch) | |
tree | cddb428726885af68ef3890f5f5742bd795a0ecc /IntelFrameworkPkg/Library | |
parent | 7f1eba7b999276b5915e1af407c538e4745dc026 (diff) | |
download | edk2-platforms-834a2e41fb7e3b3aadd0040e1b684caf01f4f4d2.tar.xz |
Replace mBS with gBS from UefiBootServicesTablePointer Lib to avoid library instance to cache too many copies of Boot Service Pointer.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5943 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'IntelFrameworkPkg/Library')
-rw-r--r-- | IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DriverEntryPoint.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DriverEntryPoint.c b/IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DriverEntryPoint.c index 539adc1345..38873a0bf9 100644 --- a/IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DriverEntryPoint.c +++ b/IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DriverEntryPoint.c @@ -26,8 +26,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include <Library/DebugLib.h>
-EFI_BOOT_SERVICES *mBS;
-
/**
This function returns the size, in bytes,
of the device path data structure specified by DevicePath.
@@ -103,15 +101,19 @@ SmmAppendDevicePath ( Size2 = SmmGetDevicePathSize (SecondDevicePath);
Size = Size1 + Size2 - sizeof (EFI_DEVICE_PATH_PROTOCOL);
- Status = mBS->AllocatePool (EfiBootServicesData, Size, (VOID **) &NewDevicePath);
+ Status = gBS->AllocatePool (EfiBootServicesData, Size, (VOID **) &NewDevicePath);
if (EFI_SUCCESS == Status) {
- mBS->CopyMem ((VOID *) NewDevicePath, (VOID *) FirstDevicePath, Size1);
+ //
+ // CopyMem in gBS is used as this service should always be ready. We didn't choose
+ // to use a BaseMemoryLib function as such library instance may have constructor.
+ //
+ gBS->CopyMem ((VOID *) NewDevicePath, (VOID *) FirstDevicePath, Size1);
//
// Over write Src1 EndNode and do the copy
//
DevicePath2 = (EFI_DEVICE_PATH_PROTOCOL *) ((CHAR8 *) NewDevicePath + (Size1 - sizeof (EFI_DEVICE_PATH_PROTOCOL)));
- mBS->CopyMem ((VOID *) DevicePath2, (VOID *) SecondDevicePath, Size2);
+ gBS->CopyMem ((VOID *) DevicePath2, (VOID *) SecondDevicePath, Size2);
}
return NewDevicePath;
@@ -171,12 +173,12 @@ _ModuleEntryPoint ( //
// Cache a pointer to the Boot Services Table
//
- mBS = SystemTable->BootServices;
+ gBS = SystemTable->BootServices;
//
// Retrieve the Loaded Image Protocol
//
- Status = mBS->HandleProtocol (
+ Status = gBS->HandleProtocol (
ImageHandle,
&gEfiLoadedImageProtocolGuid,
(VOID*)&LoadedImage
@@ -186,7 +188,7 @@ _ModuleEntryPoint ( //
// Retrieve SMM Base Protocol
//
- Status = mBS->LocateProtocol (
+ Status = gBS->LocateProtocol (
&gEfiSmmBaseProtocolGuid,
NULL,
(VOID **) &SmmBase
@@ -205,7 +207,7 @@ _ModuleEntryPoint ( //
// Retrieve the Device Path Protocol from the DeviceHandle tha this driver was loaded from
//
- Status = mBS->HandleProtocol (
+ Status = gBS->HandleProtocol (
LoadedImage->DeviceHandle,
&gEfiDevicePathProtocolGuid,
(VOID*)&ImageDevicePath
@@ -235,7 +237,7 @@ _ModuleEntryPoint ( // Optionally install the unload handler
//
if (_gDriverUnloadImageCount > 0) {
- Status = mBS->HandleProtocol (
+ Status = gBS->HandleProtocol (
ImageHandle,
&gEfiLoadedImageProtocolGuid,
(VOID **)&LoadedImage
|