Revision: 17063
          http://sourceforge.net/p/edk2/code/17063
Author:   lzeng14
Date:     2015-03-18 08:47:47 +0000 (Wed, 18 Mar 2015)
Log Message:
-----------
MdeModulePkg BootScriptExecutorDxe: Use ImageContext.ImageSize to allocate 
memory for PE image

to handle the case PE file alignment is not same as PE section alignment.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <[email protected]>
Reviewed-by: Jiewen Yao <[email protected]>

Modified Paths:
--------------
    trunk/edk2/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.c

Modified: 
trunk/edk2/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.c
===================================================================
--- 
trunk/edk2/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.c    
    2015-03-18 02:53:09 UTC (rev 17062)
+++ 
trunk/edk2/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.c    
    2015-03-18 08:47:47 UTC (rev 17063)
@@ -4,7 +4,7 @@
   This driver is dispatched by Dxe core and the driver will reload itself to 
ACPI reserved memory
   in the entry point. The functionality is to interpret and restore the S3 
boot script
 
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
 
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
@@ -307,7 +307,11 @@
   //
   Status = PeCoffLoaderGetImageInfo (&ImageContext);
   ASSERT_EFI_ERROR (Status);
-  Pages = EFI_SIZE_TO_PAGES(BufferSize + ImageContext.SectionAlignment);
+  if (ImageContext.SectionAlignment > EFI_PAGE_SIZE) {
+    Pages = EFI_SIZE_TO_PAGES (ImageContext.ImageSize + 
ImageContext.SectionAlignment);
+  } else {
+    Pages = EFI_SIZE_TO_PAGES (ImageContext.ImageSize);
+  }
   FfsBuffer = 0xFFFFFFFF;
   Status = gBS->AllocatePages (
                   AllocateMaxAddress,


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to