pub struct HartMask<T = usize> { /* private fields */ }Expand description
Hart mask structure in SBI function calls.
Implementations§
Source§impl<T> HartMask<T>where
T: SbiRegister,
impl<T> HartMask<T>where
T: SbiRegister,
Sourcepub const IGNORE_MASK: T = T::FULL_MASK
pub const IGNORE_MASK: T = T::FULL_MASK
Special value to ignore the mask, and consider all bits as set.
Sourcepub const fn from_mask_base(hart_mask: T, hart_mask_base: T) -> HartMask<T>
pub const fn from_mask_base(hart_mask: T, hart_mask_base: T) -> HartMask<T>
Construct a HartMask from mask value and base hart id.
Sourcepub const fn all() -> HartMask<T>
pub const fn all() -> HartMask<T>
Construct a HartMask that selects all available harts on the current environment.
According to the RISC-V SBI Specification, hart_mask_base can be set to -1 (i.e. usize::MAX)
to indicate that hart_mask shall be ignored and all available harts must be considered.
In case of this function in the sbi-spec crate, we fill in usize::MAX in hart_mask_base
parameter to match the RISC-V SBI standard, while choosing 0 as the ignored hart_mask value.
Sourcepub const fn ignore_mask(&self) -> T
pub const fn ignore_mask(&self) -> T
Gets the special value for ignoring the mask parameter.
Sourcepub const fn into_inner(self) -> (T, T)
pub const fn into_inner(self) -> (T, T)
Returns mask and base parameters from the HartMask.
Source§impl HartMask
impl HartMask
Sourcepub const fn has_bit(self, hart_id: usize) -> bool
pub const fn has_bit(self, hart_id: usize) -> bool
Returns whether the HartMask contains the provided hart_id.
Sourcepub const fn insert(&mut self, hart_id: usize) -> Result<(), MaskError>
pub const fn insert(&mut self, hart_id: usize) -> Result<(), MaskError>
Insert a hart id into this HartMask.
Returns error when hart_id is invalid.