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
This commit is contained in:
		@@ -76,6 +76,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 | 
				
			|||||||
#include <Library/PeCoffLib.h>
 | 
					#include <Library/PeCoffLib.h>
 | 
				
			||||||
#include <Library/PcdLib.h>
 | 
					#include <Library/PcdLib.h>
 | 
				
			||||||
#include <Library/MemoryAllocationLib.h>
 | 
					#include <Library/MemoryAllocationLib.h>
 | 
				
			||||||
 | 
					#include <Library/UefiBootServicesTableLib.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "DebugImageInfo.h"
 | 
					#include "DebugImageInfo.h"
 | 
				
			||||||
#include "Library.h"
 | 
					#include "Library.h"
 | 
				
			||||||
@@ -197,7 +198,6 @@ typedef struct {
 | 
				
			|||||||
// DXE Core Global Variables
 | 
					// DXE Core Global Variables
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
extern EFI_SYSTEM_TABLE                         *gDxeCoreST;
 | 
					extern EFI_SYSTEM_TABLE                         *gDxeCoreST;
 | 
				
			||||||
extern EFI_BOOT_SERVICES                        *gDxeCoreBS;
 | 
					 | 
				
			||||||
extern EFI_RUNTIME_SERVICES                     *gDxeCoreRT;
 | 
					extern EFI_RUNTIME_SERVICES                     *gDxeCoreRT;
 | 
				
			||||||
extern EFI_DXE_SERVICES                         *gDxeCoreDS;
 | 
					extern EFI_DXE_SERVICES                         *gDxeCoreDS;
 | 
				
			||||||
extern EFI_HANDLE                               gDxeCoreImageHandle;
 | 
					extern EFI_HANDLE                               gDxeCoreImageHandle;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -87,6 +87,7 @@
 | 
				
			|||||||
  PeCoffLib
 | 
					  PeCoffLib
 | 
				
			||||||
  ExtractGuidedSectionLib
 | 
					  ExtractGuidedSectionLib
 | 
				
			||||||
  MemoryAllocationLib
 | 
					  MemoryAllocationLib
 | 
				
			||||||
 | 
					  UefiBootServicesTableLib
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[Guids]
 | 
					[Guids]
 | 
				
			||||||
  gEfiEventLegacyBootGuid                       # ALWAYS_CONSUMED
 | 
					  gEfiEventLegacyBootGuid                       # ALWAYS_CONSUMED
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -199,7 +199,6 @@ EFI_RUNTIME_ARCH_PROTOCOL *gRuntime = &gRuntimeTemplate;
 | 
				
			|||||||
// DXE Core Global Variables for the EFI System Table, Boot Services Table,
 | 
					// DXE Core Global Variables for the EFI System Table, Boot Services Table,
 | 
				
			||||||
// DXE Services Table, and Runtime Services Table
 | 
					// DXE Services Table, and Runtime Services Table
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
EFI_BOOT_SERVICES     *gDxeCoreBS = &mBootServices;
 | 
					 | 
				
			||||||
EFI_DXE_SERVICES      *gDxeCoreDS = &mDxeServices;
 | 
					EFI_DXE_SERVICES      *gDxeCoreDS = &mDxeServices;
 | 
				
			||||||
EFI_SYSTEM_TABLE      *gDxeCoreST = NULL;
 | 
					EFI_SYSTEM_TABLE      *gDxeCoreST = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -640,11 +639,11 @@ CalculateEfiHdrCrc (
 | 
				
			|||||||
  Hdr->CRC32 = 0;
 | 
					  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 will come back as zero if we set it to zero here
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  Crc = 0;
 | 
					  Crc = 0;
 | 
				
			||||||
  gDxeCoreBS->CalculateCrc32 ((UINT8 *)Hdr, Hdr->HeaderSize, &Crc);
 | 
					  gBS->CalculateCrc32 ((UINT8 *)Hdr, Hdr->HeaderSize, &Crc);
 | 
				
			||||||
  Hdr->CRC32 = Crc;
 | 
					  Hdr->CRC32 = Crc;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -744,8 +743,8 @@ CoreExitBootServices (
 | 
				
			|||||||
  //
 | 
					  //
 | 
				
			||||||
  // Zero out the Boot Service Table
 | 
					  // Zero out the Boot Service Table
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  ZeroMem (gDxeCoreBS, sizeof (EFI_BOOT_SERVICES));
 | 
					  ZeroMem (gBS, sizeof (EFI_BOOT_SERVICES));
 | 
				
			||||||
  gDxeCoreBS = NULL;
 | 
					  gBS = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  // Update the AtRuntime field in Runtiem AP.
 | 
					  // Update the AtRuntime field in Runtiem AP.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -161,7 +161,7 @@ GenericArchProtocolNotify (
 | 
				
			|||||||
  //
 | 
					  //
 | 
				
			||||||
  if (Found) {
 | 
					  if (Found) {
 | 
				
			||||||
    CalculateEfiHdrCrc (&gDxeCoreRT->Hdr);
 | 
					    CalculateEfiHdrCrc (&gDxeCoreRT->Hdr);
 | 
				
			||||||
    CalculateEfiHdrCrc (&gDxeCoreBS->Hdr);
 | 
					    CalculateEfiHdrCrc (&gBS->Hdr);
 | 
				
			||||||
    CalculateEfiHdrCrc (&gDxeCoreST->Hdr);
 | 
					    CalculateEfiHdrCrc (&gDxeCoreST->Hdr);
 | 
				
			||||||
    CalculateEfiHdrCrc (&gDxeCoreDS->Hdr);
 | 
					    CalculateEfiHdrCrc (&gDxeCoreDS->Hdr);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -370,8 +370,6 @@ CoreInstallProtocolInterfaceNotify (
 | 
				
			|||||||
  Prot = NULL;
 | 
					  Prot = NULL;
 | 
				
			||||||
  Handle = NULL;
 | 
					  Handle = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ASSERT (gDxeCoreBS != NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (*UserHandle != NULL_HANDLE) {
 | 
					  if (*UserHandle != NULL_HANDLE) {
 | 
				
			||||||
    Status = CoreHandleProtocol (*UserHandle, Protocol, (VOID **)&ExistingInterface);
 | 
					    Status = CoreHandleProtocol (*UserHandle, Protocol, (VOID **)&ExistingInterface);
 | 
				
			||||||
    if (!EFI_ERROR (Status)) {
 | 
					    if (!EFI_ERROR (Status)) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -104,7 +104,7 @@ CoreUpdateDebugTableCrc32 (
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  ASSERT(mDebugTable != NULL);
 | 
					  ASSERT(mDebugTable != NULL);
 | 
				
			||||||
  mDebugTable->Crc32 = 0;
 | 
					  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);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user