/* This buffer is required to safely transfer AP from real address mode to protected mode or long mode, due to the fact that the buffer returned by  */
UINTN AllocateCodeBuffer(IN UINTN BufferSize)
/* This buffer is required to safely transfer AP from real address mode to protected mode or long mode, due to the fact that the buffer returned by  */
UINTN AllocateCodeBuffer(IN UINTN BufferSize)
{
  EFI_STATUS            Status;
  EFI_PHYSICAL_ADDRESS  Address;
  Status = PeiServicesAllocatePages (EfiBootServicesCode, EFI_SIZE_TO_PAGES (BufferSize), &Address);
  if (EFI_ERROR (Status)) {
    Address = 0;
  }
  return (UINTN)Address;
}