{
}
-static void *__init efi_arch_allocate_mmap_buffer(UINTN *map_size)
+static void *__init efi_arch_allocate_mmap_buffer(UINTN map_size)
{
void *ptr;
EFI_STATUS status;
- UINTN map_size_alloc = *map_size + EFI_PAGE_SIZE;
- status = efi_bs->AllocatePool(EfiLoaderData, map_size_alloc, &ptr);
+ status = efi_bs->AllocatePool(EfiLoaderData, map_size, &ptr);
if ( status != EFI_SUCCESS )
return NULL;
- *map_size = map_size_alloc;
return ptr;
}
}
-static void *__init efi_arch_allocate_mmap_buffer(UINTN *map_size)
+static void *__init efi_arch_allocate_mmap_buffer(UINTN map_size)
{
place_string(&mbi.mem_upper, NULL);
- mbi.mem_upper -= *map_size;
+ mbi.mem_upper -= map_size;
mbi.mem_upper &= -__alignof__(EFI_MEMORY_DESCRIPTOR);
if ( mbi.mem_upper < xen_phys_start )
return NULL;
EFI_STATUS status;
unsigned int i, argc;
CHAR16 **argv, *file_name, *cfg_file_name = NULL, *options = NULL;
- UINTN map_key, info_size, gop_mode = ~0;
+ UINTN map_alloc_size, map_key, info_size, gop_mode = ~0;
EFI_HANDLE *handles = NULL;
EFI_SHIM_LOCK_PROTOCOL *shim_lock;
EFI_GRAPHICS_OUTPUT_PROTOCOL *gop = NULL;
efi_arch_video_init(gop, info_size, mode_info);
}
- efi_bs->GetMemoryMap(&efi_memmap_size, NULL, &map_key,
+ efi_bs->GetMemoryMap(&map_alloc_size, NULL, &map_key,
&efi_mdesc_size, &mdesc_ver);
- efi_memmap = efi_arch_allocate_mmap_buffer(&efi_memmap_size);
+ map_alloc_size += 8 * efi_mdesc_size;
+ efi_memmap = efi_arch_allocate_mmap_buffer(map_alloc_size);
if ( !efi_memmap )
blexit(L"Unable to allocate memory for EFI memory map");
for ( retry = 0; ; retry = 1 )
{
+ efi_memmap_size = map_alloc_size;
status = efi_bs->GetMemoryMap(&efi_memmap_size, efi_memmap, &map_key,
&efi_mdesc_size, &mdesc_ver);
if ( EFI_ERROR(status) )