:: commit 69914117480ea8ca8cd11b9aaba3adb80caa09a4

mintsuki <mintsuki@protonmail.com> — 2022-07-28 22:42

parents: ebe81c9eed

limine: Specify that memory between 0 and 0x1000 is never to be marked usable

diff --git a/PROTOCOL.md b/PROTOCOL.md
index e6a9e0ac..804b0cdb 100644
--- a/PROTOCOL.md
+++ b/PROTOCOL.md
@@ -657,7 +657,8 @@ struct limine_memmap_entry {
 };
 ```
 
-Note: The kernel and modules loaded are not marked as usable memory.
+Note: Memory between 0 and 0x1000 is never marked as usable memory.
+The kernel and modules loaded are not marked as usable memory.
 They are marked as Kernel/Modules. The entries are guaranteed to be sorted by
 base address, lowest to highest. Usable and bootloader reclaimable entries
 are guaranteed to be 4096 byte aligned for both base and length. Usable and
diff --git a/common/mm/pmm.s2.c b/common/mm/pmm.s2.c
index a8c0bb12..3559c6cc 100644
--- a/common/mm/pmm.s2.c
+++ b/common/mm/pmm.s2.c
@@ -251,6 +251,9 @@ struct e820_entry_t *get_memmap(size_t *entries) {
 #if uefi == 1
     pmm_reclaim_uefi_mem(memmap, &memmap_entries);
 #endif
+
+    memmap_alloc_range(0, 0x1000, MEMMAP_RESERVED, MEMMAP_USABLE, false, false, false);
+
     sanitise_entries(memmap, &memmap_entries, true);
 
     *entries = memmap_entries;
tab: 248 wrap: offon