:: commit 524b34d149eb37bc26a8f9aa9b7fb8cd04547112

mintsuki <mintsuki@protonmail.com> — 2024-10-28 08:56

parents: ab6971b1b8

Revert "protos/limine: Optimisation of the memory map before pagemap build"

This reverts commit f379a9157dc85cd913e7868770980490f6c20f17.
diff --git a/common/mm/pmm.h b/common/mm/pmm.h
index 358507e3..67b47b41 100644
--- a/common/mm/pmm.h
+++ b/common/mm/pmm.h
@@ -71,6 +71,4 @@ void pmm_sanitise_entries(struct memmap_entry *m, size_t *_count, bool align_ent
 
 extern bool pmm_sanitiser_keep_first_page;
 
-void pmm_reclaim_uefi_mem(struct memmap_entry *m, size_t *_count);
-
 #endif
diff --git a/common/mm/pmm.s2.c b/common/mm/pmm.s2.c
index d5d9b74c..58faac50 100644
--- a/common/mm/pmm.s2.c
+++ b/common/mm/pmm.s2.c
@@ -230,6 +230,10 @@ del_mm1:
     *_count = count;
 }
 
+#if defined (UEFI)
+static void pmm_reclaim_uefi_mem(struct memmap_entry *m, size_t *_count);
+#endif
+
 struct memmap_entry *get_memmap(size_t *entries) {
 #if defined (UEFI)
     if (efi_boot_services_exited == false) {
@@ -427,7 +431,7 @@ fail:
     panic(false, "pmm: Failure initialising memory map");
 }
 
-void pmm_reclaim_uefi_mem(struct memmap_entry *m, size_t *_count) {
+static void pmm_reclaim_uefi_mem(struct memmap_entry *m, size_t *_count) {
     size_t count = *_count;
 
     size_t recl_i = 0;
@@ -491,6 +495,8 @@ void pmm_reclaim_uefi_mem(struct memmap_entry *m, size_t *_count) {
         }
     }
 
+    allocations_disallowed = true;
+
     pmm_sanitise_entries(m, &count, false);
 
     *_count = count;
diff --git a/common/protos/limine.c b/common/protos/limine.c
index 182baf0c..66fbebf1 100644
--- a/common/protos/limine.c
+++ b/common/protos/limine.c
@@ -1382,10 +1382,6 @@ FEAT_END
         pmm_sanitise_entries(memmap, &memmap_entries, true);
     }
 
-#if defined (UEFI)
-    pmm_reclaim_uefi_mem(memmap, &memmap_entries);
-#endif
-
     pagemap_t pagemap = {0};
     pagemap = build_pagemap(base_revision, nx_available, ranges, ranges_count,
                             physical_base, virtual_base, direct_map_offset);
tab: 248 wrap: offon