[][src]Struct sunrise_kernel::process::ProcessCapabilities

pub struct ProcessCapabilities {
    pub syscall_mask: [u32; 8],
    pub irq_access_mask: [u8; 128],
    pub ioports: Vec<u16>,
}

Capabilities of a process.

When a process is created, a list of capabilities is passed along with it, which provides the minimum set of capabilities the process needs to run. Any capability not specified, whether a syscall or an IRQ, is not allowed to be used. Using a forbidden SVC is treated as if the SVC didn't exist.

Fields

syscall_mask: [u32; 8]

Bitmask of syscall access controls. Should be accessed through bit_field::BitArray. A value of 1 means the syscall is accessible, a value of 0 means the syscall should not be allowed.

Present on every architecture.

irq_access_mask: [u8; 128]

Bitmask of allowed interrupts. Should be accessed through bit_field::BitArray. A value of 1 means the process is allowed to create an IRQEvent for this IRQ number, a value of 0 means creating the event is not allowed.

Present on every architecture.

ioports: Vec<u16>

A vector of readable IO ports.

When task switching, the IOPB will be changed to take this into account.

Present on x86 platforms.

Implementations

impl ProcessCapabilities[src]

pub fn parse_kcaps(kacs: &[u8]) -> Result<ProcessCapabilities, KernelError>[src]

Parse the kernel capabilities, in the NPDM format. More information on the format available on switchbrew.

Errors

INVALID_KCAP:

  • Unknown cap_type
  • KernelReleaseVersion < 0x80000

INVALID_COMBINATION:

  • Tried to send a duplicate kernel capability that doesn't allow duplicates (bit3, bit13, bit14, bit15, bit16)
  • Tried to send two svc masks with the same index
  • Lowest CpuId > Highest CpuId in KernelFlags
  • LowestPrio > Highest Prio in KernelFlags

EXCEEDING_MAXIMUM:

  • IrqPair with Irq > 0xFF and != 0x3FF
  • SvcMask set an interrupt > 0x7F

INVALID_PROCESSOR_ID:

  • KernelFlags cpuid is >= 4

RESERVED_VALUE:

  • HandleTableSize: bit set in the 31..26 range
  • DebugFlags: bits set in the 31..19 range
  • ApplicationType: bits set in the 31..17 range

Trait Implementations

impl Debug for ProcessCapabilities[src]

impl Default for ProcessCapabilities[src]

Auto Trait Implementations

impl RefUnwindSafe for ProcessCapabilities

impl Send for ProcessCapabilities

impl Sync for ProcessCapabilities

impl Unpin for ProcessCapabilities

impl UnwindSafe for ProcessCapabilities

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.