diff --git a/MdeModulePkg/Core/Pei/Memory/MemoryServices.c b/MdeModulePkg/Core/Pei/Memory/MemoryServices.c index 65e3405e9c..562092df70 100644 --- a/MdeModulePkg/Core/Pei/Memory/MemoryServices.c +++ b/MdeModulePkg/Core/Pei/Memory/MemoryServices.c @@ -638,7 +638,7 @@ PeiAllocatePages ( // Verify that there is sufficient memory to satisfy the allocation. // RemainingMemory = (UINTN)(*FreeMemoryTop - *FreeMemoryBottom); - RemainingPages = RemainingMemory >> EFI_PAGE_SHIFT; + RemainingPages = (UINTN)(RShiftU64 (RemainingMemory, EFI_PAGE_SHIFT)); // // The number of remaining pages needs to be greater than or equal to that of // the request pages. In addition, there should be enough space left to hold a