pub struct BitmapFrameAllocator { /* private fields */ }Expand description
Bitmap-based frame allocator
Implementations§
Source§impl BitmapFrameAllocator
impl BitmapFrameAllocator
Sourcepub unsafe fn init(&mut self, memory_map: &'static MemoryMapResponse)
pub unsafe fn init(&mut self, memory_map: &'static MemoryMapResponse)
Initialize the allocator from the memory map
§Safety
This function is unsafe because the caller must guarantee that:
- The passed memory map is valid
- All frames marked as
USABLEin it are really unused
Sourcepub fn allocate_contiguous(&mut self, count: usize) -> Option<PhysFrame>
pub fn allocate_contiguous(&mut self, count: usize) -> Option<PhysFrame>
Allocate a contiguous block of frames
Sourcepub fn deallocate_frame(&mut self, frame: PhysFrame)
pub fn deallocate_frame(&mut self, frame: PhysFrame)
Deallocate a frame
Sourcepub fn deallocate_contiguous(&mut self, frame: PhysFrame, count: usize)
pub fn deallocate_contiguous(&mut self, frame: PhysFrame, count: usize)
Deallocate a contiguous block of frames
Sourcepub fn stats(&self) -> FrameStats
pub fn stats(&self) -> FrameStats
Get memory statistics
Sourcepub fn is_allocated(&self, frame: PhysFrame) -> bool
pub fn is_allocated(&self, frame: PhysFrame) -> bool
Check if a frame is allocated
Sourcepub fn free_frames(&self) -> usize
pub fn free_frames(&self) -> usize
Get the number of free frames
Trait Implementations§
Source§impl FrameAllocator<Size4KiB> for BitmapFrameAllocator
impl FrameAllocator<Size4KiB> for BitmapFrameAllocator
Source§fn allocate_frame(&mut self) -> Option<PhysFrame>
fn allocate_frame(&mut self) -> Option<PhysFrame>
Allocate a frame of the appropriate size and return it if possible.
Auto Trait Implementations§
impl Freeze for BitmapFrameAllocator
impl RefUnwindSafe for BitmapFrameAllocator
impl Send for BitmapFrameAllocator
impl Sync for BitmapFrameAllocator
impl Unpin for BitmapFrameAllocator
impl UnwindSafe for BitmapFrameAllocator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more