Skip to content

Commit

Permalink
Minimise diff
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasgoergens committed Dec 10, 2024
1 parent c27881f commit ef10c0a
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions ceno_rt/src/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,6 @@ struct SimpleAllocator {
next_alloc: *mut u8,
}

extern "C" {
/// The address of this variable is the start of the heap (growing upwards).
///
/// It is defined in the linker script.
static mut _sheap: u8;
}

#[global_allocator]
static mut HEAP: SimpleAllocator = SimpleAllocator {
next_alloc: &raw mut _sheap,
};

unsafe impl GlobalAlloc for SimpleAllocator {
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
// SAFETY: Single threaded, so nothing else can touch this while we're working.
Expand Down Expand Up @@ -46,3 +34,15 @@ unsafe impl GlobalAlloc for SimpleAllocator {
/// Never deallocate.
unsafe fn dealloc(&self, _ptr: *mut u8, _layout: Layout) {}
}

extern "C" {
/// The address of this variable is the start of the heap (growing upwards).
///
/// It is defined in the linker script.
static mut _sheap: u8;
}

#[global_allocator]
static mut HEAP: SimpleAllocator = SimpleAllocator {
next_alloc: &raw mut _sheap,
};

0 comments on commit ef10c0a

Please sign in to comment.