From 22a681a07ab09922435ad0a9f665290a30f6b85b Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Wed, 4 Dec 2024 17:23:57 +0100 Subject: Pass the hart ID on start_kernel instead MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of storing the hard ID as given by the bootloader into a C variable, pass it directly into the 'start_kernel' function since we don't need to tamper the value as originally laid out on the 'a0' register. Signed-off-by: Miquel Sabaté Solà --- kernel/main.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'kernel/main.c') diff --git a/kernel/main.c b/kernel/main.c index 41619d6..3ed8551 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -5,11 +5,8 @@ #include #include -/* - * Data related to harts and set by kernel/head.S. Defined in fbos/init.h. - */ +// Defined in fbos/init.h. atomic32_t hart_lottery __section(".sdata"); -uint32_t hart_id; // Defined in fbos/sched.h. uint64_t stack[STACK_SIZE / sizeof(uint64_t)]; @@ -30,7 +27,7 @@ struct dt_info info = { .initrd_end = 0, }; -__noreturn __kernel void start_kernel(void *dtb) +__noreturn __kernel void start_kernel(uint64_t hart_id, void *dtb) { printk("Welcome to FizzBuzz OS!\n"); -- cgit v1.2.3