traps/interrupts: Refactor trap handling and align CSR access

This commit is contained in:
Liam Kerr 2026-05-01 22:34:27 +01:00
parent 0176b636c5
commit f76ca1ee31
3 changed files with 15 additions and 12 deletions

View file

@ -3,6 +3,8 @@
#define MSTATUS 0x300
#define MIE 0x304
#define MCAUSE 0x342
#define MEPC 0x341
#define MSTATUS_BIT_MIE 3
#define MIE_BIT_MTIE 7
#define MIE_BIT_MEIE 11
@ -56,8 +58,10 @@ typedef struct {
uint64_t t5; // x30
uint64_t t6; // x31
// Control and Status Register state
uint64_t mepc; // offset 240 (Saved in traps.S)
// Control and Status Register state (Saved in traps.S)
uint64_t mepc; // offset 240
uint64_t mcause; // offset 248
uint64_t mstatus; // offset 256
} trap_frame_t;
void interrupt_init();