From 9c4ac31cca01b4a503c36616770ea3157bf3bb9e Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Wed, 27 Aug 2008 14:29:23 +0000 Subject: Clean up DxeCore to remove duplicate memory allocation & device path utility services in Library.c.DxeCore should use MemoryAllocationLib & DevicePathLib for these API. Minor cleanup the coding style: #include should be changed to #include "DxeMain.h" since "DxeMain.h" is not pubic header fie. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5742 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/Dxe/Image/Image.c | 18 +++++++++--------- MdeModulePkg/Core/Dxe/Image/ImageFile.c | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'MdeModulePkg/Core/Dxe/Image') diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c index 54254879ca..4b65148344 100644 --- a/MdeModulePkg/Core/Dxe/Image/Image.c +++ b/MdeModulePkg/Core/Dxe/Image/Image.c @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" // // Module Globals // @@ -340,7 +340,7 @@ CoreLoadPeImage ( // if ((Attribute & EFI_LOAD_PE_IMAGE_ATTRIBUTE_RUNTIME_REGISTRATION) != 0) { if (Image->ImageContext.ImageType == EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER) { - Image->ImageContext.FixupData = CoreAllocateRuntimePool ((UINTN)(Image->ImageContext.FixupDataSize)); + Image->ImageContext.FixupData = AllocateRuntimePool ((UINTN)(Image->ImageContext.FixupDataSize)); if (Image->ImageContext.FixupData == NULL) { Status = EFI_OUT_OF_RESOURCES; goto Done; @@ -444,7 +444,7 @@ CoreLoadPeImage ( // // Make a list off all the RT images so we can let the RT AP know about them. // - Image->RuntimeData = CoreAllocateRuntimePool (sizeof(EFI_RUNTIME_IMAGE_ENTRY)); + Image->RuntimeData = AllocateRuntimePool (sizeof(EFI_RUNTIME_IMAGE_ENTRY)); if (Image->RuntimeData == NULL) { goto Done; } @@ -685,7 +685,7 @@ CoreLoadImageCommon ( // // Allocate a new image structure // - Image = CoreAllocateZeroBootServicesPool (sizeof(LOADED_IMAGE_PRIVATE_DATA)); + Image = AllocateZeroPool (sizeof(LOADED_IMAGE_PRIVATE_DATA)); if (Image == NULL) { return EFI_OUT_OF_RESOURCES; } @@ -696,7 +696,7 @@ CoreLoadImageCommon ( FilePath = OriginalFilePath; Status = CoreHandleProtocol (DeviceHandle, &gEfiDevicePathProtocolGuid, (VOID **)&HandleFilePath); if (!EFI_ERROR (Status)) { - FilePathSize = CoreDevicePathSize (HandleFilePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL); + FilePathSize = GetDevicePathSize (HandleFilePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL); FilePath = (EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *)FilePath) + FilePathSize ); } @@ -707,7 +707,7 @@ CoreLoadImageCommon ( Image->Info.SystemTable = gDxeCoreST; Image->Info.DeviceHandle = DeviceHandle; Image->Info.Revision = EFI_LOADED_IMAGE_PROTOCOL_REVISION; - Image->Info.FilePath = CoreDuplicateDevicePath (FilePath); + Image->Info.FilePath = DuplicateDevicePath (FilePath); Image->Info.ParentHandle = ParentImageHandle; @@ -774,7 +774,7 @@ CoreLoadImageCommon ( // otherwise Loaded Image Device Path Protocol is installed with a NULL interface pointer. // if (OriginalFilePath != NULL) { - Image->LoadedImageDevicePath = CoreDuplicateDevicePath (OriginalFilePath); + Image->LoadedImageDevicePath = DuplicateDevicePath (OriginalFilePath); } // @@ -1000,7 +1000,7 @@ CoreStartImage ( // JumpContext must be aligned on a CPU specific boundary. // Overallocate the buffer and force the required alignment // - Image->JumpBuffer = CoreAllocateBootServicesPool (sizeof (BASE_LIBRARY_JUMP_BUFFER) + BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT); + Image->JumpBuffer = AllocatePool (sizeof (BASE_LIBRARY_JUMP_BUFFER) + BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT); if (Image->JumpBuffer == NULL) { PERF_END (ImageHandle, START_IMAGE_TOK, NULL, 0); return EFI_OUT_OF_RESOURCES; @@ -1322,7 +1322,7 @@ CoreExit ( // if (ExitData != NULL) { Image->ExitDataSize = ExitDataSize; - Image->ExitData = CoreAllocateBootServicesPool (Image->ExitDataSize); + Image->ExitData = AllocatePool (Image->ExitDataSize); if (Image->ExitData == NULL) { Status = EFI_OUT_OF_RESOURCES; goto Done; diff --git a/MdeModulePkg/Core/Dxe/Image/ImageFile.c b/MdeModulePkg/Core/Dxe/Image/ImageFile.c index 3776e57513..a95496f9c5 100644 --- a/MdeModulePkg/Core/Dxe/Image/ImageFile.c +++ b/MdeModulePkg/Core/Dxe/Image/ImageFile.c @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" /** @@ -177,7 +177,7 @@ CoreOpenImageFile ( // Because the device path consists of one or more FILE PATH MEDIA DEVICE PATH // nodes, It assures the fields in device path nodes are 2 byte aligned. // - FilePathNode = (FILEPATH_DEVICE_PATH *)CoreDuplicateDevicePath((EFI_DEVICE_PATH_PROTOCOL *)(UINTN)FilePathNode); + FilePathNode = (FILEPATH_DEVICE_PATH *)DuplicateDevicePath((EFI_DEVICE_PATH_PROTOCOL *)(UINTN)FilePathNode); if (FilePathNode == NULL) { FileHandle->Close (FileHandle); Status = EFI_OUT_OF_RESOURCES; @@ -247,7 +247,7 @@ CoreOpenImageFile ( // // Allocate space for the file // - ImageFileHandle->Source = CoreAllocateBootServicesPool ((UINTN)FileInfo->FileSize); + ImageFileHandle->Source = AllocatePool ((UINTN)FileInfo->FileSize); if (ImageFileHandle->Source != NULL) { // // Read the file into the buffer we allocated @@ -453,7 +453,7 @@ CoreGrowBuffer ( CoreFreePool (*Buffer); } - *Buffer = CoreAllocateBootServicesPool (BufferSize); + *Buffer = AllocatePool (BufferSize); if (*Buffer != NULL) { TryAgain = TRUE; } else { -- cgit v1.2.3