mirror of https://github.com/acidanthera/audk.git
Fix PeiLoadImage() for compressed peim to print the correct image address and entrypoint.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1467 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
701d95b339
commit
7c9e5810d0
|
@ -105,10 +105,10 @@ Returns:
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Got the entry point from ImageEntryPoint
|
// Got the entry point from ImageEntryPoint and ImageStartAddress
|
||||||
//
|
//
|
||||||
|
Pe32Data = (VOID *) ((UINTN) ImageAddress);
|
||||||
*EntryPoint = (VOID *) ((UINTN) ImageEntryPoint);
|
*EntryPoint = (VOID *) ((UINTN) ImageEntryPoint);
|
||||||
return EFI_SUCCESS;
|
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// Retrieve the entry point from the TE image header
|
// Retrieve the entry point from the TE image header
|
||||||
|
@ -171,23 +171,27 @@ Returns:
|
||||||
// is present in the image. You have to check the NumberOfRvaAndSizes in
|
// is present in the image. You have to check the NumberOfRvaAndSizes in
|
||||||
// the optional header to verify a desired directory entry is there.
|
// the optional header to verify a desired directory entry is there.
|
||||||
//
|
//
|
||||||
DebugEntry = NULL;
|
DebugEntry = NULL;
|
||||||
DirectoryEntry = NULL;
|
DirectoryEntry = NULL;
|
||||||
TEImageAdjust = 0;
|
NumberOfRvaAndSizes = 0;
|
||||||
|
TEImageAdjust = 0;
|
||||||
|
|
||||||
if (TEImageHeader == NULL) {
|
if (TEImageHeader == NULL) {
|
||||||
if (Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
|
if (Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
|
||||||
//
|
//
|
||||||
// Use PE32 offset
|
// Use PE32 offset get Debug Directory Entry
|
||||||
//
|
//
|
||||||
NumberOfRvaAndSizes = Hdr.Pe32->OptionalHeader.NumberOfRvaAndSizes;
|
NumberOfRvaAndSizes = Hdr.Pe32->OptionalHeader.NumberOfRvaAndSizes;
|
||||||
DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
|
DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
|
||||||
} else {
|
DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *) ((UINTN) Pe32Data + DirectoryEntry->VirtualAddress);
|
||||||
|
} else if (Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
|
||||||
//
|
//
|
||||||
// Use PE32+ offset
|
// Use PE32+ offset get Debug Directory Entry
|
||||||
//
|
//
|
||||||
NumberOfRvaAndSizes = Hdr.Pe32Plus->OptionalHeader.NumberOfRvaAndSizes;
|
NumberOfRvaAndSizes = Hdr.Pe32Plus->OptionalHeader.NumberOfRvaAndSizes;
|
||||||
DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
|
DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
|
||||||
}
|
DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *) ((UINTN) Pe32Data + DirectoryEntry->VirtualAddress);
|
||||||
|
}
|
||||||
|
|
||||||
if (NumberOfRvaAndSizes <= EFI_IMAGE_DIRECTORY_ENTRY_DEBUG) {
|
if (NumberOfRvaAndSizes <= EFI_IMAGE_DIRECTORY_ENTRY_DEBUG) {
|
||||||
DirectoryEntry = NULL;
|
DirectoryEntry = NULL;
|
||||||
|
|
Loading…
Reference in New Issue