sel4_microkit/
heap.rs
1#[doc(hidden)]
8#[macro_export]
9macro_rules! declare_heap {
10 ($size:expr) => {
11 const _: () = {
12 mod _scope {
13 mod size_scope {
14 use super::super::*;
15 pub(super) const SIZE: usize = $size;
16 }
17
18 use $crate::_private::heap::*;
19
20 static STATIC_HEAP: StaticHeap<{ size_scope::SIZE }> = StaticHeap::new();
21
22 #[global_allocator]
23 static GLOBAL_ALLOCATOR: StaticDlmalloc<RawOneShotMutex> =
24 StaticDlmalloc::new(STATIC_HEAP.bounds());
25 }
26 };
27 };
28}
29
30pub mod _private {
31 pub use one_shot_mutex::sync::RawOneShotMutex;
32 pub use sel4_dlmalloc::{StaticDlmalloc, StaticHeap};
33}