/** @file\r
EFI PEI Core memory services\r
\r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials \r
are licensed and made available under the terms and conditions of the BSD License \r
which accompanies this distribution. The full text of the license may be found at \r
//\r
// Verify that there is sufficient memory to satisfy the allocation\r
//\r
- RemainingPages = EFI_SIZE_TO_PAGES ((UINTN) (*FreeMemoryTop - *FreeMemoryBottom));\r
+ RemainingPages = (UINTN)(*FreeMemoryTop - *FreeMemoryBottom) >> EFI_PAGE_SHIFT;\r
//\r
// For page allocation, the overhead sizeof (EFI_HOB_MEMORY_ALLOCATION) needs one extra page.\r
// So the number of remaining pages needs to be greater than that of the request pages.\r
\r
//\r
// Generally, the size of heap in temporary memory does not exceed to 64K,\r
- // so the maxmium size of pool is 0x10000 - sizeof (EFI_HOB_MEMORY_POOL)\r
+ // HobLength is multiples of 8 bytes, so the maxmium size of pool is 0xFFF8 - sizeof (EFI_HOB_MEMORY_POOL)\r
//\r
- if (Size >= (0x10000 - sizeof (EFI_HOB_MEMORY_POOL))) {\r
+ if (Size > (0xFFF8 - sizeof (EFI_HOB_MEMORY_POOL))) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
(UINT16)(sizeof (EFI_HOB_MEMORY_POOL) + Size),\r
(VOID **)&Hob\r
);\r
+ ASSERT_EFI_ERROR (Status);\r
*Buffer = Hob+1; \r
\r
return Status;\r