1 use system_error::SystemError; 2 3 use crate::{ 4 arch::interrupt::ipi::send_ipi, 5 exception::ipi::{IpiKind, IpiTarget}, 6 }; 7 8 use self::cpu::ProcessorId; 9 10 pub mod c_adapter; 11 pub mod core; 12 pub mod cpu; 13 14 pub fn kick_cpu(cpu_id: ProcessorId) -> Result<(), SystemError> { 15 // todo: 增加对cpu_id的有效性检查 16 17 send_ipi(IpiKind::KickCpu, IpiTarget::Specified(cpu_id)); 18 return Ok(()); 19 } 20 21 pub trait SMPArch { 22 /// 准备SMP初始化所需的cpu拓扑数据。 23 /// 24 /// 该函数需要标记为 `#[inline(never)]` 25 fn prepare_cpus() -> Result<(), SystemError>; 26 27 /// 初始化SMP 28 /// 29 /// 该函数需要标记为 `#[inline(never)]` 30 fn init() -> Result<(), SystemError>; 31 } 32