From 4e844595f27ba8031b1b72fb3e3ab16bcf246ebc Mon Sep 17 00:00:00 2001 From: lgao4 Date: Mon, 22 Oct 2007 10:41:03 +0000 Subject: Fix alignment requirement when Load IPF TeImage into memory. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4197 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/Pei/Image/Image.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'MdeModulePkg/Core/Pei/Image/Image.c') diff --git a/MdeModulePkg/Core/Pei/Image/Image.c b/MdeModulePkg/Core/Pei/Image/Image.c index c13a869d2c..c9805f5311 100644 --- a/MdeModulePkg/Core/Pei/Image/Image.c +++ b/MdeModulePkg/Core/Pei/Image/Image.c @@ -242,6 +242,15 @@ Returns: // ImageContext.ImageAddress = (EFI_PHYSICAL_ADDRESS)(UINTN) AllocatePages (EFI_SIZE_TO_PAGES ((UINT32) ImageContext.ImageSize)); ASSERT (ImageContext.ImageAddress != 0); + + // + // Skip the reserved space for the stripped PeHeader when load TeImage into memory. + // + if (ImageContext.IsTeImage) { + ImageContext.ImageAddress = ImageContext.ImageAddress + + ((EFI_TE_IMAGE_HEADER *) Pe32Data)->StrippedSize - + sizeof (EFI_TE_IMAGE_HEADER); + } // // Load the image to our new buffer -- cgit v1.2.3