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 {
|
2022-03-11 13:51:47 -06:00
|
|
|
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")
|
|
|
|
}
|
|
|
|
}
|