Struct LeafSlot

Source
pub struct LeafSlot { /* private fields */ }
Expand description

叶子 slot

CSpace 是一个层级结构,也可以理解为一棵树 叶子 slot 就是在最边缘的位置,深度永远为 64(最大) 这里设计每一级的深度为 12 所以叶子 slot 的父亲深度为 52

Implementations§

Source§

impl LeafSlot

Source

pub const fn new(idx: usize) -> Self

创建新的 Slot

Source

pub const fn from_slot<T: CapType>(slot: Slot<T>) -> Self

Slot 中创建一个 LeafSlot

Source

pub const fn from_cap<T: CapType>(cap: Cap<T>) -> Self

Cap 中创建一个 LeafSlot

Source

pub fn abs_cptr(&self) -> AbsoluteCPtr

获取当前节点的绝对位置

Source

pub fn cnode_abs_cptr(&self) -> AbsoluteCPtr

获取父 CNode 节点的绝对位置

Source

pub const fn cnode_idx(&self) -> usize

获取父 CNode 节点的索引

Source

pub const fn offset_of_cnode(&self) -> usize

获取在 CNode 中的相对位置

Source

pub const fn raw(&self) -> usize

获取原始值

Source

pub const fn cap<T: CapType>(&self) -> Cap<T>

获取 LeafSlot 指向的 slot 中的 Cap

如果这个 Slot 为空也可以获取,但是调用时会出现错误

Source

pub const fn next_slot(&self) -> LeafSlot

获取这个位置后面的一个 LeafSlot

slot 的数量不应该大于 CSpace 构建的最大数量

Source

pub const fn next_nth_slot(&self, n: usize) -> LeafSlot

获取这个位置后面第 n 个位置的 LeafSlot

slot 的数量不应该大于 CSpace 构建的最大数量

Source

pub fn copy_from( &self, other: &LeafSlot, rights: CapRights, ) -> Result<(), Error>

other_slot 中复制一个 Capability

如果发生错误将返回 sel4::Error

Source

pub fn delete(&self) -> Result<(), Error>

删除当前 LeafSlot 中的 Capability

如果需要删除 sel4::cap::CNode 下面的所有 Capability,需要先使用 Self::revoke 删除 派生出的 Capability,然后再调用 AbsoluteCPtr::delete 删除 slot 中的 Capability

Source

pub fn revoke(&self) -> Result<(), Error>

删除当前 LeafSlot 中派生出的 Capability

不会删除自身,需要调用 Self::delete 删除自身

Source

pub fn mint_to( &self, dst: LeafSlot, cr: CapRights, badge: usize, ) -> Result<(), Error>

复制 badge 并设置权限

  • dst 复制后的 Cap 放在哪个 LeafSlot
  • cr 复制后的 Cap 的权限
  • badge 需要设置的 badge
Source

pub fn move_to(&self, dst: Self) -> Result<(), Error>

将 Capability 移动到指定的 LeafSlot

Source

pub fn save_caller(&self) -> Result<(), Error>

保存回复 Capability

Trait Implementations§

Source§

impl Clone for LeafSlot

Source§

fn clone(&self) -> LeafSlot

Returns a copy of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LeafSlot

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: CapType> From<Cap<T>> for LeafSlot

Cap 可以快速转换为 LeafSlot

Source§

fn from(value: Cap<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: CapType> From<LeafSlot> for Cap<T>

LeafSlot 快速转换为 Cap

Source§

fn from(value: LeafSlot) -> Self

Converts to this type from the input type.
Source§

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 T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.