diff options
author | Marvin Borner | 2019-10-14 17:20:25 +0200 |
---|---|---|
committer | Marvin Borner | 2019-10-14 17:20:25 +0200 |
commit | aca116a82c7b9ef715ec9e7ed6d2f97d56715327 (patch) | |
tree | 7bac857da5f8244cc08adffc4660bacf4f27a73f /src/kernel/paging/paging.c | |
parent | 8754542ce074bef0984f91ce1b1cd8aff9b3d5e9 (diff) |
Trying some things
Diffstat (limited to 'src/kernel/paging/paging.c')
-rw-r--r-- | src/kernel/paging/paging.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/kernel/paging/paging.c b/src/kernel/paging/paging.c index 4bb69d0..1712f7e 100644 --- a/src/kernel/paging/paging.c +++ b/src/kernel/paging/paging.c @@ -105,6 +105,18 @@ void initialise_paging() { switch_page_directory(current_directory); } +void disable_paging() { + uint32_t cr0; + asm volatile("mov %%cr0, %0": "=r"(cr0)); + cr0 &= 0x7fffffff; + asm volatile("mov %0, %%cr0"::"r"(cr0)); +} + +void enable_paging() { + switch_page_directory(kernel_directory); + switch_page_directory(current_directory); +} + void switch_page_directory(page_directory_t *dir) { current_directory = dir; asm volatile("mov %0, %%cr3"::"r"(dir->physicalAddr)); |