From d95c714c8cfdc5818b0e0f0c99cf2e5be66de202 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sun, 12 Sep 2021 21:51:10 +0300 Subject: Initial physical page manager + Will probably still need a fair bit of tweakind and documentation improvements, but seems to work outside of the kernel. Also no valgrind errors, which is quite promising I guess. --- arch/riscv/init/init.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'arch/riscv/init/init.c') diff --git a/arch/riscv/init/init.c b/arch/riscv/init/init.c index 6bb6bc3..e12c351 100644 --- a/arch/riscv/init/init.c +++ b/arch/riscv/init/init.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -118,11 +119,19 @@ void init_debug(void *fdt) #endif -void init(void *fdt) +void __noreturn init(void *fdt) { init_debug(fdt); - dbg("hello\n"); + /* basic memory layout info */ struct mem_layout pmem = get_memlayout(fdt); - /* struct mm_ptinfo ptbl = create_pagetable(pmem); */ + + /* TODO: find first contiguous region */ + + /* generate pagetable at contiguous region */ + populate_pmap(pmem.base, pmem.top - pmem.base, 0/* something */); + + /* TODO: mark all used pages */ + update_pmap(0/* TODO: figure out where in virtual memory the page map should be mapped */); + /* TODO: jump to kernel */ } -- cgit v1.3