x86_64: Add a getter for the initial page directory
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
2600acc96c
commit
a1eca479d5
@ -32,4 +32,6 @@ namespace MMU
|
||||
|
||||
Result<PageDirectory*> create_page_directory_for_userspace();
|
||||
void setup_initial_page_directory();
|
||||
|
||||
PageDirectory* kernel_page_directory();
|
||||
}
|
@ -7,6 +7,8 @@
|
||||
#pragma GCC push_options
|
||||
#pragma GCC diagnostic ignored "-Wconversion"
|
||||
|
||||
PageDirectory* g_kernel_directory;
|
||||
|
||||
void PageTableEntry::set_address(u64 addr)
|
||||
{
|
||||
this->address = (addr >> 12);
|
||||
@ -259,6 +261,7 @@ namespace MMU
|
||||
void setup_initial_page_directory()
|
||||
{
|
||||
PageDirectory* const dir = get_page_directory();
|
||||
g_kernel_directory = dir;
|
||||
const u64 paddr = (u64)dir;
|
||||
PageTableEntry& recursive_entry = dir->entries[rindex];
|
||||
recursive_entry.read_write = true;
|
||||
@ -266,4 +269,9 @@ namespace MMU
|
||||
recursive_entry.set_address(paddr);
|
||||
flush_all();
|
||||
}
|
||||
|
||||
PageDirectory* kernel_page_directory()
|
||||
{
|
||||
return g_kernel_directory;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user