diff --git a/src/qemu_exit.rs b/src/qemu_exit.rs index 5ff08be..d804f70 100644 --- a/src/qemu_exit.rs +++ b/src/qemu_exit.rs @@ -1,6 +1,6 @@ use x86_64::instructions::port::Port; -use crate::{kernel_heap::HEAP, physical_memory::PHYSICAL_MEMORY}; +use crate::{kernel_heap::HEAP, physical_memory::PHYSICAL_MEMORY, println}; pub fn exit_qemu() -> ! { PHYSICAL_MEMORY.lock().print_stats(); @@ -8,5 +8,9 @@ pub fn exit_qemu() -> ! { unsafe { Port::new(0xf4).write(0u32); } - unreachable!(); + println!("Failed to quit QEMU! Disabling interupts and halting CPU!"); + x86_64::instructions::interrupts::disable(); + loop { + x86_64::instructions::hlt(); + } }