mirror of
https://github.com/AmbiML/sparrow-kata-full.git
synced 2025-07-21 09:29:20 +00:00
Change-Id: I4615cdc48996c2d8739a00a4c585d09faf03b63b GitOrigin-RevId: 9a0041d37df0d9526e29171f4c17d339579a44ef
38 lines
1.0 KiB
Rust
38 lines
1.0 KiB
Rust
/*
|
|
* 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");
|
|
}
|