29 lines
582 B
Rust
29 lines
582 B
Rust
use core::panic::PanicInfo;
|
|
use crate::println;
|
|
|
|
pub fn clear_bss() {
|
|
extern "C" {
|
|
fn start_bss();
|
|
|
|
fn end_bss();
|
|
}
|
|
|
|
for i in start_bss as usize..end_bss as usize {
|
|
unsafe {
|
|
(i as *mut u8).write_volatile(0)
|
|
}
|
|
}
|
|
}
|
|
|
|
#[panic_handler]
|
|
fn panic_handler(info: &PanicInfo) -> ! {
|
|
let message = info.message();
|
|
|
|
if let Some(location) = info.location() {
|
|
println!("Panicked at {}:{} {}", location.file(), location.line(), message);
|
|
} else {
|
|
println!("Panicked: {}", message);
|
|
}
|
|
|
|
unreachable!()
|
|
} |