/* This function allocates memory below 4G memory address. */
VOID* AllocateMemoryBelow4G(IN EFI_MEMORY_TYPE MemoryType, IN UINTN Size)
/* This function allocates memory below 4G memory address. */
VOID* AllocateMemoryBelow4G(IN EFI_MEMORY_TYPE MemoryType, IN UINTN Size)
{
  UINTN                 Pages;
  EFI_PHYSICAL_ADDRESS  Address;
  EFI_STATUS            Status;
  VOID                  *Buffer;
  Pages   = EFI_SIZE_TO_PAGES (Size);
  Address = 0xffffffff;
  Status = gBS->AllocatePages (
                  AllocateMaxAddress,
                  MemoryType,
                  Pages,
                  &Address
                  );
  ASSERT_EFI_ERROR (Status);
  Buffer = (VOID *)(UINTN)Address;
  ZeroMem (Buffer, Size);
  return Buffer;
}