:: commit 1af09d074929b6f4b73b5bfcf2c1aba897cb3d0f

mintsuki <mintsuki@protonmail.com> — 2022-04-19 20:28

parents: 8cb61a95d2

mm/efi: Fix issue where in-use bootloader memory may be erroneously allocated

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;
tab: 248 wrap: offon