pub struct HartMask<T = usize> { /* private fields */ }Expand description
Hart mask structure in SBI function calls.
Implementations§
Source§impl<T: SbiRegister> HartMask<T>
impl<T: SbiRegister> HartMask<T>
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) -> Self
pub const fn from_mask_base(hart_mask: T, hart_mask_base: T) -> Self
Construct a HartMask from mask value and base hart id.
Sourcepub const fn all() -> Self
pub const fn all() -> Self
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<usize>
impl HartMask<usize>
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.