Don't race between enabling IRQs and halting CPU

This commit is contained in:
Ruihan Li
2025-04-09 10:23:58 +08:00
committed by Tate, Hongliang Tian
parent b96c8f9ed2
commit 35e0918bce
11 changed files with 105 additions and 42 deletions

View File

@ -111,8 +111,7 @@ fn ap_init() {
);
loop {
crate::thread::Thread::yield_now();
ostd::cpu::sleep_for_interrupt();
ostd::task::halt_cpu();
}
}
@ -156,10 +155,10 @@ fn init_thread() {
karg.get_initproc_envp().to_vec(),
)
.expect("Run init process failed.");
// Wait till initproc become zombie.
while !initproc.status().is_zombie() {
crate::thread::Thread::yield_now();
ostd::cpu::sleep_for_interrupt();
ostd::task::halt_cpu();
}
// TODO: exit via qemu isa debug device should not be the only way.