diff options
-rw-r--r-- | src/kernel/lib/memory.c | 2 | ||||
-rw-r--r-- | src/kernel/memory/paging.c | 9 | ||||
-rw-r--r-- | src/kernel/memory/paging.h | 6 |
3 files changed, 9 insertions, 8 deletions
diff --git a/src/kernel/lib/memory.c b/src/kernel/lib/memory.c index 0f3cb34..16e4d4b 100644 --- a/src/kernel/lib/memory.c +++ b/src/kernel/lib/memory.c @@ -116,4 +116,4 @@ int memory_init(u32 multiboot_address) } } return ret; -}
\ No newline at end of file +} diff --git a/src/kernel/memory/paging.c b/src/kernel/memory/paging.c index 05e37bd..edaa82e 100644 --- a/src/kernel/memory/paging.c +++ b/src/kernel/memory/paging.c @@ -6,8 +6,10 @@ int paging_enabled = 0; +u32 tmp[1024][1024] __attribute__((aligned(4096))); +struct page_directory *paging_kernel_directory = (struct page_directory *)tmp; + struct page_directory *paging_directory; // Current -struct page_directory *paging_kernel_directory = 0x9d000; void paging_init(struct page_directory *dir, int user) { @@ -40,10 +42,9 @@ void paging_install(u32 multiboot_address) if (!memory_init(multiboot_address)) paging_set_present(0, memory_get_all() >> 3); - paging_set_used(0, ((u32)KERNEL_END >> 12) + 1); // /4096 - log("Enabling"); + log("Enabling"); paging_enable(); log("Installed paging"); } @@ -188,4 +189,4 @@ u32 paging_get_used_pages() } } return n; -}
\ No newline at end of file +} diff --git a/src/kernel/memory/paging.h b/src/kernel/memory/paging.h index f1fe064..f0b50b4 100644 --- a/src/kernel/memory/paging.h +++ b/src/kernel/memory/paging.h @@ -24,11 +24,11 @@ #define PT_USED 1 << 9 struct page_table { - u32 pages[1024]; + u32 pages[1024] __attribute__((aligned(4096))); }; struct page_directory { - struct page_table *tables[1024]; + struct page_table *tables[1024] __attribute__((aligned(4096))); }; struct page_directory *paging_kernel_directory; @@ -58,4 +58,4 @@ void paging_set_user(u32 virt, u32 count); u32 paging_find_pages(u32 count); u32 paging_alloc_pages(u32 count); -#endif
\ No newline at end of file +#endif |