Keep track of AP count, allocate bigger AP stack, stack trace function

This commit is contained in:
Jeremy Soller 2016-08-17 19:34:33 -06:00
commit 0d995bfb5c

View file

@ -1,6 +1,6 @@
//! Intrinsics for panic handling
use interrupt::halt;
use interrupt;
#[cfg(not(test))]
#[lang = "eh_personality"]
@ -10,28 +10,15 @@ extern "C" fn eh_personality() {}
/// Required to handle panics
#[lang = "panic_fmt"]
extern "C" fn panic_fmt(fmt: ::core::fmt::Arguments, file: &str, line: u32) -> ! {
let mut rbp: usize;
unsafe { asm!("xchg bx, bx" : "={rbp}"(rbp) : : : "intel", "volatile"); }
println!("PANIC: {}", fmt);
println!("FILE: {}", file);
println!("LINE: {}", line);
println!("TRACE: {:>016X}", rbp);
for _frame in 0..16 { //Maximum 16 frames
unsafe {
let rip = *(rbp as *const usize).offset(1);
println!(" {:>016X}: {:>016X}", rbp, rip);
if rip == 0 {
break;
}
rbp = *(rbp as *const usize);
}
}
unsafe { interrupt::stack_trace(); }
println!("HALT");
loop {
unsafe { halt() };
unsafe { interrupt::halt(); }
}
}
@ -40,6 +27,6 @@ extern "C" fn panic_fmt(fmt: ::core::fmt::Arguments, file: &str, line: u32) -> !
/// Required to handle panics
pub extern "C" fn _Unwind_Resume() -> ! {
loop {
unsafe { halt() }
unsafe { interrupt::halt(); }
}
}