From 5526de2dd3bd2e16451f35ddc5c6ce6a1ca1c79d Mon Sep 17 00:00:00 2001 From: mintsuki Date: Tue, 19 Apr 2022 22:28:21 +0200 Subject: [PATCH] mm/efi: Fix issue where in-use bootloader memory may be erroneously allocated --- common/lib/blib.c | 2 -- common/mm/pmm.s2.c | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/common/lib/blib.c b/common/lib/blib.c index 0f2a84fd..a14e8c79 100644 --- a/common/lib/blib.c +++ b/common/lib/blib.c @@ -213,8 +213,6 @@ retry: asm volatile ("cli" ::: "memory"); - pmm_reclaim_uefi_mem(); - // Go through new EFI memmap and free up bootloader entries size_t entry_count = efi_mmap_size / efi_desc_size; diff --git a/common/mm/pmm.s2.c b/common/mm/pmm.s2.c index 2b6e5dbb..d2ade3ef 100644 --- a/common/mm/pmm.s2.c +++ b/common/mm/pmm.s2.c @@ -226,6 +226,9 @@ del_mm1: } struct e820_entry_t *get_memmap(size_t *entries) { +#if uefi == 1 + pmm_reclaim_uefi_mem(); +#endif sanitise_entries(memmap, &memmap_entries, true); *entries = memmap_entries;