Skip to main content

ax_cpu/trap/
interrupted.rs

1//! Register values captured before leaving the owning trap frame.
2
3/// Privilege of an interrupted execution context.
4#[derive(Clone, Copy, Debug, Eq, PartialEq)]
5pub enum InterruptedPrivilege {
6    /// Less-privileged user execution.
7    User,
8    /// Privileged kernel execution.
9    Kernel,
10}
11
12/// Value-only IRQ sampling input. It never retains a pointer into a trap stack.
13#[derive(Clone, Copy, Debug, Eq, PartialEq)]
14pub struct InterruptedContext {
15    /// Saved instruction pointer.
16    pub pc: usize,
17    /// Stack pointer of the interrupted context.
18    pub sp: usize,
19    /// Saved frame pointer.
20    pub fp: usize,
21    /// Privilege of the interrupted context.
22    pub privilege: InterruptedPrivilege,
23}