Correct TeImage Header based on PeiCis spec.
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 15 Jan 2007 11:24:23 +0000 (11:24 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 15 Jan 2007 11:24:23 +0000 (11:24 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2250 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Library/BasePeCoffLib/BasePeCoff.c
Tools/CCode/Source/PeCoffLoader/BasePeCoff.c

index f16ea90..cce9a82 100644 (file)
@@ -299,7 +299,7 @@ PeCoffLoaderGetImageInfo (
       ImageContext->ImageAddress = Hdr.Pe32Plus->OptionalHeader.ImageBase;\r
     }\r
   } else {\r
-    ImageContext->ImageAddress = (PHYSICAL_ADDRESS)(Hdr.Te->ImageBase + sizeof (EFI_TE_IMAGE_HEADER) - Hdr.Te->StrippedSize);\r
+    ImageContext->ImageAddress = (PHYSICAL_ADDRESS)(Hdr.Te->ImageBase + Hdr.Te->StrippedSize - sizeof (EFI_TE_IMAGE_HEADER));\r
   }\r
 \r
   //\r
index f2053b7..72df90f 100644 (file)
@@ -260,7 +260,7 @@ Returns:
   if (!(ImageContext->IsTeImage)) {\r
     ImageContext->ImageAddress = PeHdr.OptionalHeader.ImageBase;\r
   } else {\r
-    ImageContext->ImageAddress = (PHYSICAL_ADDRESS) (TeHdr.ImageBase + sizeof (EFI_TE_IMAGE_HEADER) - TeHdr.StrippedSize);\r
+    ImageContext->ImageAddress = (PHYSICAL_ADDRESS) (TeHdr.ImageBase + TeHdr.StrippedSize - sizeof (EFI_TE_IMAGE_HEADER));\r
   }\r
   //\r
   // Initialize the alternate destination address to 0 indicating that it\r