diff options
author | Star Zeng <star.zeng@intel.com> | 2015-03-18 08:49:21 +0000 |
---|---|---|
committer | lzeng14 <lzeng14@Edk2> | 2015-03-18 08:49:21 +0000 |
commit | c4b90c071d55dc75d2f6d47de1e11f3018fc2907 (patch) | |
tree | 92d88fe8f5983aa5cf7c243483c45acfe3aa8ae1 | |
parent | 32a81741dbc91c041ca57d600526ca9c088440ff (diff) | |
download | edk2-platforms-c4b90c071d55dc75d2f6d47de1e11f3018fc2907.tar.xz |
EdkCompatibilityPkg: 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 <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17064 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/ScriptSave.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/ScriptSave.c b/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/ScriptSave.c index 4d1013caf0..03e7ea60c3 100644 --- a/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/ScriptSave.c +++ b/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/ScriptSave.c @@ -2,7 +2,7 @@ Implementation for S3 Boot Script Save thunk driver.
This thunk driver consumes PI S3SaveState protocol to produce framework S3BootScriptSave Protocol
- Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 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
which accompanies this distribution. The full text of the license may be found at
@@ -899,7 +899,11 @@ InitializeScriptSaveOnS3SaveState ( ASSERT_EFI_ERROR (Status);
MemoryAddress = SIZE_4GB - 1;
- PageNumber = EFI_SIZE_TO_PAGES (BufferSize + ImageContext.SectionAlignment);
+ if (ImageContext.SectionAlignment > EFI_PAGE_SIZE) {
+ PageNumber = EFI_SIZE_TO_PAGES (ImageContext.ImageSize + ImageContext.SectionAlignment);
+ } else {
+ PageNumber = EFI_SIZE_TO_PAGES (ImageContext.ImageSize);
+ }
Status = gBS->AllocatePages (
AllocateMaxAddress,
EfiReservedMemoryType,
|