mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27:49 +00:00
33 lines
662 B
Rust
33 lines
662 B
Rust
#![cfg_attr(not(test), no_std)]
|
|
#![cfg_attr(not(test), no_main)]
|
|
#![cfg_attr(test, allow(unused_imports))]
|
|
|
|
use blog_os::println;
|
|
use core::panic::PanicInfo;
|
|
|
|
#[cfg(not(test))]
|
|
#[no_mangle]
|
|
pub extern "C" fn _start() -> ! {
|
|
println!("Hello World{}", "!");
|
|
|
|
blog_os::interrupts::init_idt();
|
|
|
|
fn stack_overflow() {
|
|
stack_overflow(); // for each recursion, the return address is pushed
|
|
}
|
|
|
|
// trigger a stack overflow
|
|
stack_overflow();
|
|
|
|
println!("It did not crash!");
|
|
loop {}
|
|
}
|
|
|
|
/// This function is called on panic.
|
|
#[cfg(not(test))]
|
|
#[panic_handler]
|
|
fn panic(info: &PanicInfo) -> ! {
|
|
println!("{}", info);
|
|
loop {}
|
|
}
|