tangled
alpha
login
or
join now
jonaskruckenberg.de
/
k23
0
fork
atom
Next Generation WASM Microkernel Operating System
0
fork
atom
overview
issues
pulls
3
pipelines
chore: implement debug for BootstrapAllocator
Jonas Kruckenberg
2 months ago
3a64e206
63b8d62a
+14
-1
1 changed file
expand all
collapse all
unified
split
libs
kmem
src
bootstrap
frame_allocator.rs
+14
-1
libs/kmem/src/bootstrap/frame_allocator.rs
···
1
1
use core::alloc::Layout;
2
2
+
use core::fmt;
2
3
use core::num::NonZeroUsize;
3
4
use core::ops::Range;
4
4
-
5
5
use arrayvec::ArrayVec;
6
6
use lock_api::Mutex;
7
7
···
19
19
page_size: usize,
20
20
}
21
21
22
22
+
#[derive(Debug)]
22
23
struct BootstrapAllocatorInner<const MAX_REGIONS: usize> {
23
24
regions: ArrayVec<Range<PhysicalAddress>, MAX_REGIONS>,
24
25
// offset from the top of memory regions
25
26
offset: usize,
27
27
+
}
28
28
+
29
29
+
impl<R, const MAX_REGIONS: usize> fmt::Debug for BootstrapAllocator<R, MAX_REGIONS>
30
30
+
where
31
31
+
R: lock_api::RawMutex,
32
32
+
{
33
33
+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
34
34
+
f.debug_struct("BootstrapAllocator")
35
35
+
.field("regions", &self.inner.lock())
36
36
+
.field("page_size", &self.page_size)
37
37
+
.finish()
38
38
+
}
26
39
}
27
40
28
41
impl<R, const MAX_REGIONS: usize> BootstrapAllocator<R, MAX_REGIONS>