aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/paging/paging.c
diff options
context:
space:
mode:
authorMarvin Borner2019-10-15 22:22:23 +0200
committerGitHub2019-10-15 22:22:23 +0200
commit2e988c84fc9b282e7618ba89a5c3b2ef9406121e (patch)
tree6e9741c6b2117796a2e40da1f0fade84c090aac7 /src/kernel/paging/paging.c
parent8754542ce074bef0984f91ce1b1cd8aff9b3d5e9 (diff)
parent0e75de0452774c1d4f9a16ff593d9ec2fac829bc (diff)
Merged VESA-paging fix
Fixed paging activation before initialization of VESA driver
Diffstat (limited to 'src/kernel/paging/paging.c')
-rw-r--r--src/kernel/paging/paging.c12
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));