more stuff
This commit is contained in:
+4
-5
@@ -56,7 +56,7 @@ void mem_phys_bootstrap(struct phys_mem* mem) {
|
||||
}
|
||||
|
||||
static struct page* pmm_head = nullptr;
|
||||
static spinlock_t pmm_lock = {0};
|
||||
static struct spinlock pmm_lock = {0};
|
||||
static size_t pmm_total_free = 0;
|
||||
|
||||
static errno_t freelist_alloc(size_t num_pages, enum alloc_flags flags, phys_t* out) {
|
||||
@@ -84,11 +84,10 @@ static errno_t freelist_alloc(size_t num_pages, enum alloc_flags flags, phys_t*
|
||||
|
||||
// If the current block has exactly enough pages left, consume it entirely.
|
||||
if (__unlikely(it->freelist.count == num_pages)) {
|
||||
if (prev_it) {
|
||||
if (prev_it)
|
||||
prev_it->freelist.next = it->freelist.next;
|
||||
} else {
|
||||
else
|
||||
pmm_head = it->freelist.next;
|
||||
}
|
||||
|
||||
it->freelist.next = nullptr;
|
||||
it->freelist.count = 0;
|
||||
@@ -150,5 +149,5 @@ void mem_phys_init(struct phys_mem* map, size_t length) {
|
||||
}
|
||||
|
||||
const size_t free_bytes = (pmm_total_free * arch_mem_page_size());
|
||||
log("pmm", "Total available memory: %zu MiB\n", free_bytes / 1024 / 1024);
|
||||
log("pmm: Total available memory: %zu MiB\n", free_bytes / 1024 / 1024);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user