diff options
author | stefan <stefan@s00.xyz> | 2023-04-19 20:50:10 -0400 |
---|---|---|
committer | stefan <stefan@s00.xyz> | 2023-04-19 20:50:10 -0400 |
commit | 83e17e29456ec9b6d45f4d9f2634eb280c6f414f (patch) | |
tree | 004a9b2a7cd3f0c7bb4224b59204680bd5d79681 /sys/kern/init.c | |
parent | af1ce4b2e637ceb418ea72d51c49a3eee276a938 (diff) | |
download | sv-83e17e29456ec9b6d45f4d9f2634eb280c6f414f.tar.gz |
ticket locks
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(); -} - |