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