mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 22:37:49 +00:00
29 lines
772 B
Rust
29 lines
772 B
Rust
#![feature(panic_implementation)] // required for defining the panic handler
|
|
#![no_std] // don't link the Rust standard library
|
|
#![cfg_attr(not(test), no_main)] // disable all Rust-level entry points
|
|
#![cfg_attr(test, allow(dead_code, unused_macros, unused_imports))]
|
|
|
|
#[macro_use]
|
|
extern crate blog_os;
|
|
|
|
use core::panic::PanicInfo;
|
|
|
|
/// This function is the entry point, since the linker looks for a function
|
|
/// named `_start_` by default.
|
|
#[cfg(not(test))]
|
|
#[no_mangle] // don't mangle the name of this function
|
|
pub extern "C" fn _start() -> ! {
|
|
println!("Hello World{}", "!");
|
|
|
|
loop {}
|
|
}
|
|
|
|
/// This function is called on panic.
|
|
#[cfg(not(test))]
|
|
#[panic_implementation]
|
|
#[no_mangle]
|
|
pub fn panic(info: &PanicInfo) -> ! {
|
|
println!("{}", info);
|
|
loop {}
|
|
}
|