Trait zircon_object::vm::VMObjectTrait
source · [−]pub trait VMObjectTrait: Sync + Send {
Show 22 methods
fn read(&self, offset: usize, buf: &mut [u8]) -> ZxResult;
fn write(&self, offset: usize, buf: &[u8]) -> ZxResult;
fn zero(&self, offset: usize, len: usize) -> ZxResult;
fn len(&self) -> usize;
fn set_len(&self, len: usize) -> ZxResult;
fn commit_page(&self, page_idx: usize, flags: MMUFlags) -> ZxResult<PhysAddr>;
fn commit_pages_with(
&self,
f: &mut dyn FnMut(&mut dyn FnMut(usize, MMUFlags) -> ZxResult<PhysAddr>) -> ZxResult
) -> ZxResult;
fn commit(&self, offset: usize, len: usize) -> ZxResult;
fn decommit(&self, offset: usize, len: usize) -> ZxResult;
fn create_child(
&self,
offset: usize,
len: usize
) -> ZxResult<Arc<dyn VMObjectTrait>>;
fn complete_info(&self, info: &mut VmoInfo);
fn cache_policy(&self) -> CachePolicy;
fn set_cache_policy(&self, policy: CachePolicy) -> ZxResult;
fn committed_pages_in_range(&self, start_idx: usize, end_idx: usize) -> usize;
fn append_mapping(&self, _mapping: Weak<VmMapping>) { ... }
fn remove_mapping(&self, _mapping: Weak<VmMapping>) { ... }
fn pin(&self, _offset: usize, _len: usize) -> ZxResult { ... }
fn unpin(&self, _offset: usize, _len: usize) -> ZxResult { ... }
fn is_contiguous(&self) -> bool { ... }
fn is_paged(&self) -> bool { ... }
fn as_mut_buf(&self) -> ZxResult<(MutexGuard<'_, ()>, &mut [u8])> { ... }
fn unset_contiguous(&self) { ... }
}
Expand description
Virtual Memory Object Trait
Required Methods
Read memory to buf
from VMO at offset
.
Resets the range of bytes in the VMO from offset
to offset+len
to 0.
Commit pages with an external function f.
the vmo is internally locked before it calls f,
allowing VmMapping
to avoid deadlock
fn create_child(
&self,
offset: usize,
len: usize
) -> ZxResult<Arc<dyn VMObjectTrait>>
fn create_child(
&self,
offset: usize,
len: usize
) -> ZxResult<Arc<dyn VMObjectTrait>>
Create a child VMO.
fn complete_info(&self, info: &mut VmoInfo)
fn complete_info(&self, info: &mut VmoInfo)
Complete the VmoInfo.
fn cache_policy(&self) -> CachePolicy
fn cache_policy(&self) -> CachePolicy
Get the cache policy.
fn set_cache_policy(&self, policy: CachePolicy) -> ZxResult
fn set_cache_policy(&self, policy: CachePolicy) -> ZxResult
Set the cache policy.
fn committed_pages_in_range(&self, start_idx: usize, end_idx: usize) -> usize
fn committed_pages_in_range(&self, start_idx: usize, end_idx: usize) -> usize
Count committed pages of the VMO.
Provided Methods
fn append_mapping(&self, _mapping: Weak<VmMapping>)
fn append_mapping(&self, _mapping: Weak<VmMapping>)
Append a mapping to the VMO’s mapping list.
fn remove_mapping(&self, _mapping: Weak<VmMapping>)
fn remove_mapping(&self, _mapping: Weak<VmMapping>)
Remove a mapping from the VMO’s mapping list.
fn is_contiguous(&self) -> bool
fn is_contiguous(&self) -> bool
Returns true if the object is backed by a contiguous range of physical memory.
fn as_mut_buf(&self) -> ZxResult<(MutexGuard<'_, ()>, &mut [u8])>
fn as_mut_buf(&self) -> ZxResult<(MutexGuard<'_, ()>, &mut [u8])>
If contiguous, transmute vmo to a mutable buffer
fn unset_contiguous(&self)
fn unset_contiguous(&self)
Mark as not contiguous