From 3dfcd913eb6252dc7327c6c1aaa1fa87fba7eaac Mon Sep 17 00:00:00 2001 From: Maurice Ma Date: Fri, 12 Apr 2019 09:40:01 -0700 Subject: [PATCH] Fix incorrect image base for TE image TE image has stripped header to reduce the image size. When calculating the preferred base for TE image, the gap should be added back in order to match the actual TE image base. This patch fixed #133. Signed-off-by: Maurice Ma --- BootloaderCommonPkg/Library/LitePeCoffLib/LitePeCoffLib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BootloaderCommonPkg/Library/LitePeCoffLib/LitePeCoffLib.c b/BootloaderCommonPkg/Library/LitePeCoffLib/LitePeCoffLib.c index 1b8bd70b..526b096b 100644 --- a/BootloaderCommonPkg/Library/LitePeCoffLib/LitePeCoffLib.c +++ b/BootloaderCommonPkg/Library/LitePeCoffLib/LitePeCoffLib.c @@ -292,7 +292,7 @@ PeCoffGetPreferredBase ( // Common for PE32 & PE32+ // if (Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) { - ImageBase = (UINT32)Hdr.Te->ImageBase; + ImageBase = (UINT32)Hdr.Te->ImageBase + Hdr.Te->StrippedSize - sizeof (EFI_TE_IMAGE_HEADER); } else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) { ImageBase = Hdr.Pe32->OptionalHeader.ImageBase; } else {