Skip to content

hal::arch

Contract between portable kernel state and an architecture’s saved frame.

struct ContextDiagnostics {
pub pc: u32,
pub architecture_state: u32,
}

Small, optional context view used only by trap diagnostics.

Implements: Clone, Copy, Debug, Eq, PartialEq, StructuralPartialEq

struct FaultInfo {
pub cause: u32,
pub pc: u32,
pub status: u32,
pub address: u32,
pub arg0: u32,
pub arg1: u32,
}

Register values needed by the kernel’s fatal-fault report.

Implements: Clone, Copy, Debug, Eq, PartialEq, StructuralPartialEq

struct InterruptCause {
pub tick: bool,
pub switch_request: bool,
pub external: u32,
}

Architecture-neutral interrupt sources observed at one trap entry.

Implements: Clone, Copy, Debug, Eq, PartialEq, StructuralPartialEq

enum TrapCause {
Interrupt(InterruptCause),
Fault(FaultInfo),
}

Meaning of the exception that entered the kernel.

Implements: Clone, Copy, Debug, Eq, PartialEq, StructuralPartialEq

References: FaultInfo, InterruptCause

trait Architecture {
unsafe fn init_context(context: &mut Self::Context, entry: usize, stack_top: u32)
unsafe fn save_context(frame: *const Self::Context, saved: &mut Self::Context)
fn restore_context(saved: &mut Self::Context) -> *mut Self::Context
fn request_switch()
fn wait_for_interrupt()
fn wait_masked()
fn mask_interrupts() -> u32
fn cycle_count() -> Option<u32>
unsafe fn trap_cause(frame: *const Self::Context) -> TrapCause
fn acknowledge_switch_request()
fn context_diagnostics(context: &Self::Context) -> ContextDiagnostics
}

Architecture operations that own the shape and initialization of a task.

trait TaskContext: Sized {
}

A saved task context that can initialize static scheduler storage.