Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • boot/genarch/src/efi.c

    r09ab0a9a r84176f3  
    4242        return NULL;
    4343}
     44
     45efi_status_t efi_get_memory_map(efi_system_table_t *st,
     46    sysarg_t *memory_map_size, efi_v1_memdesc_t **memory_map, sysarg_t *map_key,
     47    sysarg_t *descriptor_size, uint32_t *descriptor_version)
     48{
     49        efi_status_t status;
     50
     51        *memory_map_size = 8 * sizeof(**memory_map);
     52
     53        do {
     54                /* Allocate space for the memory map. */
     55                status = st->boot_services->allocate_pool(EFI_LOADER_DATA,
     56                    *memory_map_size, (void **) memory_map);
     57                if (status != EFI_SUCCESS)
     58                        return status;
     59
     60                /* Try to obtain the map. */
     61                status = st->boot_services->get_memory_map(memory_map_size,
     62                    *memory_map, map_key, descriptor_size, descriptor_version);
     63                if (status == EFI_SUCCESS)
     64                        return status;
     65
     66                /* An error occurred, release the allocated memory. */
     67                st->boot_services->free_pool(*memory_map);
     68        } while (status == EFI_BUFFER_TOO_SMALL);
     69
     70        return status;
     71}
Note: See TracChangeset for help on using the changeset viewer.