#[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,
}Expand description
Registers saved in trap handler
Fields§
§ra: usizeReturn address, stores the address to return to after a function call or interrupt.
t0: usizeTemporary register t0, used for intermediate values.
t1: usizeTemporary register t1, used for intermediate values.
t2: usizeTemporary register t2, used for intermediate values.
t3: usizeTemporary register t3, used for intermediate values.
t4: usizeTemporary register t4, used for intermediate values.
t5: usizeTemporary register t5, used for intermediate values.
t6: usizeTemporary register t6, used for intermediate values.
a0: usizeArgument register a0, typically used to pass the first argument to a function.
a1: usizeArgument register a1, typically used to pass the second argument to a function.
a2: usizeArgument register a2, typically used to pass the third argument to a function.
a3: usizeArgument register a3, typically used to pass the fourth argument to a function.
a4: usizeArgument register a4, typically used to pass the fifth argument to a function.
a5: usizeArgument register a5, typically used to pass the sixth argument to a function.
a6: usizeArgument register a6, typically used to pass the seventh argument to a function.
a7: usizeArgument register a7, typically used to pass the eighth argument to a function.
s0: usizeSaved register s0, used to hold values across function calls.
s1: usizeSaved register s1, used to hold values across function calls.
s2: usizeSaved register s2, used to hold values across function calls.
s3: usizeSaved register s3, used to hold values across function calls.
s4: usizeSaved register s4, used to hold values across function calls.
s5: usizeSaved register s5, used to hold values across function calls.
s6: usizeSaved register s6, used to hold values across function calls.
s7: usizeSaved register s7, used to hold values across function calls.
s8: usizeSaved register s8, used to hold values across function calls.
s9: usizeSaved register s9, used to hold values across function calls.
s10: usizeSaved register s10, used to hold values across function calls.
s11: usizeSaved register s11, used to hold values across function calls.
gp: usizeGlobal pointer register, holds the address of the global data area.
tp: usizeThread pointer register, holds the address of the thread-local storage area.
sp: usizeStack pointer register, holds the address of the top of the stack.
pc: usizeProgram counter, stores the address of the next instruction to be executed.
mstatus: usizeMachine status register, holds the current status of the processor, including interrupt enable bits and privilege mode.
mcause: usizeMachine cause register, contains the reason for the trap (e.g., exception or interrupt number).
mtval: usizeMachine trap value register, contains additional information about the trap (e.g., faulting address).