misc: Dynamically allocate EFI memmap copy
This commit is contained in:
parent
15737894cb
commit
42cc1d8e20
|
@ -111,8 +111,6 @@ uint32_t hex2bin(uint8_t *str, uint32_t size) {
|
||||||
|
|
||||||
no_unwind bool efi_boot_services_exited = false;
|
no_unwind bool efi_boot_services_exited = false;
|
||||||
|
|
||||||
#define EFI_COPY_MAX_ENTRIES 2048
|
|
||||||
|
|
||||||
bool efi_exit_boot_services(void) {
|
bool efi_exit_boot_services(void) {
|
||||||
EFI_STATUS status;
|
EFI_STATUS status;
|
||||||
|
|
||||||
|
@ -134,6 +132,14 @@ bool efi_exit_boot_services(void) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EFI_MEMORY_DESCRIPTOR *efi_copy;
|
||||||
|
status = gBS->AllocatePool(EfiLoaderData, efi_mmap_size * 2, (void **)&efi_copy);
|
||||||
|
if (status) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
const size_t EFI_COPY_MAX_ENTRIES = (efi_mmap_size * 2) / efi_desc_size;
|
||||||
|
|
||||||
size_t retries = 0;
|
size_t retries = 0;
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
|
@ -163,7 +169,6 @@ retry:
|
||||||
// Go through new EFI memmap and free up bootloader entries
|
// Go through new EFI memmap and free up bootloader entries
|
||||||
size_t entry_count = efi_mmap_size / efi_desc_size;
|
size_t entry_count = efi_mmap_size / efi_desc_size;
|
||||||
|
|
||||||
EFI_MEMORY_DESCRIPTOR *efi_copy = ext_mem_alloc(EFI_COPY_MAX_ENTRIES * efi_desc_size);
|
|
||||||
size_t efi_copy_i = 0;
|
size_t efi_copy_i = 0;
|
||||||
|
|
||||||
for (size_t i = 0; i < entry_count; i++) {
|
for (size_t i = 0; i < entry_count; i++) {
|
||||||
|
|
Loading…
Reference in New Issue