Struct vm_memory::bitmap::AtomicBitmap
source · [−]pub struct AtomicBitmap { /* private fields */ }Expand description
AtomicBitmap implements a simple bit map on the page level with test and set operations.
It is page-size aware, so it converts addresses to page numbers before setting or clearing
the bits.
Implementations
sourceimpl AtomicBitmap
impl AtomicBitmap
sourcepub fn new(byte_size: usize, page_size: usize) -> Self
pub fn new(byte_size: usize, page_size: usize) -> Self
Create a new bitmap of byte_size, with one bit per page. This is effectively
rounded up, and we get a new vector of the next multiple of 64 bigger than bit_size.
sourcepub fn is_bit_set(&self, index: usize) -> bool
pub fn is_bit_set(&self, index: usize) -> bool
Is bit n set? Bits outside the range of the bitmap are always unset.
sourcepub fn is_addr_set(&self, addr: usize) -> bool
pub fn is_addr_set(&self, addr: usize) -> bool
Is the bit corresponding to address addr set?
sourcepub fn set_addr_range(&self, start_addr: usize, len: usize)
pub fn set_addr_range(&self, start_addr: usize, len: usize)
Set a range of len bytes starting at start_addr. The first bit set in the bitmap
is for the page corresponding to start_addr, and the last bit that we set corresponds
to address start_addr + len - 1.
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Get the length of the bitmap in bits (i.e. in how many pages it can represent).
sourcepub fn get_and_reset(&self) -> Vec<u64>
pub fn get_and_reset(&self) -> Vec<u64>
Atomically get and reset the dirty page bitmap.
Trait Implementations
sourceimpl Bitmap for AtomicBitmap
impl Bitmap for AtomicBitmap
sourceimpl Clone for AtomicBitmap
impl Clone for AtomicBitmap
sourceimpl Debug for AtomicBitmap
impl Debug for AtomicBitmap
sourceimpl Default for AtomicBitmap
impl Default for AtomicBitmap
sourceimpl NewBitmap for AtomicBitmap
impl NewBitmap for AtomicBitmap
sourceimpl<'a> WithBitmapSlice<'a> for AtomicBitmap
impl<'a> WithBitmapSlice<'a> for AtomicBitmap
type S = BaseSlice<&'a AtomicBitmap>
type S = BaseSlice<&'a AtomicBitmap>
Type of the bitmap slice.
Auto Trait Implementations
impl RefUnwindSafe for AtomicBitmap
impl Send for AtomicBitmap
impl Sync for AtomicBitmap
impl Unpin for AtomicBitmap
impl UnwindSafe for AtomicBitmap
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more