Next Generation WASM Microkernel Operating System
at main 32 lines 990 B view raw
1// Copyright 2025 Jonas Kruckenberg 2// 3// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or 4// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or 5// http://opensource.org/licenses/MIT>, at your option. This file may not be 6// copied, modified, or distributed except according to those terms. 7 8use k23_abort::abort; 9 10use crate::arch; 11 12#[panic_handler] 13fn panic(info: &core::panic::PanicInfo) -> ! { 14 // disable interrupts as soon as we enter the panic subsystem 15 // no need to bother with those now as we're about to shut down anyway 16 arch::interrupt::disable(); 17 18 let loc = info.location().unwrap(); // The current implementation always returns Some 19 let msg = info.message(); 20 21 log::error!("cpu panicked at {loc}:\n{msg}"); 22 23 rust_panic() 24} 25 26/// Mirroring std, this is an unmangled function on which to slap 27/// yer breakpoints for backtracing panics. 28#[inline(never)] 29#[unsafe(no_mangle)] 30fn rust_panic() -> ! { 31 abort() 32}