Virtual memory and dlmalloc
This commit is contained in:
@ -5,8 +5,7 @@
|
||||
#include "bitmap/bitmap.h"
|
||||
#include "bootinfo/bootinfo.h"
|
||||
#include "spinlock/spinlock.h"
|
||||
|
||||
#define _DIV_ROUNDUP(num, div) ((num + div - 1) / div)
|
||||
#include "util/util.h"
|
||||
|
||||
PhysMem PHYS_MEM;
|
||||
|
||||
@ -31,7 +30,7 @@ void pmm_init(void) {
|
||||
}
|
||||
|
||||
if (!memmap_ent) {
|
||||
ERR("hal/pmm", "required memory: {%lx}\n", bm->nbytes);
|
||||
ERR("pmm", "required memory: {%lx}\n", bm->nbytes);
|
||||
hal_hang();
|
||||
}
|
||||
|
||||
@ -48,7 +47,7 @@ void pmm_init(void) {
|
||||
bitmap_markregion(bm, (void *)physbegin, bm->nbytes, 1);
|
||||
bm->alloc_blocks = 0;
|
||||
|
||||
LOG("hal/pmm", "phys bitmap init 0x%lx, size = 0x%lx\n", physbegin, bm->nbytes);
|
||||
LOG("pmm", "phys bitmap init 0x%lx, size = 0x%lx\n", physbegin, bm->nbytes);
|
||||
bm->init = true;
|
||||
}
|
||||
|
||||
@ -58,7 +57,7 @@ void *pmm_alloc(size_t pages) {
|
||||
spinlock_release(&PHYS_MEM.spinlock);
|
||||
|
||||
if (!phys) {
|
||||
ERR("hal/pmm", "phys memory ran out\n");
|
||||
ERR("pmm", "phys memory ran out\n");
|
||||
hal_hang();
|
||||
}
|
||||
return (void *)phys;
|
||||
|
Reference in New Issue
Block a user