standalone: Implement __nac3_raise for demo

This commit is contained in:
David Mak 2023-09-15 12:08:30 +08:00
parent 2c89ff0687
commit e9ef7a2af5
1 changed files with 12 additions and 2 deletions

View File

@ -1,3 +1,7 @@
use std::io;
use std::io::Write;
use std::process::exit;
mod cslice {
// copied from https://github.com/dherman/cslice
use std::marker::PhantomData;
@ -75,8 +79,14 @@ pub extern "C" fn __nac3_personality(_state: u32, _exception_object: u32, _conte
}
#[no_mangle]
pub extern "C" fn __nac3_raise(_state: u32, _exception_object: u32, _context: u32) -> u32 {
unimplemented!();
pub extern "C" fn __nac3_raise(state: u32, exception_object: u32, context: u32) -> u32 {
writeln!(io::stderr(),
"__nac3_raise(state: {:#010x}, _exception_object: {:#010x}, _context: {:#010x})",
state,
exception_object,
context
).unwrap();
exit(101);
}
extern "C" {