Expand description
§Minimal Bitmap-based Physical Memory Manager (PMM)
This module provides a minimal, no-heap physical memory manager for 4K frames, using a bitmap to track free/used frames in a fixed region. It is suitable for early kernel use or as a foundation for a more advanced PMM.
§Features
- Tracks allocation and freeing of 4K frames using a bitmap.
- No heap required; all state is stored inline.
- Can be extended to initialize from a memory map.
§Usage Example
use kernel_alloc::frame_alloc::BitmapFrameAlloc;
use kernel_vmem::FrameAlloc;
let mut pmm = BitmapFrameAlloc::new();
let frame = pmm.alloc_4k();
if let Some(pa) = frame {
// Use the physical address...
pmm.free_4k(pa);
}§Safety
- Only physical addresses within the managed region are tracked.
- The user must ensure that reserved/used frames (e.g., kernel, bootloader) are marked as used before allocation.
- No synchronization is provided; not thread-safe.
Structs§
- Bitmap
Frame Alloc - Minimal bitmap-based PMM for 4K frames in a fixed region.