PMM: Log invalid frees
This commit is contained in:
parent
073c90e948
commit
9d0dfbaedf
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "memory/PMM.h"
|
#include "memory/PMM.h"
|
||||||
#include "bootboot.h"
|
#include "bootboot.h"
|
||||||
|
#include "log/Log.h"
|
||||||
#include "memory/Memory.h"
|
#include "memory/Memory.h"
|
||||||
#include "memory/MemoryManager.h"
|
#include "memory/MemoryManager.h"
|
||||||
#include "misc/utils.h"
|
#include "misc/utils.h"
|
||||||
@ -130,7 +131,11 @@ void* PMM::request_pages(uint64_t count)
|
|||||||
void PMM::free_page(void* address)
|
void PMM::free_page(void* address)
|
||||||
{
|
{
|
||||||
uint64_t index = (uint64_t)address / PAGE_SIZE;
|
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;
|
if (!bitmap_read(index)) return;
|
||||||
bitmap_set(index, false);
|
bitmap_set(index, false);
|
||||||
used_mem -= PAGE_SIZE;
|
used_mem -= PAGE_SIZE;
|
||||||
|
Loading…
Reference in New Issue
Block a user