#[repr(C)]pub struct TrapFrame {Show 35 fields
pub ra: usize,
pub t0: usize,
pub t1: usize,
pub t2: usize,
pub t3: usize,
pub t4: usize,
pub t5: usize,
pub t6: usize,
pub a0: usize,
pub a1: usize,
pub a2: usize,
pub a3: usize,
pub a4: usize,
pub a5: usize,
pub a6: usize,
pub a7: usize,
pub s0: usize,
pub s1: usize,
pub s2: usize,
pub s3: usize,
pub s4: usize,
pub s5: usize,
pub s6: usize,
pub s7: usize,
pub s8: usize,
pub s9: usize,
pub s10: usize,
pub s11: usize,
pub gp: usize,
pub tp: usize,
pub sp: usize,
pub pc: usize,
pub mstatus: usize,
pub mcause: usize,
pub mtval: usize,
}
unstable
only.Expand description
Registers saved in trap handler
Fields§
§ra: usize
Return address, stores the address to return to after a function call or interrupt.
t0: usize
Temporary register t0, used for intermediate values.
t1: usize
Temporary register t1, used for intermediate values.
t2: usize
Temporary register t2, used for intermediate values.
t3: usize
Temporary register t3, used for intermediate values.
t4: usize
Temporary register t4, used for intermediate values.
t5: usize
Temporary register t5, used for intermediate values.
t6: usize
Temporary register t6, used for intermediate values.
a0: usize
Argument register a0, typically used to pass the first argument to a function.
a1: usize
Argument register a1, typically used to pass the second argument to a function.
a2: usize
Argument register a2, typically used to pass the third argument to a function.
a3: usize
Argument register a3, typically used to pass the fourth argument to a function.
a4: usize
Argument register a4, typically used to pass the fifth argument to a function.
a5: usize
Argument register a5, typically used to pass the sixth argument to a function.
a6: usize
Argument register a6, typically used to pass the seventh argument to a function.
a7: usize
Argument register a7, typically used to pass the eighth argument to a function.
s0: usize
Saved register s0, used to hold values across function calls.
s1: usize
Saved register s1, used to hold values across function calls.
s2: usize
Saved register s2, used to hold values across function calls.
s3: usize
Saved register s3, used to hold values across function calls.
s4: usize
Saved register s4, used to hold values across function calls.
s5: usize
Saved register s5, used to hold values across function calls.
s6: usize
Saved register s6, used to hold values across function calls.
s7: usize
Saved register s7, used to hold values across function calls.
s8: usize
Saved register s8, used to hold values across function calls.
s9: usize
Saved register s9, used to hold values across function calls.
s10: usize
Saved register s10, used to hold values across function calls.
s11: usize
Saved register s11, used to hold values across function calls.
gp: usize
Global pointer register, holds the address of the global data area.
tp: usize
Thread pointer register, holds the address of the thread-local storage area.
sp: usize
Stack pointer register, holds the address of the top of the stack.
pc: usize
Program counter, stores the address of the next instruction to be executed.
mstatus: usize
Machine status register, holds the current status of the processor, including interrupt enable bits and privilege mode.
mcause: usize
Machine cause register, contains the reason for the trap (e.g., exception or interrupt number).
mtval: usize
Machine trap value register, contains additional information about the trap (e.g., faulting address).