From c3e56bb80325da9c0bca77b69e575963e5fc76b1 Mon Sep 17 00:00:00 2001 From: Maurice Hieronymus Date: Sun, 5 Jan 2025 14:10:28 +0100 Subject: [PATCH] smp: Simplify cpu startup functions --- kernel/src/asm/boot.S | 2 +- kernel/src/main.rs | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/kernel/src/asm/boot.S b/kernel/src/asm/boot.S index 06c0d96e..1f87d1ac 100644 --- a/kernel/src/asm/boot.S +++ b/kernel/src/asm/boot.S @@ -79,7 +79,7 @@ start_hart: li sp, 0 addi sp, sp, -64 - call hart_init + call prepare_for_scheduling # We should never come here j asm_panic_rust diff --git a/kernel/src/main.rs b/kernel/src/main.rs index c31289b9..5d6f201f 100644 --- a/kernel/src/main.rs +++ b/kernel/src/main.rs @@ -141,7 +141,8 @@ extern "C" fn kernel_init(hart_id: usize, device_tree_pointer: *const ()) -> ! { prepare_for_scheduling(); } -fn prepare_for_scheduling() -> ! { +#[no_mangle] +pub extern "C" fn prepare_for_scheduling() -> ! { // Enable all interrupts Cpu::write_sie(usize::MAX); @@ -172,10 +173,3 @@ fn start_other_harts(current_hart_id: usize, number_of_cpus: usize) { .assert_success(); } } - -#[no_mangle] -extern "C" fn hart_init() -> ! { - let cpu_id = Cpu::cpu_id(); - info!("Cpu {cpu_id} started!"); - prepare_for_scheduling(); -}