protos/limine: Optimisation of the memory map before pagemap build
diff --git a/common/mm/pmm.h b/common/mm/pmm.h
index 67b47b41..358507e3 100644
--- a/common/mm/pmm.h
+++ b/common/mm/pmm.h
@@ -71,4 +71,6 @@ 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 58faac50..d5d9b74c 100644
--- a/common/mm/pmm.s2.c
+++ b/common/mm/pmm.s2.c
@@ -230,10 +230,6 @@ 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) {
@@ -431,7 +427,7 @@ fail:
panic(false, "pmm: Failure initialising memory map");
}
-static void pmm_reclaim_uefi_mem(struct memmap_entry *m, size_t *_count) {
+void pmm_reclaim_uefi_mem(struct memmap_entry *m, size_t *_count) {
size_t count = *_count;
size_t recl_i = 0;
@@ -495,8 +491,6 @@ static 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 66fbebf1..182baf0c 100644
--- a/common/protos/limine.c
+++ b/common/protos/limine.c
@@ -1382,6 +1382,10 @@ 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);
