MCPcopy Create free account
hub / github.com/bendudson/EuraliOS / MultilevelBitmapFrameAllocator

Class MultilevelBitmapFrameAllocator

kernel/src/memory/frame_allocator.rs:78–95  ·  view source on GitHub ↗

An allocator which uses bitmaps to keep track of available frames At the lowest level one bit represents one frame (1 = available) Higher levels indicate whether chunks of 32 bits at level-1 have ANY non-zero bits. Multiple levels are used, until the top level has only a single chunk of up to 32 bits.

Source from the content-addressed store, hash-verified

76/// only a single chunk of up to 32 bits.
77///
78pub struct MultilevelBitmapFrameAllocator {
79 /// Virtual address of the first level 2 entry
80 /// Each entry is 32 bits long, one bit per level-1 entry
81 bitmap_virt_addr: [VirtAddr; FRAME_ALLOCATOR_MAX_LEVELS],
82
83 /// Number of frames
84 nframes: u64,
85
86 /// Number of levels
87 nlevels: usize,
88
89 /// Physical start address of the frames
90 frame_phys_addr: PhysAddr,
91
92 /// Stack of up to FRAME_ALLOCATOR_STACK_SIZE frames
93 frame_stack: [u64; FRAME_ALLOCATOR_STACK_SIZE],
94 frame_stack_number: usize,
95}
96
97impl MultilevelBitmapFrameAllocator {
98

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected