/** @file\r
Core image handling services to load and unload PeImage.\r
\r
-Copyright (c) 2006 - 2009, Intel Corporation. <BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
http://opensource.org/licenses/bsd-license.php\r
UINT64 DxeCoreImageLength;\r
VOID *DxeCoreEntryPoint;\r
EFI_PEI_HOB_POINTERS DxeCoreHob;\r
+ PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;\r
+ \r
//\r
// Searching for image hob\r
//\r
DxeCoreImageLength = DxeCoreHob.MemoryAllocationModule->MemoryAllocationHeader.MemoryLength;\r
DxeCoreEntryPoint = (VOID *) (UINTN) DxeCoreHob.MemoryAllocationModule->EntryPoint;\r
gDxeCoreFileName = &DxeCoreHob.MemoryAllocationModule->ModuleName;\r
+ \r
+ //\r
+ // Report DXE Core image information to the PE/COFF Extra Action Library\r
+ //\r
+ ImageContext.ImageAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)DxeCoreImageBaseAddress;\r
+ ImageContext.PdbPointer = PeCoffLoaderGetPdbPointer ((VOID*) (UINTN) ImageContext.ImageAddress);\r
+ PeCoffLoaderRelocateImageExtraAction (&ImageContext);\r
+\r
//\r
// Initialize the fields for an internal driver\r
//\r
// relative to top address\r
//\r
if ((INT64)PcdGet64(PcdLoadModuleAtFixAddressEnable) < 0) {\r
- ImageContext->ImageAddress = gLoadModuleAtFixAddressConfigurationTable.DxeCodeTopAddress + (INT64)ImageContext->ImageAddress;\r
+ ImageContext->ImageAddress = gLoadModuleAtFixAddressConfigurationTable.DxeCodeTopAddress + (INT64)(INTN)ImageContext->ImageAddress;\r
}\r
//\r
// Check if the memory range is avaliable.\r
// Locate the EBC interpreter protocol\r
//\r
Status = CoreLocateProtocol (&gEfiEbcProtocolGuid, NULL, (VOID **)&Image->Ebc);\r
- if (EFI_ERROR(Status)) {\r
+ if (EFI_ERROR(Status) || Image->Ebc == NULL) {\r
DEBUG ((DEBUG_LOAD | DEBUG_ERROR, "CoreLoadPeImage: There is no EBC interpreter for an EBC image.\n"));\r
goto Done;\r
}\r
// Pull out just the file portion of the DevicePath for the LoadedImage FilePath\r
//\r
FilePath = OriginalFilePath;\r
- Status = CoreHandleProtocol (DeviceHandle, &gEfiDevicePathProtocolGuid, (VOID **)&HandleFilePath);\r
- if (!EFI_ERROR (Status)) {\r
- FilePathSize = GetDevicePathSize (HandleFilePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL);\r
- FilePath = (EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *)FilePath) + FilePathSize );\r
+ if (DeviceHandle != NULL) {\r
+ Status = CoreHandleProtocol (DeviceHandle, &gEfiDevicePathProtocolGuid, (VOID **)&HandleFilePath);\r
+ if (!EFI_ERROR (Status)) {\r
+ FilePathSize = GetDevicePathSize (HandleFilePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL);\r
+ FilePath = (EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *)FilePath) + FilePathSize );\r
+ }\r
}\r
-\r
//\r
// Initialize the fields for an internal driver\r
//\r