PMM: Log invalid frees

This commit is contained in:
apio 2022-10-20 18:49:12 +02:00
parent 073c90e948
commit 9d0dfbaedf

View File

@ -2,6 +2,7 @@
#include "memory/PMM.h"
#include "bootboot.h"
#include "log/Log.h"
#include "memory/Memory.h"
#include "memory/MemoryManager.h"
#include "misc/utils.h"
@ -130,7 +131,11 @@ void* PMM::request_pages(uint64_t count)
void PMM::free_page(void* address)
{
uint64_t index = (uint64_t)address / PAGE_SIZE;
if (index > (bitmap_size * 8)) return;
if (index > (bitmap_size * 8))
{
kinfoln("attempt to free out-of-range address %p", address);
return;
}
if (!bitmap_read(index)) return;
bitmap_set(index, false);
used_mem -= PAGE_SIZE;