From 0e9b156ddc20e64d0721c8232f5e5e19dc00e297 Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Wed, 20 Aug 2008 09:41:53 +0000 Subject: Remove the global variable of gDxeCoreBS and uses the gBS in UefiBootServicesTableLib for DXE Core. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5697 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/Dxe/DxeMain.h | 2 +- MdeModulePkg/Core/Dxe/DxeMain.inf | 1 + MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 9 ++++----- MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c | 2 +- MdeModulePkg/Core/Dxe/Hand/Handle.c | 2 -- MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c | 2 +- 6 files changed, 8 insertions(+), 10 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMain.h index 6622a1d95e..6e61242149 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain.h +++ b/MdeModulePkg/Core/Dxe/DxeMain.h @@ -76,6 +76,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include #include "DebugImageInfo.h" #include "Library.h" @@ -197,7 +198,6 @@ typedef struct { // DXE Core Global Variables // extern EFI_SYSTEM_TABLE *gDxeCoreST; -extern EFI_BOOT_SERVICES *gDxeCoreBS; extern EFI_RUNTIME_SERVICES *gDxeCoreRT; extern EFI_DXE_SERVICES *gDxeCoreDS; extern EFI_HANDLE gDxeCoreImageHandle; diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf b/MdeModulePkg/Core/Dxe/DxeMain.inf index c8d5f66962..5f0b95fd63 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain.inf +++ b/MdeModulePkg/Core/Dxe/DxeMain.inf @@ -87,6 +87,7 @@ PeCoffLib ExtractGuidedSectionLib MemoryAllocationLib + UefiBootServicesTableLib [Guids] gEfiEventLegacyBootGuid # ALWAYS_CONSUMED diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c index cdfeafe627..5687ba1856 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c @@ -199,7 +199,6 @@ 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_BOOT_SERVICES *gDxeCoreBS = &mBootServices; EFI_DXE_SERVICES *gDxeCoreDS = &mDxeServices; EFI_SYSTEM_TABLE *gDxeCoreST = NULL; @@ -640,11 +639,11 @@ CalculateEfiHdrCrc ( Hdr->CRC32 = 0; // - // If gDxeCoreBS->CalculateCrce32 () == CoreEfiNotAvailableYet () then + // If gBS->CalculateCrce32 () == CoreEfiNotAvailableYet () then // Crc will come back as zero if we set it to zero here // Crc = 0; - gDxeCoreBS->CalculateCrc32 ((UINT8 *)Hdr, Hdr->HeaderSize, &Crc); + gBS->CalculateCrc32 ((UINT8 *)Hdr, Hdr->HeaderSize, &Crc); Hdr->CRC32 = Crc; } @@ -744,8 +743,8 @@ CoreExitBootServices ( // // Zero out the Boot Service Table // - ZeroMem (gDxeCoreBS, sizeof (EFI_BOOT_SERVICES)); - gDxeCoreBS = NULL; + ZeroMem (gBS, sizeof (EFI_BOOT_SERVICES)); + gBS = NULL; // // Update the AtRuntime field in Runtiem AP. diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c b/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c index 7bce6185c6..89a4c50b99 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c @@ -161,7 +161,7 @@ GenericArchProtocolNotify ( // if (Found) { CalculateEfiHdrCrc (&gDxeCoreRT->Hdr); - CalculateEfiHdrCrc (&gDxeCoreBS->Hdr); + CalculateEfiHdrCrc (&gBS->Hdr); CalculateEfiHdrCrc (&gDxeCoreST->Hdr); CalculateEfiHdrCrc (&gDxeCoreDS->Hdr); } diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c b/MdeModulePkg/Core/Dxe/Hand/Handle.c index 99c265996e..d94fdde720 100644 --- a/MdeModulePkg/Core/Dxe/Hand/Handle.c +++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c @@ -370,8 +370,6 @@ CoreInstallProtocolInterfaceNotify ( Prot = NULL; Handle = NULL; - ASSERT (gDxeCoreBS != NULL); - if (*UserHandle != NULL_HANDLE) { Status = CoreHandleProtocol (*UserHandle, Protocol, (VOID **)&ExistingInterface); if (!EFI_ERROR (Status)) { diff --git a/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c b/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c index aafa193301..78f5073e3b 100644 --- a/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c +++ b/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c @@ -104,7 +104,7 @@ CoreUpdateDebugTableCrc32 ( { ASSERT(mDebugTable != NULL); mDebugTable->Crc32 = 0; - gDxeCoreBS->CalculateCrc32 ((VOID *)mDebugTable, sizeof (EFI_SYSTEM_TABLE_POINTER), &mDebugTable->Crc32); + gBS->CalculateCrc32 ((VOID *)mDebugTable, sizeof (EFI_SYSTEM_TABLE_POINTER), &mDebugTable->Crc32); } -- cgit v1.2.3