From aca116a82c7b9ef715ec9e7ed6d2f97d56715327 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Mon, 14 Oct 2019 17:20:25 +0200 Subject: Trying some things --- src/kernel/paging/paging.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/kernel/paging/paging.c') 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)); -- cgit v1.2.3