mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 16:34:31 -08:00
[kernel] Begin replacing page_manager with vm_space
This is the first commit of several reworking the VM system. The main focus is replacing page_manager's global functionality with objects representing individual VM spaces. The main changes in this commit were: - Adding the (as yet unused) vm_area object, which will be the main point of control for programs to allocate or share memory. - Replace the old vm_space with a new one based on state in its page tables. They will also be containers for vm_areas. - vm_space takes over from page_manager as the page fault handler - Commented out the page walking in memory_bootstrap; I'll probably need to recreate this functionality, but it was broken as it was. - Split out the page_table.h implementations from page_manager.cpp into the new page_table.cpp, updated it, and added page_table::iterator as well.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
#include "kutil/assert.h"
|
||||
#include "kernel_memory.h"
|
||||
#include "page_manager.h"
|
||||
#include "buffer_cache.h"
|
||||
#include "kernel_memory.h"
|
||||
#include "objects/vm_area.h"
|
||||
#include "page_manager.h"
|
||||
#include "vm_space.h"
|
||||
|
||||
extern vm_space g_kernel_space;
|
||||
@@ -33,16 +34,17 @@ buffer_cache::get_buffer()
|
||||
m_next += m_size;
|
||||
}
|
||||
|
||||
g_kernel_space.commit(addr, m_size);
|
||||
vm_space &vm = vm_space::kernel_space();
|
||||
vm.allow(addr, m_size, true);
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
void
|
||||
buffer_cache::return_buffer(uintptr_t addr)
|
||||
{
|
||||
void *ptr = reinterpret_cast<void*>(addr);
|
||||
size_t page_count = page_manager::page_count(m_size);
|
||||
page_manager::get()->unmap_pages(ptr, page_count);
|
||||
g_kernel_space.unreserve(addr, m_size);
|
||||
vm_space &vm = vm_space::kernel_space();
|
||||
vm.allow(addr, m_size, false);
|
||||
|
||||
m_cache.append(addr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user