summaryrefslogtreecommitdiff
path: root/sys/kern/init.c
diff options
context:
space:
mode:
authorstefan <stefan@s00.xyz>2023-04-08 20:42:18 -0400
committerstefan <stefan@s00.xyz>2023-04-08 20:42:18 -0400
commit1aac36f788834699b6891aea7a83eb950bd5e8f6 (patch)
tree18e0a6c26b83e71c101193e60149f49b1641daf0 /sys/kern/init.c
parenta1a97aa7b2b0c3d1f3b6766446d605f83de1c561 (diff)
downloadsv-1aac36f788834699b6891aea7a83eb950bd5e8f6.tar.gz
no idea whot i changed lol
Diffstat (limited to 'sys/kern/init.c')
-rw-r--r--sys/kern/init.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/sys/kern/init.c b/sys/kern/init.c
index 18feaa3..208df6d 100644
--- a/sys/kern/init.c
+++ b/sys/kern/init.c
@@ -1,20 +1,35 @@
#include <fdt.h>
+#include <mm/kalloc.h>
#include <printf.h>
#include <stdint.h>
-#include <mm/kalloc.h>
+#include <spinlock.h>
extern uint64_t HEAP_START;
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("printing free pages:\n");
+ //walkfree();
+}
+
+/* non boot harts enter here */
+void
+mpinit(unsigned long hartid, struct fdt_header *fdt)
+{
+ unsigned char *uart = (unsigned char*)0x10000000;
+ *uart = hartid + '0';
+ *(uart + 1) = '\n';
}