diff options
Diffstat (limited to 'sys/kern/init.c')
-rw-r--r-- | sys/kern/init.c | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/sys/kern/init.c b/sys/kern/init.c deleted file mode 100644 index a58d3bc..0000000 --- a/sys/kern/init.c +++ /dev/null @@ -1,51 +0,0 @@ -#include <fdt.h> -#include <mm/kalloc.h> -#include <printf.h> -#include <spinlock.h> -#include <sbi.h> -#include <stdint.h> - -extern uint64_t HEAP_START; - -#define HLT()\ - for (;;)\ - asm("wfi") - -void -init(unsigned long hartid, struct fdt_header *fdt) -{ - - printf("booting from hart #%d\n", hartid); - asm volatile ("mv tp, %0" : : "r"(hartid)); - if (fdt_uint32(fdt->magic) == FDT_HEADER_MAGIC) - printf("found flattened device tree at %p!\n", (uint64_t)fdt); - - printf("parsing device tree!\n"); - fdt_walk(fdt); - - printf("setting up the heap at %p\n", HEAP_START); - kalloc_init(); - printf("done!\n"); - // printf("printing free pages:\n"); - ///walkfree(); - printf("bringing up other harts...\n"); - // todo: detect harts from device tree can also be used for more conservative stack allocation - for (int i = 0; i < NPROC; ++i) { - if (i == hartid) { - printf("skipping hart #%d\n", i); - continue; - } - printf("starting hart #%d\n", i); - struct sbiret r = _start_hart(i, (unsigned long)LOAD_ADDR); - if (r.err != SBI_SUCCESS) - printf("ERROR"); - } -} - -void -mpinit(unsigned long hartid) -{ - printf("mpinit: %d", hartid); - HLT(); -} - |