Struct fidl::handle::fuchsia_handles::Vmar
pub struct Vmar(/* private fields */);
Expand description
An object representing a Zircon virtual memory address region.
As essentially a subtype of Handle
, it can be freely interconverted.
Implementations§
§impl Vmar
impl Vmar
pub fn allocate( &self, offset: usize, size: usize, flags: VmarFlags ) -> Result<(Vmar, usize), Status>
pub fn map( &self, vmar_offset: usize, vmo: &Vmo, vmo_offset: u64, len: usize, flags: VmarFlags ) -> Result<usize, Status>
pub unsafe fn map_unsafe(
&self,
vmar_offset: usize,
vmo: &Vmo,
vmo_offset: u64,
len: usize,
flags: VmarFlagsExtended
) -> Result<usize, Status>
pub unsafe fn map_unsafe( &self, vmar_offset: usize, vmo: &Vmo, vmo_offset: u64, len: usize, flags: VmarFlagsExtended ) -> Result<usize, Status>
Directly call zx_vmar_map
.
§Safety
This function is unsafe because certain flags to zx_vmar_map
may
replace an existing mapping which is referenced elsewhere.
pub unsafe fn unmap(&self, addr: usize, len: usize) -> Result<(), Status>
pub unsafe fn unmap(&self, addr: usize, len: usize) -> Result<(), Status>
Directly call zx_vmar_unmap
.
§Safety
This function is unsafe because unmapping memory regions can arbitrarily cause read, write, and execution errors. Among other things, the caller must ensure that:
- The region being unmapped will not be accessed after unmapping.
- All references to memory in the region must be dropped or forgotten prior to calling this method.
- If the region contained executable code, then code in the region must not be currently executing and may not be executed in the future.
This is not an exhaustive list, as there are many ways to cause memory unsafety with memory mappings.
pub unsafe fn protect(
&self,
addr: usize,
len: usize,
flags: VmarFlags
) -> Result<(), Status>
pub unsafe fn protect( &self, addr: usize, len: usize, flags: VmarFlags ) -> Result<(), Status>
Directly call zx_vmar_protect
.
§Safety
This function is unsafe because changing the access protections for memory regions can arbitrarily cause read, write, and execution errors. Among other things, the caller must ensure that if a read, write, or execute permission is removed from a memory region, it must not read, write, or execute it respetively.
This is not an exhaustive list, as there are many ways to cause memory unsafety with memory mappings.
pub unsafe fn destroy(&self) -> Result<(), Status>
pub unsafe fn destroy(&self) -> Result<(), Status>
Directly call zx_vmar_destroy
.
§Safety
This function is unsafe because destroying a region unmaps all of the
mappings within it. See Vmar::unmap
for more details on how
unmapping memory regions can cause memory unsafety.
pub fn info(&self) -> Result<VmarInfo, Status>
pub fn info(&self) -> Result<VmarInfo, Status>
Wraps the zx_object_get_info syscall for the ZX_INFO_VMAR topic.
Trait Implementations§
§impl AsHandleRef for Vmar
impl AsHandleRef for Vmar
§fn as_handle_ref(&self) -> Unowned<'_, Handle>
fn as_handle_ref(&self) -> Unowned<'_, Handle>
object_wait_many
.§fn raw_handle(&self) -> u32
fn raw_handle(&self) -> u32
§fn signal_handle(
&self,
clear_mask: Signals,
set_mask: Signals
) -> Result<(), Status>
fn signal_handle( &self, clear_mask: Signals, set_mask: Signals ) -> Result<(), Status>
§fn wait_handle(
&self,
signals: Signals,
deadline: Time
) -> Result<Signals, Status>
fn wait_handle( &self, signals: Signals, deadline: Time ) -> Result<Signals, Status>
§fn wait_async_handle(
&self,
port: &Port,
key: u64,
signals: Signals,
options: WaitAsyncOpts
) -> Result<(), Status>
fn wait_async_handle( &self, port: &Port, key: u64, signals: Signals, options: WaitAsyncOpts ) -> Result<(), Status>
§fn get_name(&self) -> Result<CString, Status>
fn get_name(&self) -> Result<CString, Status>
§fn set_name(&self, name: &CStr) -> Result<(), Status>
fn set_name(&self, name: &CStr) -> Result<(), Status>
§fn basic_info(&self) -> Result<HandleBasicInfo, Status>
fn basic_info(&self) -> Result<HandleBasicInfo, Status>
§fn count_info(&self) -> Result<HandleCountInfo, Status>
fn count_info(&self) -> Result<HandleCountInfo, Status>
§impl HandleBased for Vmar
impl HandleBased for Vmar
§fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status>
fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status>
§fn replace_handle(self, rights: Rights) -> Result<Self, Status>
fn replace_handle(self, rights: Rights) -> Result<Self, Status>
§fn into_handle(self) -> Handle
fn into_handle(self) -> Handle
§fn from_handle(handle: Handle) -> Self
fn from_handle(handle: Handle) -> Self
§fn into_handle_based<H>(self) -> Hwhere
H: HandleBased,
fn into_handle_based<H>(self) -> Hwhere
H: HandleBased,
§fn from_handle_based<H>(h: H) -> Selfwhere
H: HandleBased,
fn from_handle_based<H>(h: H) -> Selfwhere
H: HandleBased,
fn is_invalid_handle(&self) -> bool
§impl Ord for Vmar
impl Ord for Vmar
§impl PartialOrd for Vmar
impl PartialOrd for Vmar
§fn partial_cmp(&self, other: &Vmar) -> Option<Ordering>
fn partial_cmp(&self, other: &Vmar) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more