From e98cd821ebedd6472c12738bd53dc7cfd02bb4fb Mon Sep 17 00:00:00 2001 From: lgao4 Date: Wed, 31 Oct 2007 11:46:42 +0000 Subject: Print real entry point for IPF image. Print DxeCore Entry point and image address. Set FileHandle = NULL when not found FFS file in PeiService PeiFfsFindNextFile. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4254 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/Dxe/Image/Image.c | 21 +++++++++++++++++++-- MdeModulePkg/Core/DxeIplPeim/DxeLoad.c | 16 +++++++++++++++- MdeModulePkg/Core/Pei/FwVol/FwVol.c | 10 ++++++---- MdeModulePkg/Core/Pei/Image/Image.c | 19 +++++++++++++++---- 4 files changed, 55 insertions(+), 11 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c index 31b1445..99170dc 100644 --- a/MdeModulePkg/Core/Dxe/Image/Image.c +++ b/MdeModulePkg/Core/Dxe/Image/Image.c @@ -446,8 +446,25 @@ Returns: UINTN Index; UINTN StartIndex; CHAR8 EfiFileName[256]; - - DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Loading driver at 0x%10p EntryPoint=0x%10p ", (VOID *)(UINTN)Image->ImageContext.ImageAddress, (VOID *)(UINTN)Image->ImageContext.EntryPoint)); + + if (Image->ImageContext.Machine != IMAGE_FILE_MACHINE_IA64) { + DEBUG ((EFI_D_INFO | EFI_D_LOAD, + "Loading driver at 0x%10p EntryPoint=0x%10p ", + (VOID *)(UINTN)Image->ImageContext.ImageAddress, + (VOID *)(UINTN)Image->ImageContext.EntryPoint)); + } else { + // + // For IPF Image, the real entry point should be print. + // + DEBUG ((EFI_D_INFO | EFI_D_LOAD, + "Loading driver at 0x%10p EntryPoint=0x%10p ", + (VOID *)(UINTN)Image->ImageContext.ImageAddress, + (VOID *)(UINTN)(*(UINT64 *)(UINTN)Image->ImageContext.EntryPoint))); + } + + // + // Print Module Name by Pdb file path + // if (Image->ImageContext.PdbPointer != NULL) { StartIndex = 0; for (Index = 0; Image->ImageContext.PdbPointer[Index] != 0; Index++) { diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c b/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c index 34021d5..77a0920 100644 --- a/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c +++ b/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c @@ -236,11 +236,25 @@ DxeLoadCore ( EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_CORE_PC_HANDOFF_TO_NEXT ); + DEBUG_CODE_BEGIN (); + + EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION PtrPeImage; + PtrPeImage.Pe32 = (EFI_IMAGE_NT_HEADERS32 *) ((UINTN) DxeCoreAddress + ((EFI_IMAGE_DOS_HEADER *) (UINTN) DxeCoreAddress)->e_lfanew); + + if (PtrPeImage.Pe32->FileHeader.Machine != IMAGE_FILE_MACHINE_IA64) { + DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Loading DXE CORE at 0x%08x EntryPoint=0x%08x\n", (UINTN) DxeCoreAddress, (UINTN) DxeCoreEntryPoint)); + } else { + // + // For IPF Image, the real entry point should be print. + // + DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Loading DXE CORE at 0x%08x EntryPoint=0x%08x\n", (UINTN) DxeCoreAddress, (UINTN) (*(UINT64 *)(UINTN)DxeCoreEntryPoint))); + } + + DEBUG_CODE_END (); // // Transfer control to the DXE Core // The handoff state is simply a pointer to the HOB list // - DEBUG ((EFI_D_INFO, "DXE Core Entry Point 0x%08x\n", (UINTN) DxeCoreEntryPoint)); HandOffToDxeCore (DxeCoreEntryPoint, HobList, &mPpiSignal); // // If we get here, then the DXE Core returned. This is an error diff --git a/MdeModulePkg/Core/Pei/FwVol/FwVol.c b/MdeModulePkg/Core/Pei/FwVol/FwVol.c index 181cfa0..e649223 100644 --- a/MdeModulePkg/Core/Pei/FwVol/FwVol.c +++ b/MdeModulePkg/Core/Pei/FwVol/FwVol.c @@ -224,10 +224,10 @@ Returns: FileOccupiedSize = GET_OCCUPIED_SIZE (FileLength, 8); FfsFileHeader = (EFI_FFS_FILE_HEADER *)((UINT8 *)*FileHeader + FileOccupiedSize); } - + FileOffset = (UINT32) ((UINT8 *)FfsFileHeader - (UINT8 *)FwVolHeader); ASSERT (FileOffset <= 0xFFFFFFFF); - + while (FileOffset < (FvLength - sizeof (EFI_FFS_FILE_HEADER))) { // // Get FileState which is the highest bit of the State @@ -244,6 +244,7 @@ Returns: case EFI_FILE_MARKED_FOR_UPDATE: if (CalculateHeaderChecksum (FfsFileHeader) != 0) { ASSERT (FALSE); + *FileHeader = NULL; return EFI_NOT_FOUND; } @@ -285,11 +286,12 @@ Returns: break; default: + *FileHeader = NULL; return EFI_NOT_FOUND; - } } - + + *FileHeader = NULL; return EFI_NOT_FOUND; } diff --git a/MdeModulePkg/Core/Pei/Image/Image.c b/MdeModulePkg/Core/Pei/Image/Image.c index c38fa56..4035c75 100644 --- a/MdeModulePkg/Core/Pei/Image/Image.c +++ b/MdeModulePkg/Core/Pei/Image/Image.c @@ -406,16 +406,27 @@ Returns: *ImageSizeArg = ImageSize; } - // - // Print debug message: Loading PEIM at 0x12345678 EntryPoint=0x12345688 Driver.efi - // - DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Loading PEIM at 0x%08x EntryPoint=0x%08x ", (UINTN) ImageAddress, *EntryPoint)); DEBUG_CODE_BEGIN (); CHAR8 *AsciiString; CHAR8 AsciiBuffer[512]; INT32 Index; INT32 Index1; + + // + // Print debug message: Loading PEIM at 0x12345678 EntryPoint=0x12345688 Driver.efi + // + if (Machine != IMAGE_FILE_MACHINE_IA64) { + DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Loading PEIM at 0x%08x EntryPoint=0x%08x ", (UINTN) ImageAddress, *EntryPoint)); + } else { + // + // For IPF Image, the real entry point should be print. + // + DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Loading PEIM at 0x%08x EntryPoint=0x%08x ", (UINTN) ImageAddress, (UINTN) (*(UINT64 *)(UINTN)*EntryPoint))); + } + // + // Print Module Name by PeImage PDB file name. + // AsciiString = PeCoffLoaderGetPdbPointer (Pe32Data); if (AsciiString != NULL) { -- cgit v1.1