diff --git a/aarch64/src/runtime.rs b/aarch64/src/runtime.rs index aa65a36..a5740fb 100644 --- a/aarch64/src/runtime.rs +++ b/aarch64/src/runtime.rs @@ -40,9 +40,9 @@ fn oom(_layout: Layout) -> ! { panic!("oom"); } -struct FakeAlloc; +struct VmemAllocator; -unsafe impl GlobalAlloc for FakeAlloc { +unsafe impl GlobalAlloc for VmemAllocator { unsafe fn alloc(&self, _layout: Layout) -> *mut u8 { panic!("fake alloc"); } @@ -52,4 +52,4 @@ unsafe impl GlobalAlloc for FakeAlloc { } #[global_allocator] -static FAKE_ALLOCATOR: FakeAlloc = FakeAlloc {}; +static VMEM_ALLOCATOR: VmemAllocator = VmemAllocator {}; diff --git a/aarch64/src/vmalloc.rs b/aarch64/src/vmalloc.rs index df677d5..e6d0173 100644 --- a/aarch64/src/vmalloc.rs +++ b/aarch64/src/vmalloc.rs @@ -1,9 +1,9 @@ use core::mem::MaybeUninit; use port::{ - boundarytag::Arena, mcslock::{Lock, LockNode}, mem::VirtRange, + vmem::Arena, }; static VMALLOC: Lock> = Lock::new("vmalloc", None); @@ -46,8 +46,6 @@ pub fn init(heap_range: VirtRange) { }); } -// TODO Add VmFlag (BestFit, InstantFit, NextFit) - pub fn alloc(size: usize) -> *mut u8 { let node = LockNode::new(); let mut lock = VMALLOC.lock(&node); diff --git a/port/src/lib.rs b/port/src/lib.rs index 8ada5c1..6fb214d 100644 --- a/port/src/lib.rs +++ b/port/src/lib.rs @@ -6,9 +6,9 @@ #![forbid(unsafe_op_in_unsafe_fn)] pub mod bitmapalloc; -pub mod boundarytag; pub mod dat; pub mod devcons; pub mod fdt; pub mod mcslock; pub mod mem; +pub mod vmem; diff --git a/port/src/boundarytag.rs b/port/src/vmem.rs similarity index 100% rename from port/src/boundarytag.rs rename to port/src/vmem.rs