From 0037b95733415cc8d8927f31f64db49a9820d182 Mon Sep 17 00:00:00 2001 From: Graham MacDonald Date: Mon, 27 May 2024 22:07:29 +0100 Subject: [PATCH] tidy Signed-off-by: Graham MacDonald --- aarch64/src/runtime.rs | 6 +++--- aarch64/src/vmalloc.rs | 4 +--- port/src/lib.rs | 2 +- port/src/{boundarytag.rs => vmem.rs} | 0 4 files changed, 5 insertions(+), 7 deletions(-) rename port/src/{boundarytag.rs => vmem.rs} (100%) 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 5132606..44a9e6e 100644 --- a/port/src/lib.rs +++ b/port/src/lib.rs @@ -5,9 +5,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