]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Pei/Memory/MemoryServices.c
Correct description for return status code of PEI service AllocatePages(), according...
[mirror_edk2.git] / MdeModulePkg / Core / Pei / Memory / MemoryServices.c
index 02e83a18fc8543af6f393c9f4519991beeeb8b48..7e1bb55242cc9f1448c9b65ff6fa86f01077c065 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   EFI PEI Core memory services\r
   \r
-Copyright (c) 2006, Intel Corporation                                                         \r
+Copyright (c) 2006 - 2010, Intel Corporation                                                         \r
 All rights reserved. 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
@@ -52,9 +52,9 @@ InitializeMemoryServices (
       );\r
 \r
     //\r
-    // Set PS to point to ServiceTableShadow in Cache\r
+    // Set Ps to point to ServiceTableShadow in Cache\r
     //\r
-    PrivateData->PS = &(PrivateData->ServiceTableShadow);\r
+    PrivateData->Ps = &(PrivateData->ServiceTableShadow);\r
   }\r
   \r
   return;\r
@@ -149,7 +149,7 @@ PeiAllocatePages (
   //\r
   if (!PrivateData->PeiMemoryInstalled) {\r
     //\r
-    // When PeiInstallMemory is called but CAR has *not* been moved to temporary memory,\r
+    // When PeiInstallMemory is called but temporary memory has *not* been moved to temporary memory,\r
     // the AllocatePage will depend on the field of PEI_CORE_INSTANCE structure.\r
     //\r
     if (!PrivateData->SwitchStackSignal) {\r
@@ -207,7 +207,7 @@ PeiAllocatePages (
 /**\r
 \r
   Pool allocation service. Before permenent memory is discoveried, the pool will \r
-  be allocated the heap in the CAR. Genenrally, the size of heap in temporary \r
+  be allocated the heap in the temporary memory. Genenrally, the size of heap in temporary \r
   memory does not exceed to 64K, so the biggest pool size could be allocated is \r
   64K.\r
 \r
@@ -240,7 +240,10 @@ PeiAllocatePool (
   // 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
   //\r
-  ASSERT (Size < 0x10000 - sizeof (EFI_HOB_MEMORY_POOL));\r
+  if (Size >= (0x10000 - sizeof (EFI_HOB_MEMORY_POOL))) {\r
+    return EFI_OUT_OF_RESOURCES;\r
+  }\r
+  \r
   Status = PeiServicesCreateHob (\r
              EFI_HOB_TYPE_MEMORY_POOL,\r
              (UINT16)(sizeof (EFI_HOB_MEMORY_POOL) + Size),\r