aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv/init/init.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2021-09-12 21:51:10 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2021-09-12 21:51:10 +0300
commitd95c714c8cfdc5818b0e0f0c99cf2e5be66de202 (patch)
tree3b7b7a4fda733f284a4f77a9e67cc509201cfeca /arch/riscv/init/init.c
parent1ab464d959b9ee3d3bb6758ac0d9d33fc6c77e46 (diff)
downloadkmi-d95c714c8cfdc5818b0e0f0c99cf2e5be66de202.tar.gz
kmi-d95c714c8cfdc5818b0e0f0c99cf2e5be66de202.zip
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.
Diffstat (limited to 'arch/riscv/init/init.c')
-rw-r--r--arch/riscv/init/init.c15
1 files changed, 12 insertions, 3 deletions
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 <apos/types.h>
#include <apos/string.h>
#include <apos/debug.h>
+#include <apos/pmem.h>
#include <libfdt.h>
#include <pages.h>
#include <csr.h>
@@ -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 */
}