Struct applevisor::MappingShared
source · pub struct MappingShared { /* private fields */ }
Expand description
Represents a memory range shared among multiple threads.
Note: a memory mapping is available to all vCPU running in a given VM instance, but any vCPU-owning thread with a reference to this mapping can access it.
Trait Implementations
sourcefn clone(&self) -> MappingShared
fn clone(&self) -> MappingShared
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourcefn 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
.Auto Trait Implementations
Blanket Implementations
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more