aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/memory
diff options
context:
space:
mode:
authorMarvin Borner2020-04-18 00:07:37 +0200
committerMarvin Borner2020-04-18 00:07:37 +0200
commit8d78616a2b80c7625c1aa9ca4733e48a8bf8bf22 (patch)
tree894bddb357ca1976fcfd3b54d1e8fe48bbac569b /src/kernel/memory
parent27c38d3f6e473d2bf7075fb364db148f22aca203 (diff)
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.
Diffstat (limited to 'src/kernel/memory')
-rw-r--r--src/kernel/memory/paging.c29
1 files changed, 15 insertions, 14 deletions
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 <kernel/system.h>
#include <kernel/lib/lib.h>
#include <kernel/io/io.h>
+#include <kernel/acpi/acpi.h>
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
+}