History

efi/libstub: Allocate headspace in efi_get_memory_map()

efi_get_memory_map() allocates a buffer to store the memory map that it retrieves. This buffer may need to be reused by the client after ExitBootServices() is called, at which point allocations are not longer permitted. To support this usecase, provide the allocated buffer size back to the client, and allocate some additional headroom to account for any reasonable growth in the map that is likely to happen between the call to efi_get_memory_map() and the client reusing the buffer.

Jeffrey Hugo committed 10 years ago

Commit dadb57a1 parent 4af9ed55 files · +111 −49Browse files

Showing the changes to include/linux (1 of 5 files). Show all

Unified · Split

include/linux/efi.h+10−5
@@ -118,6 +118,15 @@ typedef struct { · 117 unmodified lines
118118 u32 imagesize;
119119 } efi_capsule_header_t;
120120
121+struct efi_boot_memmap {
122+ efi_memory_desc_t **map;
123+ unsigned long *map_size;
124+ unsigned long *desc_size;
125+ u32 *desc_ver;
126+ unsigned long *key_ptr;
127+ unsigned long *buff_size;
128+};
129+
121130 /*
122131 * EFI capsule flags
123132 */
@@ -1371,11 +1380,7 @@ char *efi_convert_cmdline(efi_system_table_t *sys_table_arg, · 1247 unmodified lines
13711380 efi_loaded_image_t *image, int *cmd_line_len);
13721381
13731382 efi_status_t efi_get_memory_map(efi_system_table_t *sys_table_arg,
1374− efi_memory_desc_t **map,
1375− unsigned long *map_size,
1376− unsigned long *desc_size,
1377− u32 *desc_ver,
1378− unsigned long *key_ptr);
1383+ struct efi_boot_memmap *map);
13791384
13801385 efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg,
13811386 unsigned long size, unsigned long align,