xref: /DragonOS/kernel/src/smp/init.rs (revision 2eab6dd743e94a86a685f1f3c01e599adf86610a)
1 use log::info;
2 
3 use crate::{
4     arch::{syscall::arch_syscall_init, CurrentIrqArch, CurrentSchedArch},
5     exception::InterruptArch,
6     process::ProcessManager,
7     sched::SchedArch,
8     smp::{core::smp_get_processor_id, cpu::smp_cpu_manager},
9 };
10 
11 #[inline(never)]
smp_ap_start_stage2() -> !12 pub fn smp_ap_start_stage2() -> ! {
13     assert!(!CurrentIrqArch::is_irq_enabled());
14 
15     smp_cpu_manager().complete_ap_thread(true);
16 
17     do_ap_start_stage2();
18 
19     CurrentSchedArch::initial_setup_sched_local();
20 
21     CurrentSchedArch::enable_sched_local();
22     ProcessManager::arch_idle_func();
23 }
24 
25 #[inline(never)]
do_ap_start_stage2()26 fn do_ap_start_stage2() {
27     info!("Successfully started AP {}", smp_get_processor_id().data());
28     arch_syscall_init().expect("AP core failed to initialize syscall");
29 }
30