Merge branch 'post-05-new' into post-06-new-rebased

This commit is contained in:
Philipp Oppermann
2019-04-26 15:05:55 +02:00
17 changed files with 264 additions and 245 deletions

View File

@@ -1,17 +1,18 @@
#![cfg_attr(not(test), no_std)]
#![cfg_attr(not(test), no_main)]
#![cfg_attr(test, allow(unused_imports))]
#![no_std]
#![no_main]
#![feature(custom_test_frameworks)]
#![test_runner(blog_os::test_runner)]
#![reexport_test_harness_main = "test_main"]
use blog_os::println;
use core::panic::PanicInfo;
#[cfg(not(test))]
#[no_mangle]
pub extern "C" fn _start() -> ! {
println!("Hello World{}", "!");
blog_os::gdt::init();
blog_os::interrupts::init_idt();
blog_os::init();
fn stack_overflow() {
stack_overflow(); // for each recursion, the return address is pushed
@@ -20,6 +21,9 @@ pub extern "C" fn _start() -> ! {
// trigger a stack overflow
stack_overflow();
#[cfg(test)]
test_main();
println!("It did not crash!");
loop {}
}
@@ -31,3 +35,9 @@ fn panic(info: &PanicInfo) -> ! {
println!("{}", info);
loop {}
}
#[cfg(test)]
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
blog_os::test_panic_handler(info)
}