initial commit
This commit is contained in:
commit
caec0b8ac9
27 changed files with 4786 additions and 0 deletions
20
crates/haku-wasm/src/panicking.rs
Normal file
20
crates/haku-wasm/src/panicking.rs
Normal file
|
@ -0,0 +1,20 @@
|
|||
use core::fmt::Write;
|
||||
|
||||
use alloc::string::String;
|
||||
|
||||
extern "C" {
|
||||
fn panic(message_len: u32, message: *const u8) -> !;
|
||||
}
|
||||
|
||||
fn panic_impl(info: &core::panic::PanicInfo) -> ! {
|
||||
let mut message = String::new();
|
||||
_ = write!(&mut message, "{info}");
|
||||
|
||||
unsafe { panic(message.len() as u32, message.as_ptr()) };
|
||||
}
|
||||
|
||||
#[cfg(not(test))]
|
||||
#[panic_handler]
|
||||
fn panic_handler(info: &core::panic::PanicInfo) -> ! {
|
||||
panic_impl(info)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue