summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiming Gao <liming.gao@intel.com>2014-01-02 02:38:32 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2014-01-02 02:38:32 +0000
commitd958a7e0bca33102c27eaa86b07de196b7bba098 (patch)
tree2f735eec49d37f6380d8601d7e376bc2c752a3eb
parent91403ce938695e2ea2f27ac1ce796812a0aa22e8 (diff)
downloadedk2-d958a7e0bca33102c27eaa86b07de196b7bba098.tar.gz
edk2-d958a7e0bca33102c27eaa86b07de196b7bba098.tar.bz2
edk2-d958a7e0bca33102c27eaa86b07de196b7bba098.zip
Correct the RemainingPages calculation in PEI AllocatePages service.
Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15035 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Core/Pei/Memory/MemoryServices.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/MdeModulePkg/Core/Pei/Memory/MemoryServices.c b/MdeModulePkg/Core/Pei/Memory/MemoryServices.c
index c7a06a3c52..10f21d5628 100644
--- a/MdeModulePkg/Core/Pei/Memory/MemoryServices.c
+++ b/MdeModulePkg/Core/Pei/Memory/MemoryServices.c
@@ -1,7 +1,7 @@
/** @file
EFI PEI Core memory services
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2014, 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
@@ -182,7 +182,7 @@ PeiAllocatePages (
//
// Verify that there is sufficient memory to satisfy the allocation
//
- RemainingPages = EFI_SIZE_TO_PAGES ((UINTN) (*FreeMemoryTop - *FreeMemoryBottom));
+ RemainingPages = (UINTN)(*FreeMemoryTop - *FreeMemoryBottom) >> EFI_PAGE_SHIFT;
//
// For page allocation, the overhead sizeof (EFI_HOB_MEMORY_ALLOCATION) needs one extra page.
// So the number of remaining pages needs to be greater than that of the request pages.