Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
Signed-off-by: Graham MacDonald <[email protected]>
  • Loading branch information
gmacd committed May 27, 2024
1 parent f65649a commit 3db5e93
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
6 changes: 3 additions & 3 deletions aarch64/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand All @@ -52,4 +52,4 @@ unsafe impl GlobalAlloc for FakeAlloc {
}

#[global_allocator]
static FAKE_ALLOCATOR: FakeAlloc = FakeAlloc {};
static VMEM_ALLOCATOR: VmemAllocator = VmemAllocator {};
4 changes: 1 addition & 3 deletions aarch64/src/vmalloc.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use core::mem::MaybeUninit;

use port::{
boundarytag::Arena,
mcslock::{Lock, LockNode},
mem::VirtRange,
vmem::Arena,
};

static VMALLOC: Lock<Option<&'static mut VmAlloc>> = Lock::new("vmalloc", None);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion port/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
File renamed without changes.

0 comments on commit 3db5e93

Please sign in to comment.