From ddcc46555c8b85754fc7e0ed026e836d9197a859 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Wed, 13 May 2020 23:53:49 +0200 Subject: Some page directory fixes --- src/kernel/memory/alloc.c | 2 +- src/kernel/memory/paging.c | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/kernel/memory/alloc.c b/src/kernel/memory/alloc.c index d94e482..0751011 100644 --- a/src/kernel/memory/alloc.c +++ b/src/kernel/memory/alloc.c @@ -10,7 +10,7 @@ static int locked = 0; int liballoc_lock() { - spinlock(locked); + spinlock(&locked); return 0; } diff --git a/src/kernel/memory/paging.c b/src/kernel/memory/paging.c index e3c088a..fb93dc4 100644 --- a/src/kernel/memory/paging.c +++ b/src/kernel/memory/paging.c @@ -14,14 +14,13 @@ void paging_init(struct page_directory *dir, int user) { for (u32 i = 0; i < 1024; i++) { for (u32 j = 0; j < 1024; j++) { - paging_directory->tables[i]->pages[j] = + dir->tables[i]->pages[j] = ((j * 0x1000) + (i * PAGE_SIZE)) | PT_RW | (user ? PT_USER : 0); } } for (u32 i = 0; i < 1024; i++) { - paging_directory->tables[i] = ((u32)paging_directory->tables[i]) | PD_RW | - PD_PRESENT | (user ? PD_USER : 0); + dir->tables[i] = ((u32)dir->tables[i]) | PD_RW | PD_PRESENT | (user ? PD_USER : 0); } } @@ -38,7 +37,7 @@ extern u32 end; void paging_install(u32 multiboot_address) { // Kernel paging - paging_switch_directory(paging_directory); + paging_switch_directory(paging_kernel_directory); paging_init(paging_directory, 0); if (!memory_init(multiboot_address)) -- cgit v1.2.3