pub type ExitCode = crate::bindings::exit_code;
#[cfg(not(feature = "kernel"))]
pub fn twz_rt_exit(code: ExitCode) -> ! {
unsafe {
crate::bindings::twz_rt_exit(code);
unreachable!()
}
}
#[cfg(not(feature = "kernel"))]
pub fn twz_rt_abort() -> ! {
unsafe {
crate::bindings::twz_rt_abort();
unreachable!()
}
}
#[cfg(not(feature = "kernel"))]
pub fn twz_rt_pre_main_hook() -> Option<ExitCode> {
unsafe { crate::bindings::twz_rt_pre_main_hook().into() }
}
impl From<crate::bindings::option_exit_code> for Option<ExitCode> {
#[inline]
fn from(value: crate::bindings::option_exit_code) -> Self {
if value.is_some == 0 {
None
} else {
Some(value.value)
}
}
}
#[cfg(not(feature = "kernel"))]
pub fn twz_rt_post_main_hook() {
unsafe {
crate::bindings::twz_rt_post_main_hook();
}
}
pub use crate::bindings::{
basic_aux as BasicAux, basic_return as BasicReturn, comp_init_info as CompartmentInitInfo,
init_info_ptrs as InitInfoPtrs, minimal_init_info as MinimalInitInfo,
runtime_info as RuntimeInfo, RUNTIME_INIT_COMP, RUNTIME_INIT_MIN, RUNTIME_INIT_MONITOR,
};
#[cfg(not(feature = "kernel"))]
pub fn twz_rt_runtime_entry(
info: *const RuntimeInfo,
std_entry: unsafe extern "C-unwind" fn(BasicAux) -> BasicReturn,
) -> ! {
unsafe {
crate::bindings::twz_rt_runtime_entry(info, Some(std_entry));
unreachable!()
}
}