From cd1107abe2634f4d9683542a5e4cbfd45c661278 Mon Sep 17 00:00:00 2001 From: mintsuki Date: Fri, 29 Jul 2022 00:42:47 +0200 Subject: [PATCH] limine: Specify that memory between 0 and 0x1000 is never to be marked usable --- PROTOCOL.md | 3 ++- common/mm/pmm.s2.c | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) 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;