panic! now properly kernel panics instead of aborting the current process
This commit is contained in:
parent
dcf82e0b32
commit
f7c5b3aad4
@ -14,21 +14,18 @@ use core::panic::PanicInfo;
|
|||||||
|
|
||||||
#[panic_handler]
|
#[panic_handler]
|
||||||
fn panic(info: &PanicInfo<'_>) -> ! {
|
fn panic(info: &PanicInfo<'_>) -> ! {
|
||||||
|
print!("Kernel panic in ");
|
||||||
if let Some(tasking) = TASKING.try_lock() {
|
if let Some(tasking) = TASKING.try_lock() {
|
||||||
if let Some(pid) = tasking.current_pid() {
|
if let Some(pid) = tasking.current_pid() {
|
||||||
print!("PID {}", pid);
|
print!("PID {}", pid);
|
||||||
} else {
|
} else {
|
||||||
print!("Kernel Init");
|
print!("kernel init");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print!("PID Unknown");
|
print!("PID Unknown");
|
||||||
}
|
}
|
||||||
println!(" {info}");
|
println!(": {info}");
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
print_backtrace();
|
print_backtrace();
|
||||||
if let Some(mut tasking) = TASKING.try_lock() {
|
|
||||||
tasking.exit();
|
|
||||||
} else {
|
|
||||||
exit_qemu();
|
exit_qemu();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user