From 167b095bd1f8f7d587f2f0ba7dba880021d6222f Mon Sep 17 00:00:00 2001 From: Bryan McShea Date: Thu, 15 Feb 2024 17:48:39 -0500 Subject: [PATCH] work --- kernel/src/allocator.rs | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/kernel/src/allocator.rs b/kernel/src/allocator.rs index 770d3ce..f82ad94 100644 --- a/kernel/src/allocator.rs +++ b/kernel/src/allocator.rs @@ -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::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()); } }