aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-07-06 23:37:11 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2024-07-06 23:37:11 +0300
commit3fedbb6e1f849c5e0a4033d68201d60c2fc48121 (patch)
treebd219cef69a19938ecf453c3c3bb76fc13bd31a9 /src/main.c
parent3528f88fc36df6964c0efed784ae223cfe93544e (diff)
downloadkmi-3fedbb6e1f849c5e0a4033d68201d60c2fc48121.tar.gz
kmi-3fedbb6e1f849c5e0a4033d68201d60c2fc48121.zip
core bringup + various warnings
+ dbg_fdt() is apparently broken, possibly due to UB or something, but it causes some issues with optimizations enabled. Remove it temporarily
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index 1f4c250..169efc3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -61,14 +61,12 @@ __noreturn void kernel(void *fdt, uintptr_t load_addr, struct vmem *d)
/* we should be in kernelspace, so use the virtual address of our FDT. */
fdt = __va(fdt);
- bkl_lock();
-
/* dbg uses direct mapping at this point */
init_dbg(fdt);
/* start up debugging in kernel IO */
setup_io_dbg(d);
- dbg_fdt(fdt);
+ //dbg_fdt(fdt);
setup_arch(fdt);
@@ -80,11 +78,14 @@ __noreturn void kernel(void *fdt, uintptr_t load_addr, struct vmem *d)
vm_t proc_fdt = 0, proc_initrd = 0;
init_proc(fdt, &proc_fdt, &proc_initrd);
+ /* lock kernel since we're about to start other threads as well */
+ bkl_lock();
/* try to bring up other cores on system */
smp_bringup(d, fdt);
/* start running init program */
run_init(cur_tcb(), proc_fdt, proc_initrd);
+ unreachable();
}
/**
@@ -110,6 +111,7 @@ __noreturn void main(unsigned long hart, void *fdt, uintptr_t load_addr)
pm_t ram_size = __fdt_ram_size(fdt);
set_ram_base(ram_base);
set_ram_size(ram_size);
+ set_load_addr(load_addr);
init_mem(fdt);