Skip to content

Commit

Permalink
crates/sel4-static-heap: Remove
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Spinale <nick@nickspinale.com>
  • Loading branch information
nspin committed Oct 24, 2024
1 parent 0fced21 commit 8b7826e
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 87 deletions.
5 changes: 0 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ members = [
"crates/sel4-shared-ring-buffer/bookkeeping",
"crates/sel4-shared-ring-buffer/smoltcp",
"crates/sel4-stack",
"crates/sel4-static-heap",
"crates/sel4-sync",
"crates/sel4-sync/trivial",
"crates/sel4-synthetic-elf",
Expand Down
5 changes: 1 addition & 4 deletions crates/sel4-dlmalloc/Cargo.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# SPDX-License-Identifier: BSD-2-Clause
#

{ mk, versions, localCrates }:
{ mk, versions }:

mk {
package.name = "sel4-dlmalloc";
Expand All @@ -13,8 +13,5 @@ mk {
inherit (versions)
lock_api
;
inherit (localCrates)
sel4-static-heap
;
};
}
1 change: 0 additions & 1 deletion crates/sel4-dlmalloc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ license = "BSD-2-Clause"
[dependencies]
dlmalloc = "0.2.3"
lock_api = "0.4.12"
sel4-static-heap = { path = "../sel4-static-heap" }
29 changes: 25 additions & 4 deletions crates/sel4-dlmalloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@
#![no_std]

use core::alloc::{GlobalAlloc, Layout};
use core::cell::RefCell;
use core::cell::{RefCell, UnsafeCell};
use core::mem;
use core::ptr;

use dlmalloc::{Allocator as DlmallocAllocator, Dlmalloc};
use lock_api::{Mutex, RawMutex};

pub use sel4_static_heap::StaticHeap;

pub type StaticDlmallocGlobalAlloc<R, T> = DlmallocGlobalAlloc<R, StaticDlmallocAllocator<T>>;

impl<R, T> StaticDlmallocGlobalAlloc<R, T> {
Expand Down Expand Up @@ -186,8 +184,31 @@ impl<T: FnOnce() -> StaticHeapBounds> GetStaticHeapBounds for T {
}
}

#[repr(C)]
pub struct StaticHeap<const N: usize, A = ()> {
_alignment: [A; 0],
space: UnsafeCell<[u8; N]>,
}

unsafe impl<const N: usize, A> Sync for StaticHeap<N, A> {}

impl<const N: usize, A> StaticHeap<N, A> {
pub const fn new() -> Self {
Self {
_alignment: [],
space: UnsafeCell::new([0; N]),
}
}
}

impl<const N: usize, A> Default for StaticHeap<N, A> {
fn default() -> Self {
Self::new()
}
}

impl<const N: usize> GetStaticHeapBounds for &StaticHeap<N> {
fn bounds(self) -> StaticHeapBounds {
StaticHeapBounds::new(self.start(), self.size())
StaticHeapBounds::new(self.space.get().cast(), N)
}
}
11 changes: 0 additions & 11 deletions crates/sel4-static-heap/Cargo.nix

This file was deleted.

17 changes: 0 additions & 17 deletions crates/sel4-static-heap/Cargo.toml

This file was deleted.

44 changes: 0 additions & 44 deletions crates/sel4-static-heap/src/lib.rs

This file was deleted.

0 comments on commit 8b7826e

Please sign in to comment.