Small Fix && cargo fmt
This commit is contained in:
parent
c9583b0f53
commit
ae3ba9c26f
83 changed files with 1085 additions and 1079 deletions
|
@ -1,16 +1,23 @@
|
|||
use core::panic::PanicInfo;
|
||||
use core::arch::asm;
|
||||
use crate::sbi::shutdown;
|
||||
use crate::task::current_kstack_top;
|
||||
use core::arch::asm;
|
||||
use core::panic::PanicInfo;
|
||||
|
||||
#[panic_handler]
|
||||
fn panic(info: &PanicInfo) -> ! {
|
||||
if let Some(location) = info.location() {
|
||||
println!("[kernel] Panicked at {}:{} {}", location.file(), location.line(), info.message().unwrap());
|
||||
println!(
|
||||
"[kernel] Panicked at {}:{} {}",
|
||||
location.file(),
|
||||
location.line(),
|
||||
info.message().unwrap()
|
||||
);
|
||||
} else {
|
||||
println!("[kernel] Panicked: {}", info.message().unwrap());
|
||||
}
|
||||
unsafe { backtrace(); }
|
||||
unsafe {
|
||||
backtrace();
|
||||
}
|
||||
shutdown()
|
||||
}
|
||||
|
||||
|
@ -20,9 +27,11 @@ unsafe fn backtrace() {
|
|||
asm!("mv {}, s0", out(reg) fp);
|
||||
println!("---START BACKTRACE---");
|
||||
for i in 0..10 {
|
||||
if fp == stop { break; }
|
||||
println!("#{}:ra={:#x}", i, *((fp-8) as *const usize));
|
||||
fp = *((fp-16) as *const usize);
|
||||
if fp == stop {
|
||||
break;
|
||||
}
|
||||
println!("#{}:ra={:#x}", i, *((fp - 8) as *const usize));
|
||||
fp = *((fp - 16) as *const usize);
|
||||
}
|
||||
println!("---END BACKTRACE---");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue