XeOS/src/main.rs

36 lines
694 B
Rust
Raw Normal View History

2019-10-23 23:19:02 +00:00
#![no_std]
#![no_main]
#![feature(custom_test_frameworks)]
#![test_runner(xe_os::test_runner)]
#![reexport_test_harness_main = "test_main"]
use core::panic::PanicInfo;
use xe_os::println;
#[no_mangle]
pub extern "C" fn _start() -> ! {
xe_os::init();
println!("Hello World{}", "!");
#[cfg(test)]
test_main();
println!("It did not crash!");
2019-10-23 23:36:24 +00:00
xe_os::hlt_loop();
2019-10-23 23:19:02 +00:00
}
// our existing panic handler
#[cfg(not(test))] // new attribute
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
println!("{}", info);
2019-10-23 23:36:24 +00:00
xe_os::hlt_loop();
2019-10-23 23:19:02 +00:00
}
// our panic handler in test mode
#[cfg(test)]
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
xe_os::test_panic_handler(info);
}