1 use core::hint::spin_loop; 2 3 use crate::{ 4 arch::CurrentIrqArch, exception::InterruptArch, kBUG, kdebug, process::ProcessManager, 5 }; 6 7 impl ProcessManager { 8 /// 每个核的idle进程 9 pub fn arch_idle_func() -> ! { 10 loop { 11 if CurrentIrqArch::is_irq_enabled() { 12 unsafe { 13 riscv::asm::wfi(); 14 } 15 } else { 16 kBUG!("Idle process should not be scheduled with IRQs disabled."); 17 spin_loop(); 18 } 19 20 kdebug!("idle loop"); 21 } 22 } 23 } 24