1
0
Fork 0
forked from AbleOS/ableos
ableos_time/ableos/src/allocator/aalloc.rs

21 lines
493 B
Rust
Raw Normal View History

2022-04-11 17:23:11 -05:00
//! The allocator to be implemented by ableOS
2021-11-27 09:19:08 -06:00
2021-11-23 05:53:06 -06:00
use alloc::alloc::{GlobalAlloc, Layout};
use core::ptr::null_mut;
2021-11-27 09:19:08 -06:00
pub struct AAloc;
unsafe impl GlobalAlloc for AAloc {
2021-11-23 05:53:06 -06:00
unsafe fn alloc(&self, _layout: Layout) -> *mut u8 {
println!("Allocating memory");
println!("{}", _layout.size());
println!("{}", _layout.align());
2021-11-23 05:53:06 -06:00
null_mut()
}
unsafe fn dealloc(&self, _ptr: *mut u8, _layout: Layout) {
panic!("dealloc should be never called")
}
}