Skip to content

Commit

Permalink
smp: Simplify cpu startup functions
Browse files Browse the repository at this point in the history
  • Loading branch information
sysheap committed Jan 5, 2025
1 parent 5590434 commit c3e56bb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion kernel/src/asm/boot.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 2 additions & 8 deletions kernel/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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();
}

0 comments on commit c3e56bb

Please sign in to comment.