1 use crate::{ 2 arch::interrupt::ipi::send_ipi, 3 exception::ipi::{IpiKind, IpiTarget}, 4 syscall::SystemError, 5 }; 6 7 pub mod core; 8 9 pub fn kick_cpu(cpu_id: usize) -> Result<(), SystemError> { 10 // todo: 增加对cpu_id的有效性检查 11 12 send_ipi(IpiKind::KickCpu, IpiTarget::Specified(cpu_id)); 13 return Ok(()); 14 } 15 16 #[no_mangle] 17 pub extern "C" fn rs_kick_cpu(cpu_id: usize) -> usize { 18 return kick_cpu(cpu_id) 19 .map(|_| 0usize) 20 .unwrap_or_else(|e| e.to_posix_errno() as usize); 21 } 22