@retval 0 Cannot find free memory below 4GB.\r
**/\r
UINTN\r
-GetModeTransitionBuffer (\r
+AllocateCodeBuffer (\r
IN UINTN BufferSize\r
)\r
{\r
- //\r
- // PEI phase doesn't need to do such transition. So simply return 0.\r
- //\r
- return 0;\r
+ EFI_STATUS Status;\r
+ EFI_PHYSICAL_ADDRESS Address;\r
+\r
+ Status = PeiServicesAllocatePages (EfiBootServicesCode, EFI_SIZE_TO_PAGES (BufferSize), &Address);\r
+ if (EFI_ERROR (Status)) {\r
+ Address = 0;\r
+ }\r
+\r
+ return (UINTN)Address;\r
}\r
\r
/**\r