blog_os/src/main.rs

38 lines
650 B
Rust
Raw Normal View History

2019-09-23 16:12:07 -04:00
#![no_std]
#![no_main]
2019-09-24 13:38:25 -04:00
#![feature(custom_test_frameworks)]
#![test_runner(blog_os::test_runner)]
#![reexport_test_harness_main = "test_main"]
2019-09-23 16:12:07 -04:00
use core::panic::PanicInfo;
2019-09-24 13:38:25 -04:00
use blog_os::println;
2019-09-24 10:20:27 -04:00
2019-09-23 16:12:07 -04:00
/// This function is called on panic.
2019-09-24 13:38:25 -04:00
#[cfg(not(test))]
2019-09-23 16:12:07 -04:00
#[panic_handler]
2019-09-24 10:20:27 -04:00
fn panic(info: &PanicInfo) -> ! {
println!("{}", info);
2019-09-23 16:12:07 -04:00
loop {}
}
2019-09-24 13:38:25 -04:00
#[cfg(test)]
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
blog_os::test_panic_handler(info)
}
2019-09-23 16:12:07 -04:00
#[no_mangle]
pub extern "C" fn _start() -> ! {
2019-09-24 13:38:25 -04:00
println!("Hello World{}", "!");
2019-09-24 16:24:38 -04:00
blog_os::init();
x86_64::instructions::interrupts::int3();
2019-09-24 13:38:25 -04:00
#[cfg(test)]
test_main();
2019-09-23 16:31:22 -04:00
2019-09-23 16:12:07 -04:00
loop {}
}