diff options
author | ajfish <ajfish@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-08-11 18:04:56 +0000 |
---|---|---|
committer | ajfish <ajfish@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-08-11 18:04:56 +0000 |
commit | 317f832ef8bcf89c59e2e6cc9484989649022477 (patch) | |
tree | e4a2c1317aa81add0c399024678d820b200a8b7a /MdePkg/Library | |
parent | b48e3710a532f2e76411b11900bcd03122dfd36c (diff) | |
download | edk2-platforms-317f832ef8bcf89c59e2e6cc9484989649022477.tar.xz |
Fixed bugs found when this code was ported into R8.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1240 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library')
-rw-r--r-- | MdePkg/Library/BasePeCoffLib/BasePeCoff.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c index ebc3b3cc6c..eee4dc713f 100644 --- a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c +++ b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c @@ -610,7 +610,7 @@ PeCoffLoaderRelocateImage ( }
} else {
Hdr.Te = (EFI_TE_IMAGE_HEADER *)(UINTN)(ImageContext->ImageAddress);
- Adjust = (UINT64) (BaseAddress - Hdr.Te->ImageBase);
+ Adjust = (UINT64) (BaseAddress - Hdr.Te->ImageBase);
Hdr.Te->ImageBase = (UINT64) (BaseAddress);
//
@@ -1200,13 +1200,13 @@ PeCoffLoaderRelocateImageForRuntime ( // Use PE32 offset
//
NumberOfRvaAndSizes = Hdr.Pe32->OptionalHeader.NumberOfRvaAndSizes;
- DataDirectory = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
+ DataDirectory = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32->OptionalHeader.DataDirectory[0]);
} else {
//
// Use PE32+ offset
//
NumberOfRvaAndSizes = Hdr.Pe32Plus->OptionalHeader.NumberOfRvaAndSizes;
- DataDirectory = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
+ DataDirectory = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32Plus->OptionalHeader.DataDirectory[0]);
}
//
@@ -1258,7 +1258,7 @@ PeCoffLoaderRelocateImageForRuntime ( case EFI_IMAGE_REL_BASED_HIGH:
F16 = (UINT16 *) Fixup;
if (*(UINT16 *) FixupData == *F16) {
- *F16 = (UINT16) ((*F16 << 16) + ((UINT16) Adjust & 0xffff));
+ *F16 = (UINT16) (*F16 + ((UINT16)(Adjust >> 16)));
}
FixupData = FixupData + sizeof (UINT16);
@@ -1286,9 +1286,11 @@ PeCoffLoaderRelocateImageForRuntime ( case EFI_IMAGE_REL_BASED_DIR64:
F64 = (UINT64 *)Fixup;
FixupData = ALIGN_POINTER (FixupData, sizeof (UINT64));
- if (*(UINT32 *) FixupData == *F64) {
+ if (*(UINT64 *) FixupData == *F64) {
*F64 = *F64 + (UINT64)Adjust;
}
+
+ FixupData = FixupData + sizeof (UINT64);
break;
case EFI_IMAGE_REL_BASED_HIGHADJ:
|