ableos/ableos/src/allocator/aalloc.rs

21 lines
493 B
Rust

//! The allocator to be implemented by ableOS
use alloc::alloc::{GlobalAlloc, Layout};
use core::ptr::null_mut;
pub struct AAloc;
unsafe impl GlobalAlloc for AAloc {
unsafe fn alloc(&self, _layout: Layout) -> *mut u8 {
println!("Allocating memory");
println!("{}", _layout.size());
println!("{}", _layout.align());
null_mut()
}
unsafe fn dealloc(&self, _ptr: *mut u8, _layout: Layout) {
panic!("dealloc should be never called")
}
}