// When Image has no reloc section, it can't be relocated into memory.\r
//\r
if (ImageContext.RelocationsStripped) {\r
- DEBUG ((EFI_D_ERROR, "The image at 0x%08x without reloc section can't be loaded into memory", (UINTN) Pe32Data));\r
+ DEBUG ((EFI_D_ERROR, "The image at 0x%08x without reloc section can't be loaded into memory\n", (UINTN) Pe32Data));\r
return EFI_INVALID_PARAMETER;\r
}\r
//\r
UINT16 Machine;\r
PEI_CORE_INSTANCE *Private;\r
VOID *EntryPointArg;\r
+ EFI_SECTION_TYPE SearchType1;\r
+ EFI_SECTION_TYPE SearchType2;\r
\r
*EntryPoint = 0;\r
ImageSize = 0;\r
*AuthenticationState = 0;\r
\r
+ if (FeaturePcdGet (PcdPeiCoreImageLoaderSearchTeSectionFirst)) {\r
+ SearchType1 = EFI_SECTION_TE;\r
+ SearchType2 = EFI_SECTION_PE32;\r
+ } else {\r
+ SearchType1 = EFI_SECTION_PE32;\r
+ SearchType2 = EFI_SECTION_TE;\r
+ }\r
//\r
- // Try to find a TE section.\r
+ // Try to find a first exe section (if PcdPeiCoreImageLoaderSearchTeSectionFirst \r
+ // is true, TE will be searched first).\r
//\r
Status = PeiServicesFfsFindSectionData (\r
- EFI_SECTION_TE,\r
+ SearchType1,\r
FileHandle,\r
&Pe32Data\r
);\r
//\r
- // If we didn't find a TE section, try to find a PE32 section.\r
+ // If we didn't find a first exe section, try to find the second exe section.\r
//\r
if (EFI_ERROR (Status)) {\r
Status = PeiServicesFfsFindSectionData (\r
- EFI_SECTION_PE32,\r
+ SearchType2,\r
FileHandle,\r
&Pe32Data\r
);\r
// Print debug message: Loading PEIM at 0x12345678 EntryPoint=0x12345688 Driver.efi\r
//\r
if (Machine != IMAGE_FILE_MACHINE_IA64) {\r
- DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Loading PEIM at 0x%08x EntryPoint=0x%08x ", (UINTN) ImageAddress, *EntryPoint));\r
+ DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Loading PEIM at 0x%10p EntryPoint=0x%10p ", (VOID *)(UINTN)ImageAddress, (VOID *)(UINTN)*EntryPoint));\r
} else {\r
//\r
// For IPF Image, the real entry point should be print.\r
//\r
- DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Loading PEIM at 0x%08x EntryPoint=0x%08x ", (UINTN) ImageAddress, (UINTN) (*(UINT64 *)(UINTN)*EntryPoint)));\r
+ DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Loading PEIM at 0x%10p EntryPoint=0x%10p ", (VOID *)(UINTN)ImageAddress, (VOID *)(UINTN)(*(UINT64 *)(UINTN)*EntryPoint)));\r
}\r
\r
//\r