Rearrange memory manager into two classes.
page_manager and memory_manager are now separate, and are also pre allocated in the kernel so they don't have to allocate themselves.
This commit is contained in:
@@ -1,13 +1,23 @@
|
||||
#include "assert.h"
|
||||
#include "console.h"
|
||||
#include "memory_pages.h"
|
||||
|
||||
page_manager g_page_manager;
|
||||
|
||||
page_manager::page_manager() :
|
||||
m_free(nullptr),
|
||||
m_used(nullptr),
|
||||
m_pool(nullptr)
|
||||
{
|
||||
kassert(this == &g_page_manager, "Attempt to create another page_manager.");
|
||||
}
|
||||
|
||||
|
||||
page_block *
|
||||
page_block::list_consolidate()
|
||||
{
|
||||
page_block *cur = this;
|
||||
page_block *freed_head = nullptr, **freed = &freed_head;
|
||||
|
||||
while (cur) {
|
||||
for (page_block *cur = this; cur; cur = cur->next) {
|
||||
page_block *next = cur->next;
|
||||
|
||||
if (next && cur->flags == next->flags &&
|
||||
@@ -21,8 +31,6 @@ page_block::list_consolidate()
|
||||
freed = &next->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
cur = next;
|
||||
}
|
||||
|
||||
return freed_head;
|
||||
|
||||
Reference in New Issue
Block a user