EFI_STATUS Status;\r
VOID *Pe32Data;\r
EFI_PEI_FV_FILE_LOADER_PPI *FvLoadFilePpi;\r
-//#ifdef EFI_NT_EMULATOR\r
-// EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;\r
-// NT_PEI_LOAD_FILE_PPI *PeiNtService;\r
-//#endif\r
EFI_PHYSICAL_ADDRESS ImageAddress;\r
UINT64 ImageSize;\r
EFI_PHYSICAL_ADDRESS ImageEntryPoint;\r
//\r
// Try to find a PE32 section.\r
//\r
- Status = PeiCoreFfsFindSectionData (\r
+ Status = PeiServicesFfsFindSectionData (\r
EFI_SECTION_PE32,\r
PeimFileHeader,\r
&Pe32Data\r
// If we didn't find a PE32 section, try to find a TE section.\r
//\r
if (EFI_ERROR (Status)) {\r
- Status = PeiCoreFfsFindSectionData (\r
+ Status = PeiServicesFfsFindSectionData (\r
EFI_SECTION_TE,\r
PeimFileHeader,\r
(VOID **) &TEImageHeader\r
// There was not a PE32 or a TE section, so assume that it's a Compressed section\r
// and use the LoadFile\r
//\r
- Status = PeiCoreLocatePpi (\r
+ Status = PeiServicesLocatePpi (\r
&gEfiPeiFvFileLoaderPpiGuid,\r
0,\r
NULL,\r
}\r
\r
//\r
- // Retrieve the entry point from the PE/COFF image header\r
+ // Got the entry point from ImageEntryPoint\r
//\r
- Status = PeCoffLoaderGetEntryPoint ((VOID *)(UINTN)ImageAddress, EntryPoint);\r
- if (EFI_ERROR (Status)) {\r
- return EFI_NOT_FOUND;\r
- }\r
+ *EntryPoint = (VOID *) ((UINTN) ImageEntryPoint);\r
+ return EFI_SUCCESS;\r
} else {\r
//\r
// Retrieve the entry point from the TE image header\r
EFI_IMAGE_DOS_HEADER *DosHeader;\r
EFI_IMAGE_NT_HEADERS *PeHeader;\r
\r
- DosHeader = (EFI_IMAGE_DOS_HEADER *)Pe32Data;\r
- if (DosHeader->e_magic == EFI_IMAGE_DOS_SIGNATURE) {\r
- //\r
- // DOS image header is present, so read the PE header after the DOS image header\r
- //\r
- PeHeader = (EFI_IMAGE_NT_HEADERS *) ((UINTN) Pe32Data + (UINTN) ((DosHeader->e_lfanew) & 0x0ffff));\r
- } else {\r
- //\r
- // DOS image header is not present, so PE header is at the image base\r
- //\r
- PeHeader = (EFI_IMAGE_NT_HEADERS *) Pe32Data;\r
+ //\r
+ // Pe32Data is NULL when load TE image \r
+ // \r
+ PeHeader = NULL;\r
+ if (TEImageHeader == NULL) {\r
+ DosHeader = (EFI_IMAGE_DOS_HEADER *)Pe32Data;\r
+ if (DosHeader->e_magic == EFI_IMAGE_DOS_SIGNATURE) {\r
+ //\r
+ // DOS image header is present, so read the PE header after the DOS image header\r
+ //\r
+ PeHeader = (EFI_IMAGE_NT_HEADERS *) ((UINTN) Pe32Data + (UINTN) ((DosHeader->e_lfanew) & 0x0ffff));\r
+ } else {\r
+ //\r
+ // DOS image header is not present, so PE header is at the image base\r
+ //\r
+ PeHeader = (EFI_IMAGE_NT_HEADERS *) Pe32Data;\r
+ }\r
}\r
\r
//\r