pub struct GuestSharedMemory {
pub lock: Arc<RwLock<()>>,
/* private fields */
}Expand description
A GuestSharedMemory is used by the hypervisor handler to represent the reference to all-of-memory that is taken by the virtual cpu. Because of the memory model limitations that affect HostSharedMemory, it is likely fairly important (to ensure that our UB remains limited to interaction with an external compilation unit that likely can’t be discovered by the compiler) that rust users do not perform racy accesses to the guest communication buffers that are also accessed by HostSharedMemory.
Fields§
§lock: Arc<RwLock<()>>The lock that indicates this shared memory is being used by non-Rust code
Trait Implementations§
Source§fn region(&self) -> &HostMapping
fn region(&self) -> &HostMapping
Return a readonly reference to the host mapping backing this SharedMemory
Source§fn with_exclusivity<T, F: FnOnce(&mut ExclusiveSharedMemory) -> T>(
&mut self,
f: F,
) -> Result<T>
fn with_exclusivity<T, F: FnOnce(&mut ExclusiveSharedMemory) -> T>( &mut self, f: F, ) -> Result<T>
Run some code with exclusive access to the SharedMemory
underlying this. If the SharedMemory is not an
ExclusiveSharedMemory, any concurrent accesses to the relevant
HostSharedMemory/GuestSharedMemory may make this fail, or be
made to fail by this, and should be avoided.
Source§fn base_addr(&self) -> usize
fn base_addr(&self) -> usize
Return the base address of the host mapping of this
region. Following the general Rust philosophy, this does not
need to be marked as
unsafe because doing anything with this
pointer itself requires unsafe.Source§fn base_ptr(&self) -> *mut u8
fn base_ptr(&self) -> *mut u8
Return the base address of the host mapping of this region as
a pointer. Following the general Rust philosophy, this does
not need to be marked as
unsafe because doing anything with
this pointer itself requires unsafe.Source§fn mem_size(&self) -> usize
fn mem_size(&self) -> usize
Return the length of usable memory contained in
self.
The returned size does not include the size of the surrounding
guard pages.Source§fn raw_ptr(&self) -> *mut u8
fn raw_ptr(&self) -> *mut u8
Return the raw base address of the host mapping, including the
guard pages.
Source§fn raw_mem_size(&self) -> usize
fn raw_mem_size(&self) -> usize
Return the raw size of the host mapping, including the guard
pages.
Auto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more