This commit is contained in:
Philipp Oppermann
2019-03-18 18:28:04 +01:00
parent 4acf12bb69
commit 398ca5357c
12 changed files with 428 additions and 16 deletions

View File

@@ -1,8 +1,11 @@
#![cfg_attr(not(test), no_std)]
#![cfg_attr(not(test), no_main)]
#![cfg_attr(test, allow(unused_imports))]
#![feature(alloc_error_handler)]
use blog_os::memory::allocator::DummyAllocator;
use blog_os::{exit_qemu, serial_println};
use core::alloc::Layout;
use core::panic::PanicInfo;
#[cfg(not(test))]
@@ -21,3 +24,11 @@ fn panic(_info: &PanicInfo) -> ! {
}
loop {}
}
#[global_allocator]
static ALLOCATOR: DummyAllocator = DummyAllocator;
#[alloc_error_handler]
fn out_of_memory(layout: Layout) -> ! {
panic!("out of memory: allocation for {:?} failed", layout);
}