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