Struct applevisor::Mapping
source · pub struct Mapping { /* private fields */ }
Expand description
Represents a memory range exclusive to a single thread.
Note: a memory mapping is available to all vCPU running in a given VM instance, but only one vCPU-owning thread can access it.
Trait Implementations
sourceimpl Mappable for Mapping
impl Mappable for Mapping
sourcefn new(size: usize) -> Result<Self, LayoutError>
fn new(size: usize) -> Result<Self, LayoutError>
Creates a new allocation object.
sourcefn map(&mut self, guest_addr: u64, perms: MemPerms) -> Result<()>
fn map(&mut self, guest_addr: u64, perms: MemPerms) -> Result<()>
Maps the host allocation in the guest.
sourcefn protect(&mut self, perms: MemPerms) -> Result<()>
fn protect(&mut self, perms: MemPerms) -> Result<()>
Changes the protections of memory mapping in the guest.
sourcefn read(&self, guest_addr: u64, data: &mut [u8]) -> Result<usize>
fn read(&self, guest_addr: u64, data: &mut [u8]) -> Result<usize>
Reads from a memory mapping in the guest at address
guest_addr
.sourcefn write(&mut self, guest_addr: u64, data: &[u8]) -> Result<usize>
fn write(&mut self, guest_addr: u64, data: &[u8]) -> Result<usize>
Writes to a memory mapping in the guest at address
guest_addr
.sourcefn get_host_addr(&self) -> *const u8
fn get_host_addr(&self) -> *const u8
Retrieves the memory mapping’s host address.
sourcefn get_guest_addr(&self) -> Option<u64>
fn get_guest_addr(&self) -> Option<u64>
Retrieves the memory mapping’s guest address.
sourcefn map_inner(
inner: &mut MappingInner,
guest_addr: u64,
perms: MemPerms
) -> Result<()>where
Self: Sized,
fn map_inner(
inner: &mut MappingInner,
guest_addr: u64,
perms: MemPerms
) -> Result<()>where
Self: Sized,
Underlying memory mapping function.
sourcefn unmap_inner(inner: &mut MappingInner) -> Result<()>where
Self: Sized,
fn unmap_inner(inner: &mut MappingInner) -> Result<()>where
Self: Sized,
Underlying memory unmapping function.
sourcefn protect_inner(inner: &mut MappingInner, perms: MemPerms) -> Result<()>where
Self: Sized,
fn protect_inner(inner: &mut MappingInner, perms: MemPerms) -> Result<()>where
Self: Sized,
Underlying memory protection function.
sourcefn read_inner(
inner: &MappingInner,
guest_addr: u64,
data: &mut [u8]
) -> Result<usize>where
Self: Sized,
fn read_inner(
inner: &MappingInner,
guest_addr: u64,
data: &mut [u8]
) -> Result<usize>where
Self: Sized,
Underlying memory read function.
sourcefn read_dword(&self, guest_addr: u64) -> Result<u32>
fn read_dword(&self, guest_addr: u64) -> Result<u32>
Reads one dword at address
guest_addr
.sourcefn read_qword(&self, guest_addr: u64) -> Result<u64>
fn read_qword(&self, guest_addr: u64) -> Result<u64>
Reads one qword at address
guest_addr
.sourcefn write_inner(
inner: &mut MappingInner,
guest_addr: u64,
data: &[u8]
) -> Result<usize>where
Self: Sized,
fn write_inner(
inner: &mut MappingInner,
guest_addr: u64,
data: &[u8]
) -> Result<usize>where
Self: Sized,
Underlying memory write function.
sourcefn write_byte(&mut self, guest_addr: u64, data: u8) -> Result<usize>
fn write_byte(&mut self, guest_addr: u64, data: u8) -> Result<usize>
Writes one byte at address
guest_addr
.sourcefn write_word(&mut self, guest_addr: u64, data: u16) -> Result<usize>
fn write_word(&mut self, guest_addr: u64, data: u16) -> Result<usize>
Writes one word at address
guest_addr
.impl Eq for Mapping
impl StructuralEq for Mapping
impl StructuralPartialEq for Mapping
Auto Trait Implementations
impl RefUnwindSafe for Mapping
impl !Send for Mapping
impl !Sync for Mapping
impl Unpin for Mapping
impl UnwindSafe for Mapping
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