diff --git a/moon/src/panic.rs b/moon/src/panic.rs index 91cafe83..670af050 100644 --- a/moon/src/panic.rs +++ b/moon/src/panic.rs @@ -1,9 +1,12 @@ use core::panic::PanicInfo; -use crate::println; +use crate::try_println; +use crate::arch::io::SERIAL; +use crate::arch::cpu; #[panic_handler] fn panic(info: &PanicInfo) -> ! { - println!("Kernel {}", info); - loop {} + unsafe { SERIAL.force_unlock(); } // since we're panicking, this is not relevant anymore. + try_println!("Kernel {}", info); // we probably should succeed, unless another CPU locked the serial port just after we unlocked it but before try_println attempts to lock it. + cpu::halt(); } \ No newline at end of file