diff --git a/src/tasking.rs b/src/tasking.rs index 64946d4..1edf895 100644 --- a/src/tasking.rs +++ b/src/tasking.rs @@ -289,6 +289,7 @@ impl Tasking { pub fn exit(&self) -> ! { let next_process_pid = self.ready_to_run.lock().pop_front(); if let Some(next_process_pid) = next_process_pid { + self.wfi_loop.store(false, Ordering::Relaxed); #[warn(clippy::indexing_slicing, reason = "FIXME(?)")] let mut processes = self.processes.write(); if let Some(current_pid) = *self.current_pid.read() { @@ -312,9 +313,11 @@ impl Tasking { switch_to_asm_exit(kernel_esp); unreachable!() } else { - println!("Last non-sleeping process exited, exiting QEMU"); - self.print_stats(); - qemu_exit::exit_qemu(); + //println!("Last non-sleeping process exited, exiting QEMU"); + self.wfi_loop.store(true, Ordering::Relaxed); + x86_64::instructions::interrupts::enable_and_hlt(); + x86_64::instructions::interrupts::disable(); + self.exit(); } }