From d958a7e0bca33102c27eaa86b07de196b7bba098 Mon Sep 17 00:00:00 2001 From: Liming Gao Date: Thu, 2 Jan 2014 02:38:32 +0000 Subject: Correct the RemainingPages calculation in PEI AllocatePages service. Signed-off-by: Liming Gao Reviewed-by: Star Zeng git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15035 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/Pei/Memory/MemoryServices.c | 4 ++-- 1 file 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.
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
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. -- cgit v1.2.3