diff options
author | Marvin Borner | 2020-04-18 17:45:30 +0200 |
---|---|---|
committer | Marvin Borner | 2020-04-18 17:45:30 +0200 |
commit | 54d848127e2026b710463508b1e6ca89c2b4b068 (patch) | |
tree | 73929602c8824bc6fa06236840b6cac664448241 /src/kernel/memory | |
parent | 8d78616a2b80c7625c1aa9ca4733e48a8bf8bf22 (diff) |
I don't know HOW I did it, but it works!
I finally fixed the acpi tables with some memory mapping magic and
paging allocations, which seems to do the trick. YAY.
Diffstat (limited to 'src/kernel/memory')
-rw-r--r-- | src/kernel/memory/paging.c | 10 | ||||
-rw-r--r-- | src/kernel/memory/paging.h | 4 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/kernel/memory/paging.c b/src/kernel/memory/paging.c index 4b87540..38ed4a7 100644 --- a/src/kernel/memory/paging.c +++ b/src/kernel/memory/paging.c @@ -25,11 +25,9 @@ void paging_init() for (uint32_t i = 0; i < 1024; i++) { current_page_directory[i] = ((uint32_t)current_page_tables[i]) | PD_RW | PD_PRESENT; } - - paging_set_present(0, memory_get_all() >> 3); // /4 } -void paging_install() +void paging_install(uint32_t multiboot_address) { // User paging //paging_switch_directory(1); @@ -39,10 +37,14 @@ void paging_install() // Kernel paging paging_switch_directory(0); paging_init(); + + // if mmap approach didn't work + if (!memory_init(multiboot_address)) + paging_set_present(0, memory_get_all() >> 3); // /4 paging_set_used(0, ((uint32_t)ASM_KERNEL_END >> 12) + 1); // /4096 paging_enable(); - vga_log("Installed paging"); + log("Installed paging"); } void paging_disable() diff --git a/src/kernel/memory/paging.h b/src/kernel/memory/paging.h index 5836430..1578e2a 100644 --- a/src/kernel/memory/paging.h +++ b/src/kernel/memory/paging.h @@ -25,7 +25,7 @@ int paging_enabled; uint32_t *current_page_directory; -void paging_install(); +void paging_install(uint32_t multiboot_address); void paging_enable(); @@ -61,4 +61,4 @@ uint32_t paging_alloc_pages(uint32_t count); uint32_t paging_get_used_pages(); -#endif
\ No newline at end of file +#endif |