/* * Copyright 2021, Google LLC * * SPDX-License-Identifier: Apache-2.0 */ #![no_std] #![no_main] // This file is a minimal test application to check panic's WAI. extern crate libkata; use kata_os_common::logger::KataLogger; use kata_os_common::sel4_sys; // Message output is sent through the kata-os-logger which calls logger_log // to deliver data to the console. We use seL4_DebugPutChar to write to the // console which only works if DEBUG_PRINTING is enabled in the kernel. #[no_mangle] #[allow(unused_variables)] pub fn logger_log(_level: u8, msg: *const cstr_core::c_char) { #[cfg(feature = "CONFIG_PRINTING")] unsafe { for c in cstr_core::CStr::from_ptr(msg).to_bytes() { let _ = sel4_sys::seL4_DebugPutChar(*c); } let _ = sel4_sys::seL4_DebugPutChar(b'\n'); } } #[no_mangle] pub fn main() { static KATA_LOGGER: KataLogger = KataLogger; log::set_logger(&KATA_LOGGER).unwrap(); log::set_max_level(log::LevelFilter::Trace); panic!("Goodbye, cruel world"); }