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à --- include/fbos/init.h | 11 +++-------- include/fbos/printk.h | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/fbos/init.h b/include/fbos/init.h index f253645..592a7f1 100644 --- a/include/fbos/init.h +++ b/include/fbos/init.h @@ -25,11 +25,6 @@ // Instantiated in kernel/main.c extern atomic32_t hart_lottery; -// ID of the hart that is running the show. -// -// Instantiated in kernel/main.c -extern uint32_t hart_id; - // Tracks the amount of seconds that have elapsed since activating timer // interrupts. // @@ -52,9 +47,9 @@ void setup_interrupts(void); /* * This is the main entry point of the kernel after head.S is done. This - * function can (and will) assume that everything has been reset and that we can - * start the whole thing. + * function expects exactly two arguments, which are exactly the same as they + * are passed to the `_start` function in kernel/head.S by the bootloader. */ -void start_kernel(void *dtb); +void start_kernel(uint64_t hart_id, void *dtb); #endif /* __FBOS_INIT_H */ diff --git a/include/fbos/printk.h b/include/fbos/printk.h index d6ca71e..d118734 100644 --- a/include/fbos/printk.h +++ b/include/fbos/printk.h @@ -13,7 +13,7 @@ extern void die(const char *const message); // Print the given number as a single digit. -extern void print_digit(uint32_t digit); +extern void print_digit(uint64_t digit); // Print the given message. extern void printk(const char *const message); -- cgit v1.2.3