This commit is contained in:
Bryan McShea
2024-02-15 17:48:39 -05:00
parent 97f3c5bb93
commit 167b095bd1

View File

@@ -1,10 +1,30 @@
use linked_list_allocator::LockedHeap;
use core::alloc::Allocator;
#[global_allocator]
static ALLOCATOR: LockedHeap = LockedHeap::empty();
static ALLOCATOR: Alloc = Alloc::empty();
struct Alloc {
base: *mut u8,
cur: *mut u8,
}
unsafe impl Allocator for Alloc {
fn allocate(&self, layout: core::alloc::Layout) -> Result<core::ptr::NonNull<[u8]>, core::alloc::AllocError> {
}
}
impl Alloc {
pub fn empty() -> Self {
}
pub fn init(&mut self, start: *mut u8, len: usize) {
}
}
pub fn init_heap() {
unsafe {
ALLOCATOR.lock().init(crate::arch::paging::first_free(), crate::arch::paging::free_len());
ALLOCATOR.init(crate::arch::paging::first_free(), crate::arch::paging::free_len());
}
}