[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:
2020-09-17 00:48:17 -07:00
parent ca7f78565d
commit 9aa08a70cf
16 changed files with 1004 additions and 401 deletions

View File

@@ -6,6 +6,7 @@
#include "kutil/vector.h"
#include "objects/kobject.h"
#include "page_table.h"
#include "vm_space.h"
class process :
public kobject
@@ -37,6 +38,9 @@ public:
/// Get the process' page table root
page_table * pml4() { return m_pml4; }
/// Get the process' virtual memory space
vm_space & space() { return m_space; }
/// Create a new thread in this process
/// \args priority The new thread's scheduling priority
/// \args user If true, create a userspace stack for this thread
@@ -72,6 +76,8 @@ private:
uint32_t m_return_code;
page_table *m_pml4;
vm_space m_space;
kutil::vector<thread*> m_threads;
kutil::map<j6_handle_t, kobject*> m_handles;
j6_handle_t m_next_handle;