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
This commit is contained in:
Liming Gao 2014-01-02 02:38:32 +00:00 committed by lgao4
parent 91403ce938
commit d958a7e0bc
1 changed files with 2 additions and 2 deletions

View File

@ -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.