Struct vm_memory::MmapRegion
source · pub struct MmapRegion<B> { /* private fields */ }Expand description
Helper structure for working with mmaped memory regions in Unix.
The structure is used for accessing the guest’s physical memory by mmapping it into the current process.
Limitations
When running a 64-bit virtual machine on a 32-bit hypervisor, only part of the guest’s physical memory may be mapped into the current process due to the limited virtual address space size of the process.
Implementations
sourceimpl<B: NewBitmap> MmapRegion<B>
impl<B: NewBitmap> MmapRegion<B>
sourceimpl<B: Bitmap> MmapRegion<B>
impl<B: Bitmap> MmapRegion<B>
sourcepub fn as_ptr(&self) -> *mut u8
pub fn as_ptr(&self) -> *mut u8
Returns a pointer to the beginning of the memory region. Mutable accesses performed using the resulting pointer are not automatically accounted for by the dirty bitmap tracking functionality.
Should only be used for passing this region to ioctls for setting guest memory.
sourcepub fn file_offset(&self) -> Option<&FileOffset>
pub fn file_offset(&self) -> Option<&FileOffset>
Returns information regarding the offset into the file backing this region (if any).
Trait Implementations
sourceimpl<B: Debug> Debug for MmapRegion<B>
impl<B: Debug> Debug for MmapRegion<B>
sourceimpl<B> Drop for MmapRegion<B>
impl<B> Drop for MmapRegion<B>
sourceimpl<B: Bitmap> VolatileMemory for MmapRegion<B>
impl<B: Bitmap> VolatileMemory for MmapRegion<B>
type B = B
type B = B
Type used for dirty memory tracking.
sourcefn get_slice(
&self,
offset: usize,
count: usize
) -> Result<VolatileSlice<'_, BS<'_, Self::B>>>
fn get_slice(
&self,
offset: usize,
count: usize
) -> Result<VolatileSlice<'_, BS<'_, Self::B>>>
sourcefn as_volatile_slice(&self) -> VolatileSlice<'_, BS<'_, Self::B>>
fn as_volatile_slice(&self) -> VolatileSlice<'_, BS<'_, Self::B>>
Gets a slice of memory for the entire region that supports volatile access.
sourcefn get_ref<T: ByteValued>(
&self,
offset: usize
) -> Result<VolatileRef<'_, T, BS<'_, Self::B>>>
fn get_ref<T: ByteValued>(
&self,
offset: usize
) -> Result<VolatileRef<'_, T, BS<'_, Self::B>>>
Gets a
VolatileRef at offset.sourcefn get_array_ref<T: ByteValued>(
&self,
offset: usize,
n: usize
) -> Result<VolatileArrayRef<'_, T, BS<'_, Self::B>>>
fn get_array_ref<T: ByteValued>(
&self,
offset: usize,
n: usize
) -> Result<VolatileArrayRef<'_, T, BS<'_, Self::B>>>
sourceunsafe fn aligned_as_ref<T: ByteValued>(&self, offset: usize) -> Result<&T>
unsafe fn aligned_as_ref<T: ByteValued>(&self, offset: usize) -> Result<&T>
sourceunsafe fn aligned_as_mut<T: ByteValued>(&self, offset: usize) -> Result<&mut T>
unsafe fn aligned_as_mut<T: ByteValued>(&self, offset: usize) -> Result<&mut T>
Returns a mutable reference to an instance of
T at offset. Mutable accesses performed
using the resulting reference are not automatically accounted for by the dirty bitmap
tracking functionality. Read moresourcefn get_atomic_ref<T: AtomicInteger>(&self, offset: usize) -> Result<&T>
fn get_atomic_ref<T: AtomicInteger>(&self, offset: usize) -> Result<&T>
Returns a reference to an instance of
T at offset. Mutable accesses performed
using the resulting reference are not automatically accounted for by the dirty bitmap
tracking functionality. Read moreimpl<B: Send> Send for MmapRegion<B>
impl<B: Sync> Sync for MmapRegion<B>
Auto Trait Implementations
impl<B> RefUnwindSafe for MmapRegion<B>where
B: RefUnwindSafe,
impl<B> Unpin for MmapRegion<B>where
B: Unpin,
impl<B> UnwindSafe for MmapRegion<B>where
B: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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