/** Find and return Pei Core entry point. It also find SEC and PEI Core file debug information. It will report them if remote debug is enabled. @param SecCoreFirmwareVolumePtr Point to the firmware volume for finding SecCore. @param PeiCoreFirmwareVolumePtr Point to the firmware volume for finding PeiCore. @param PeiCoreEntryPoint The entry point of the PEI core. **/ VOID EFIAPI FindAndReportEntryPoints ( IN EFI_FIRMWARE_VOLUME_HEADER *SecCoreFirmwareVolumePtr, IN EFI_FIRMWARE_VOLUME_HEADER *PeiCoreFirmwareVolumePtr, OUT EFI_PEI_CORE_ENTRY_POINT *PeiCoreEntryPoint ) { EFI_STATUS Status; EFI_PHYSICAL_ADDRESS SecCoreImageBase; EFI_PHYSICAL_ADDRESS PeiCoreImageBase; PE_COFF_LOADER_IMAGE_CONTEXT ImageContext; // // Find SEC Core image base // Status = FindImageBase (SecCoreFirmwareVolumePtr, EFI_FV_FILETYPE_SECURITY_CORE, &SecCoreImageBase); ASSERT_EFI_ERROR (Status); ZeroMem ((VOID *) &ImageContext, sizeof (PE_COFF_LOADER_IMAGE_CONTEXT)); // // Report SEC Core debug information when remote debug is enabled // ImageContext.ImageAddress = SecCoreImageBase; ImageContext.PdbPointer = PeCoffLoaderGetPdbPointer ((VOID*) (UINTN) ImageContext.ImageAddress); PeCoffLoaderRelocateImageExtraAction (&ImageContext); // // Find PEI Core image base // Status = FindImageBase (PeiCoreFirmwareVolumePtr, EFI_FV_FILETYPE_PEI_CORE, &PeiCoreImageBase); ASSERT_EFI_ERROR (Status); // // Report PEI Core debug information when remote debug is enabled // ImageContext.ImageAddress = PeiCoreImageBase; ImageContext.PdbPointer = PeCoffLoaderGetPdbPointer ((VOID*) (UINTN) ImageContext.ImageAddress); PeCoffLoaderRelocateImageExtraAction (&ImageContext); // // Find PEI Core entry point // Status = PeCoffLoaderGetEntryPoint ((VOID *) (UINTN) PeiCoreImageBase, (VOID**) PeiCoreEntryPoint); if (EFI_ERROR (Status)) { *PeiCoreEntryPoint = 0; } return; }
void CELF2ASM<ELFSTRUCTURES>::Convert() { // Do the conversion // Find image base and executable type FindImageBase(); // Tell disassembler Disasm.Init(ExeType, ImageBase); // Set image base // Make Sections list in Disasm MakeSectionList(); // Make Symbols list in Disasm MakeSymbolList(); // Make relocations for object and executable files MakeRelocations(); if (ImageBase) { // Executable file MakeImportList(); // Make imported symbols for executable files MakeExportList(); // Make exported symbols for executable files MakeListLabels(); // Put labels on all image directory tables } Disasm.Go(); // Disassemble *this << Disasm.OutFile; // Take over output file from Disasm }