Trait applevisor::Mappable
source · pub trait Mappable {
Show 22 methods
fn new(size: usize) -> Result<Self, LayoutError>
where
Self: Sized;
fn map(&mut self, guest_addr: u64, perms: MemPerms) -> Result<()>;
fn unmap(&mut self) -> Result<()>;
fn protect(&mut self, perms: MemPerms) -> Result<()>;
fn read(&self, guest_addr: u64, data: &mut [u8]) -> Result<usize>;
fn write(&mut self, guest_addr: u64, data: &[u8]) -> Result<usize>;
fn get_host_addr(&self) -> *const u8;
fn get_guest_addr(&self) -> Option<u64>;
fn get_size(&self) -> usize;
fn map_inner(
inner: &mut MappingInner,
guest_addr: u64,
perms: MemPerms
) -> Result<()>
where
Self: Sized,
{ ... }
fn unmap_inner(inner: &mut MappingInner) -> Result<()>
where
Self: Sized,
{ ... }
fn protect_inner(inner: &mut MappingInner, perms: MemPerms) -> Result<()>
where
Self: Sized,
{ ... }
fn read_inner(
inner: &MappingInner,
guest_addr: u64,
data: &mut [u8]
) -> Result<usize>
where
Self: Sized,
{ ... }
fn read_byte(&self, guest_addr: u64) -> Result<u8> { ... }
fn read_word(&self, guest_addr: u64) -> Result<u16> { ... }
fn read_dword(&self, guest_addr: u64) -> Result<u32> { ... }
fn read_qword(&self, guest_addr: u64) -> Result<u64> { ... }
fn write_inner(
inner: &mut MappingInner,
guest_addr: u64,
data: &[u8]
) -> Result<usize>
where
Self: Sized,
{ ... }
fn write_byte(&mut self, guest_addr: u64, data: u8) -> Result<usize> { ... }
fn write_word(&mut self, guest_addr: u64, data: u16) -> Result<usize> { ... }
fn write_dword(&mut self, guest_addr: u64, data: u32) -> Result<usize> { ... }
fn write_qword(&mut self, guest_addr: u64, data: u64) -> Result<usize> { ... }
}
Required Methods
sourcefn new(size: usize) -> Result<Self, LayoutError>where
Self: Sized,
fn new(size: usize) -> Result<Self, LayoutError>where
Self: Sized,
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.
Provided Methods
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
.