aboutsummaryrefslogtreecommitdiff
path: root/kernel/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/main.c')
-rw-r--r--kernel/main.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/kernel/main.c b/kernel/main.c
index a2e4d13..822d638 100644
--- a/kernel/main.c
+++ b/kernel/main.c
@@ -5,6 +5,12 @@
#include <fbos/string.h>
#include <fbos/dt.h>
+/*
+ * Data related to harts and set by kernel/head.S. Defined in fbos/init.h.
+ */
+atomic32_t hart_lottery __section(".sdata");
+uint32_t hart_id;
+
// Stack to be used by our processes, which is initialized in head.S.
// "Blasphemy!" I hear you say. "How dare you use the same stack for kernel and
// user space?" It's not like this is some sort of utopian system in which
@@ -52,6 +58,11 @@ __noreturn __kernel void start_kernel(void *dtb)
write("\n", 1);
}
+ // And print the hart ID where this is being run.
+ printk("Running on Hart ID: ");
+ print_digit(hart_id);
+ write("\n", 1);
+
// At this point everything has already been handled: setup the interrupt
// vector and enable the timer to start ticking and scheduling the three
// tasks at hand.