From f7c5b3aad4f1f32acc68e91d799b3ace10b7ce01 Mon Sep 17 00:00:00 2001 From: pjht Date: Tue, 6 Aug 2024 18:39:11 -0500 Subject: [PATCH] panic! now properly kernel panics instead of aborting the current process --- src/panic_handler.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/panic_handler.rs b/src/panic_handler.rs index ca2f3b2..15da367 100644 --- a/src/panic_handler.rs +++ b/src/panic_handler.rs @@ -14,21 +14,18 @@ use core::panic::PanicInfo; #[panic_handler] fn panic(info: &PanicInfo<'_>) -> ! { + print!("Kernel panic in "); if let Some(tasking) = TASKING.try_lock() { if let Some(pid) = tasking.current_pid() { print!("PID {}", pid); } else { - print!("Kernel Init"); + print!("kernel init"); } } else { print!("PID Unknown"); } - println!(" {info}"); + println!(": {info}"); #[cfg(debug_assertions)] print_backtrace(); - if let Some(mut tasking) = TASKING.try_lock() { - tasking.exit(); - } else { - exit_qemu(); - } + exit_qemu(); }