pmm: Panic if there is an attempt to reserve a memory range below 1 MiB
diff --git a/limine-pxe.bin b/limine-pxe.bin
index 4c82a85e..bac1440c 100644
Binary files a/limine-pxe.bin and b/limine-pxe.bin differ
diff --git a/limine.bin b/limine.bin
index 66ff18c0..f0ca574b 100644
Binary files a/limine.bin and b/limine.bin differ
diff --git a/stage2.map b/stage2.map
index a7c97588..bae90590 100644
Binary files a/stage2.map and b/stage2.map differ
diff --git a/stage2/mm/pmm.c b/stage2/mm/pmm.c
index f7878d57..b0e83565 100644
--- a/stage2/mm/pmm.c
+++ b/stage2/mm/pmm.c
@@ -229,6 +229,11 @@ void *ext_mem_alloc_aligned_type(size_t count, size_t alignment, uint32_t type)
void memmap_alloc_range(uint64_t base, uint64_t length, uint32_t type) {
uint64_t top = base + length;
+ if (base < 0x100000) {
+ // We don't do allocations below 1 MiB
+ panic("Attempt to allocate memory below 1 MiB");
+ }
+
for (size_t i = 0; i < memmap_entries; i++) {
if (memmap[i].type != 1)
continue;
diff --git a/test/Makefile b/test/Makefile
index a9336673..a4a885f6 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -8,7 +8,7 @@ QEMUFLAGS = -m 1G -enable-kvm -cpu host
LDINTERNALFLAGS := -Tlinker.ld -static -nostdlib -no-pie
INTERNALCFLAGS := -I../stivale -I. -ffreestanding -fno-stack-protector \
-fno-pic -fomit-frame-pointer -mno-80387 -mno-mmx -mno-3dnow -mno-sse \
- -mno-sse2 -masm=intel
+ -mno-sse2 -masm=intel -mcmodel=kernel
all: $(TARGET)
diff --git a/test/linker.ld b/test/linker.ld
index 768751a6..222598af 100644
--- a/test/linker.ld
+++ b/test/linker.ld
@@ -2,7 +2,7 @@ ENTRY(stivale_main)
SECTIONS
{
- . = 0x100000;
+ . = 0xffffffff80100000;
.stivalehdr ALIGN(4K) :
{
