> compile NEMU

221220000 张三
Linux zzy 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
 22:31:13 up 4 days, 17:36,  1 user,  load average: 0.77, 0.73, 0.62
This commit is contained in:
tracer-ics2023
2024-09-21 22:31:14 +08:00
committed by zzy
parent 16849e709e
commit 5a6349910e
3 changed files with 4 additions and 2 deletions

View File

@ -26,14 +26,14 @@ static inline int check_reg_idx(int idx) {
#define gpr(idx) (cpu.gpr[check_reg_idx(idx)])
enum {
// MSTATUS = 0x300, // Machine status register.
MSTATUS = 0x300, // Machine status register.
MTVEC = 0x305, // Machine trap-handler base address.
MEPC = 0x341, // Machine exception program counter.
MCAUSE = 0x342, // Machine trap cause.
};
static inline int check_cpr_idx(int idx) {
IFDEF(CONFIG_RT_CHECK, assert(idx >= 0x300 && idx < 0x400));
IFDEF(CONFIG_RT_CHECK, assert(idx == MSTATUS || idx == MCAUSE || idx == MEPC || idx == MTVEC));
return idx;
}

View File

@ -23,6 +23,7 @@ word_t isa_raise_intr(word_t NO, vaddr_t epc) {
*/
C(MEPC) = epc;
C(MCAUSE) = NO;
C(MSTATUS) = 0x1800;
return C(MTVEC);
}