mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 22:37:49 +00:00
WIP
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user