better panic

This commit is contained in:
2026-02-07 02:18:15 +01:00
parent b920c87bab
commit 458ba375f3
8 changed files with 36 additions and 16 deletions

View File

@@ -66,7 +66,10 @@ static uintptr_t g_freelist = 0;
uintptr_t pmm_alloc()
{
if (!g_freelist) return 0;
if (!g_freelist)
{
panic(NULL, "PMM is out of memory!");
}
uintptr_t addr = g_freelist;
g_freelist = *(uintptr_t*) PHYS_TO_VIRT(g_freelist);
return addr;
@@ -104,4 +107,4 @@ void pmm_init(struct limine_memmap_response* memmap, struct limine_hhdm_response
// Now we have biggest USABLE region,
// so to populate the free list we just iterate through it
pmm_init_freelist();
}
}