pub struct LeafSlot { /* private fields */ }
Expand description
叶子 slot
CSpace 是一个层级结构,也可以理解为一棵树 叶子 slot 就是在最边缘的位置,深度永远为 64(最大) 这里设计每一级的深度为 12 所以叶子 slot 的父亲深度为 52
Implementations§
Source§impl LeafSlot
impl LeafSlot
Sourcepub fn abs_cptr(&self) -> AbsoluteCPtr
pub fn abs_cptr(&self) -> AbsoluteCPtr
获取当前节点的绝对位置
Sourcepub fn cnode_abs_cptr(&self) -> AbsoluteCPtr
pub fn cnode_abs_cptr(&self) -> AbsoluteCPtr
获取父 CNode 节点的绝对位置
Sourcepub const fn offset_of_cnode(&self) -> usize
pub const fn offset_of_cnode(&self) -> usize
获取在 CNode 中的相对位置
Sourcepub const fn cap<T: CapType>(&self) -> Cap<T>
pub const fn cap<T: CapType>(&self) -> Cap<T>
获取 LeafSlot 指向的 slot 中的 Cap
如果这个 Slot 为空也可以获取,但是调用时会出现错误
Sourcepub const fn next_nth_slot(&self, n: usize) -> LeafSlot
pub const fn next_nth_slot(&self, n: usize) -> LeafSlot
获取这个位置后面第 n 个位置的 LeafSlot
slot 的数量不应该大于 CSpace 构建的最大数量
Sourcepub fn copy_from(
&self,
other: &LeafSlot,
rights: CapRights,
) -> Result<(), Error>
pub fn copy_from( &self, other: &LeafSlot, rights: CapRights, ) -> Result<(), Error>
从 other_slot
中复制一个 Capability
如果发生错误将返回 sel4::Error
Sourcepub fn delete(&self) -> Result<(), Error>
pub fn delete(&self) -> Result<(), Error>
删除当前 LeafSlot 中的 Capability
如果需要删除 sel4::cap::CNode 下面的所有 Capability,需要先使用 Self::revoke 删除 派生出的 Capability,然后再调用 AbsoluteCPtr::delete 删除 slot 中的 Capability
Sourcepub fn revoke(&self) -> Result<(), Error>
pub fn revoke(&self) -> Result<(), Error>
删除当前 LeafSlot 中派生出的 Capability
不会删除自身,需要调用 Self::delete 删除自身
Sourcepub fn mint_to(
&self,
dst: LeafSlot,
cr: CapRights,
badge: usize,
) -> Result<(), Error>
pub fn mint_to( &self, dst: LeafSlot, cr: CapRights, badge: usize, ) -> Result<(), Error>
复制 badge 并设置权限
dst
复制后的 Cap 放在哪个 LeafSlotcr
复制后的 Cap 的权限badge
需要设置的 badge
Sourcepub fn save_caller(&self) -> Result<(), Error>
pub fn save_caller(&self) -> Result<(), Error>
保存回复 Capability
Trait Implementations§
impl Copy for LeafSlot
Auto Trait Implementations§
impl Freeze for LeafSlot
impl RefUnwindSafe for LeafSlot
impl Send for LeafSlot
impl Sync for LeafSlot
impl Unpin for LeafSlot
impl UnwindSafe for LeafSlot
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dst: *mut u8)
unsafe fn clone_to_uninit(&self, dst: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)