From 8d78616a2b80c7625c1aa9ca4733e48a8bf8bf22 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 18 Apr 2020 00:07:37 +0200 Subject: Completely reworked ACPI tables I'm too exhausted right now, but I rediscovered the memory mapping issue of my ACPI implementatio and need to fix it ASAP. Otherwise I won't be able to use any ACPI table without causing a page fault. I have no clue why exactly this is happening and the internet says that I shouldn't need to memory map them. Well, I'll look into it later. --- src/kernel/memory/paging.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'src/kernel/memory/paging.c') diff --git a/src/kernel/memory/paging.c b/src/kernel/memory/paging.c index 8b5de59..4b87540 100644 --- a/src/kernel/memory/paging.c +++ b/src/kernel/memory/paging.c @@ -3,6 +3,7 @@ #include #include #include +#include int paging_enabled = 0; @@ -31,9 +32,9 @@ void paging_init() void paging_install() { // User paging - paging_switch_directory(1); - paging_init(); - paging_set_user(0, memory_get_all() >> 3); + //paging_switch_directory(1); + //paging_init(); + //paging_set_user(0, memory_get_all() >> 3); // Kernel paging paging_switch_directory(0); @@ -53,6 +54,16 @@ void paging_disable() paging_enabled = 0; } +void paging_enable() +{ + asm("mov %0, %%cr3" ::"r"(current_page_directory)); + uint32_t cr0; + asm("mov %%cr0, %0" : "=r"(cr0)); + cr0 |= 0x80000000; + asm("mov %0, %%cr0" ::"r"(cr0)); + paging_enabled = 1; +} + void paging_switch_directory(int user) { if (user == 1) { @@ -65,16 +76,6 @@ void paging_switch_directory(int user) asm("mov %0, %%cr3" ::"r"(current_page_directory)); } -void paging_enable() -{ - asm("mov %0, %%cr3" ::"r"(current_page_directory)); - uint32_t cr0; - asm("mov %%cr0, %0" : "=r"(cr0)); - cr0 |= 0x80000000; - asm("mov %0, %%cr0" ::"r"(cr0)); - paging_enabled = 1; -} - inline void invlpg(uint32_t addr) { asm("invlpg (%0)" ::"r"(addr) : "memory"); @@ -191,4 +192,4 @@ uint32_t paging_get_used_pages() } } return n; -} \ No newline at end of file +} -- cgit v1.2.3