mirror of https://github.com/acidanthera/audk.git
Add EntryPoint info of module into Fv.map file, which is used to debug when no serial output.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1544 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
1744b047bb
commit
7838808993
|
@ -675,14 +675,14 @@ Returns:
|
||||||
//
|
//
|
||||||
PeHdr = (VOID *) ((UINTN) ImageAddress + ImageContext.PeCoffHeaderOffset);
|
PeHdr = (VOID *) ((UINTN) ImageAddress + ImageContext.PeCoffHeaderOffset);
|
||||||
if (PeHdr->FileHeader.Machine == EFI_IMAGE_MACHINE_IA32) {
|
if (PeHdr->FileHeader.Machine == EFI_IMAGE_MACHINE_IA32) {
|
||||||
PeHdrSizeOfImage = (UINT32 *) (&(*(EFI_IMAGE_OPTIONAL_HEADER32 *) &PeHdr->OptionalHeader).SizeOfImage);
|
PeHdrSizeOfImage = (UINT32 *) (&(*(EFI_IMAGE_OPTIONAL_HEADER32 *) &PeHdr->OptionalHeader).SizeOfImage);
|
||||||
PeHdrChecksum = (UINT32 *) (&(*(EFI_IMAGE_OPTIONAL_HEADER32 *) &PeHdr->OptionalHeader).CheckSum);
|
PeHdrChecksum = (UINT32 *) (&(*(EFI_IMAGE_OPTIONAL_HEADER32 *) &PeHdr->OptionalHeader).CheckSum);
|
||||||
} else if (PeHdr->FileHeader.Machine == EFI_IMAGE_MACHINE_IA64) {
|
} else if (PeHdr->FileHeader.Machine == EFI_IMAGE_MACHINE_IA64) {
|
||||||
PeHdrSizeOfImage = (UINT32 *) (&(*(EFI_IMAGE_OPTIONAL_HEADER64 *) &PeHdr->OptionalHeader).SizeOfImage);
|
PeHdrSizeOfImage = (UINT32 *) (&(*(EFI_IMAGE_OPTIONAL_HEADER64 *) &PeHdr->OptionalHeader).SizeOfImage);
|
||||||
PeHdrChecksum = (UINT32 *) (&(*(EFI_IMAGE_OPTIONAL_HEADER64 *) &PeHdr->OptionalHeader).CheckSum);
|
PeHdrChecksum = (UINT32 *) (&(*(EFI_IMAGE_OPTIONAL_HEADER64 *) &PeHdr->OptionalHeader).CheckSum);
|
||||||
} else if (PeHdr->FileHeader.Machine == EFI_IMAGE_MACHINE_X64) {
|
} else if (PeHdr->FileHeader.Machine == EFI_IMAGE_MACHINE_X64) {
|
||||||
PeHdrSizeOfImage = (UINT32 *) (&(*(EFI_IMAGE_OPTIONAL_HEADER64 *) &PeHdr->OptionalHeader).SizeOfImage);
|
PeHdrSizeOfImage = (UINT32 *) (&(*(EFI_IMAGE_OPTIONAL_HEADER64 *) &PeHdr->OptionalHeader).SizeOfImage);
|
||||||
PeHdrChecksum = (UINT32 *) (&(*(EFI_IMAGE_OPTIONAL_HEADER64 *) &PeHdr->OptionalHeader).CheckSum);
|
PeHdrChecksum = (UINT32 *) (&(*(EFI_IMAGE_OPTIONAL_HEADER64 *) &PeHdr->OptionalHeader).CheckSum);
|
||||||
} else {
|
} else {
|
||||||
Error (
|
Error (
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -706,12 +706,18 @@ Returns:
|
||||||
|
|
||||||
memcpy (CurrentPe32Section.Pe32Section + 1, (VOID *) MemoryImagePointerAligned, (UINT32) ImageSize);
|
memcpy (CurrentPe32Section.Pe32Section + 1, (VOID *) MemoryImagePointerAligned, (UINT32) ImageSize);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get EntryPoint in Flash Region.
|
||||||
|
//
|
||||||
|
EntryPoint = NewPe32BaseAddress + EntryPoint - ImageAddress;
|
||||||
|
|
||||||
//
|
//
|
||||||
// If a map file was selected output mapping information for any file that
|
// If a map file was selected output mapping information for any file that
|
||||||
// was rebased.
|
// was rebased.
|
||||||
//
|
//
|
||||||
if (MapFile != NULL) {
|
if (MapFile != NULL) {
|
||||||
fprintf (MapFile, "PE32 File: %s Base:%08lx", FileGuidString, BaseAddress);
|
fprintf (MapFile, "PE32 File: %s Base:%08lx", FileGuidString, BaseAddress);
|
||||||
|
fprintf (MapFile, " EntryPoint:%08lx", EntryPoint);
|
||||||
if (ImageContext.PdbPointer != NULL) {
|
if (ImageContext.PdbPointer != NULL) {
|
||||||
fprintf (MapFile, " FileName: %s", ImageContext.PdbPointer);
|
fprintf (MapFile, " FileName: %s", ImageContext.PdbPointer);
|
||||||
}
|
}
|
||||||
|
@ -810,6 +816,8 @@ Returns:
|
||||||
//
|
//
|
||||||
PeHdr->FileHeader.SizeOfOptionalHeader = (UINT16) (TEImageHeader->StrippedSize - 0x40 - sizeof (UINT32) - sizeof (EFI_IMAGE_FILE_HEADER));
|
PeHdr->FileHeader.SizeOfOptionalHeader = (UINT16) (TEImageHeader->StrippedSize - 0x40 - sizeof (UINT32) - sizeof (EFI_IMAGE_FILE_HEADER));
|
||||||
PeHdr->OptionalHeader.ImageBase = (UINTN) (TEImageHeader->ImageBase - TEImageHeader->StrippedSize + sizeof (EFI_TE_IMAGE_HEADER));
|
PeHdr->OptionalHeader.ImageBase = (UINTN) (TEImageHeader->ImageBase - TEImageHeader->StrippedSize + sizeof (EFI_TE_IMAGE_HEADER));
|
||||||
|
PeHdr->OptionalHeader.AddressOfEntryPoint = TEImageHeader->AddressOfEntryPoint;
|
||||||
|
PeHdr->OptionalHeader.BaseOfCode = TEImageHeader->BaseOfCode;
|
||||||
PeHdr->OptionalHeader.SizeOfImage = Pe32ImageSize;
|
PeHdr->OptionalHeader.SizeOfImage = Pe32ImageSize;
|
||||||
PeHdr->OptionalHeader.Subsystem = TEImageHeader->Subsystem;
|
PeHdr->OptionalHeader.Subsystem = TEImageHeader->Subsystem;
|
||||||
PeHdr->OptionalHeader.SizeOfImage = Pe32ImageSize;
|
PeHdr->OptionalHeader.SizeOfImage = Pe32ImageSize;
|
||||||
|
@ -907,11 +915,11 @@ Returns:
|
||||||
//
|
//
|
||||||
PeHdr = (VOID *) ((UINTN) ImageAddress + ImageContext.PeCoffHeaderOffset);
|
PeHdr = (VOID *) ((UINTN) ImageAddress + ImageContext.PeCoffHeaderOffset);
|
||||||
if (PeHdr->FileHeader.Machine == EFI_IMAGE_MACHINE_IA32) {
|
if (PeHdr->FileHeader.Machine == EFI_IMAGE_MACHINE_IA32) {
|
||||||
PeHdrSizeOfImage = (UINT32 *) (&(*(EFI_IMAGE_OPTIONAL_HEADER32 *) &PeHdr->OptionalHeader).SizeOfImage);
|
PeHdrSizeOfImage = (UINT32 *) (&(*(EFI_IMAGE_OPTIONAL_HEADER32 *) &PeHdr->OptionalHeader).SizeOfImage);
|
||||||
PeHdrChecksum = (UINT32 *) (&(*(EFI_IMAGE_OPTIONAL_HEADER32 *) &PeHdr->OptionalHeader).CheckSum);
|
PeHdrChecksum = (UINT32 *) (&(*(EFI_IMAGE_OPTIONAL_HEADER32 *) &PeHdr->OptionalHeader).CheckSum);
|
||||||
} else if (PeHdr->FileHeader.Machine == EFI_IMAGE_MACHINE_IA64) {
|
} else if (PeHdr->FileHeader.Machine == EFI_IMAGE_MACHINE_IA64) {
|
||||||
PeHdrSizeOfImage = (UINT32 *) (&(*(EFI_IMAGE_OPTIONAL_HEADER64 *) &PeHdr->OptionalHeader).SizeOfImage);
|
PeHdrSizeOfImage = (UINT32 *) (&(*(EFI_IMAGE_OPTIONAL_HEADER64 *) &PeHdr->OptionalHeader).SizeOfImage);
|
||||||
PeHdrChecksum = (UINT32 *) (&(*(EFI_IMAGE_OPTIONAL_HEADER64 *) &PeHdr->OptionalHeader).CheckSum);
|
PeHdrChecksum = (UINT32 *) (&(*(EFI_IMAGE_OPTIONAL_HEADER64 *) &PeHdr->OptionalHeader).CheckSum);
|
||||||
} else {
|
} else {
|
||||||
Error (
|
Error (
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -942,12 +950,18 @@ Returns:
|
||||||
sizeof (EFI_TE_IMAGE_HEADER)
|
sizeof (EFI_TE_IMAGE_HEADER)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get EntryPoint in Flash Region.
|
||||||
|
//
|
||||||
|
EntryPoint = NewPe32BaseAddress + EntryPoint - ImageAddress;
|
||||||
|
|
||||||
//
|
//
|
||||||
// If a map file was selected output mapping information for any file that
|
// If a map file was selected output mapping information for any file that
|
||||||
// was rebased.
|
// was rebased.
|
||||||
//
|
//
|
||||||
if (MapFile != NULL) {
|
if (MapFile != NULL) {
|
||||||
fprintf (MapFile, "TE File: %s Base:%08lx", FileGuidString, BaseAddress);
|
fprintf (MapFile, "TE File: %s Base:%08lx", FileGuidString, BaseAddress);
|
||||||
|
fprintf (MapFile, " EntryPoint:%08lx", EntryPoint);
|
||||||
if (ImageContext.PdbPointer != NULL) {
|
if (ImageContext.PdbPointer != NULL) {
|
||||||
fprintf (MapFile, " FileName: %s", ImageContext.PdbPointer);
|
fprintf (MapFile, " FileName: %s", ImageContext.PdbPointer);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue