diff options
author | Marvin Borner | 2020-06-02 23:10:27 +0200 |
---|---|---|
committer | Marvin Borner | 2020-06-02 23:10:27 +0200 |
commit | cf9135829836c85735b383f7c50f34232bea94f9 (patch) | |
tree | c6385aae76407504f34f371b799e03aa53c63e5c /src/kernel/memory | |
parent | 0b3b63ffdedb2e37e0732c09eb0e967e256f0d71 (diff) |
Much work on the ELF parser and userspace jumping
Diffstat (limited to 'src/kernel/memory')
-rw-r--r-- | src/kernel/memory/paging.c | 12 | ||||
-rw-r--r-- | src/kernel/memory/paging.h | 2 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/kernel/memory/paging.c b/src/kernel/memory/paging.c index 1d9f6b1..e2c48b8 100644 --- a/src/kernel/memory/paging.c +++ b/src/kernel/memory/paging.c @@ -1,5 +1,6 @@ #include <io/io.h> #include <lib/lib.h> +#include <memory/alloc.h> #include <memory/mmap.h> #include <memory/paging.h> #include <stdint.h> @@ -27,9 +28,16 @@ void paging_install() kernel_page_directory->entries[0].writable = 1; kernel_page_directory->entries[0].address = SHIFT((u32)page_table); - paging_switch_directory((u32)kernel_page_directory); + paging_switch_dir((u32)kernel_page_directory); paging_enable(); info("Installed paging"); + + // Test mallocing + u32 *c = malloc(2048); + c[42] = 0x4242; + assert(c[42] == 0x4242); + free(c); + info("Malloc test succeeded!"); } void paging_disable() @@ -48,7 +56,7 @@ void paging_enable() paging_enabled = 1; } -void paging_switch_directory(u32 dir) +void paging_switch_dir(u32 dir) { cr3_set(dir); } diff --git a/src/kernel/memory/paging.h b/src/kernel/memory/paging.h index ac0dbfa..af7d4a2 100644 --- a/src/kernel/memory/paging.h +++ b/src/kernel/memory/paging.h @@ -49,7 +49,7 @@ struct page_dir { void paging_install(); void paging_enable(); void paging_disable(); -void paging_switch_directory(u32 dir); +void paging_switch_dir(u32 dir); struct page_table_entry *paging_get_page(u32 address, struct page_dir *page_dir); void paging_frame_alloc(struct page_table_entry *page); |