[kernel] Move pml4 create/delete into vm_space

vm_space and page_table continue to take over duties from
page_manager:

- creation and deletion of address spaces / pml4s
- cross-address-space copies for endpoints
- taking over pml4 ownership from process

Also fixed the bug where the wrong process was being set in the cpu
data.

To solve: now the kernel process has its own vm_space which is not
g_kernel_space.
This commit is contained in:
2020-09-18 01:22:49 -07:00
parent ac67111b83
commit 671a0ce0fb
14 changed files with 132 additions and 101 deletions

View File

@@ -76,7 +76,7 @@ struct page_table
/// Get a *non-const* reference to the current table entry of
/// the table at the given level.
inline uint64_t & entry(level l) {
for (unsigned i = 1; i < unsigned(l); ++i) ensure_table(level(i));
for (unsigned i = 1; i <= unsigned(l); ++i) ensure_table(level(i));
return table(l)->entries[index(l)];
}
@@ -149,6 +149,10 @@ struct page_table
/// Check if the given entry represents a page (of any size)
inline bool is_page(level l, int i) const { return (l == level::pt) || is_large_page(l, i); }
/// Free this page table and all resources it references
/// \arg l The level of this page table
void free(level l);
/// Print this table to the debug console.
void dump(level lvl = level::pml4, bool recurse = true);