> 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
 21:57:42 up 4 days, 17:03,  1 user,  load average: 0.70, 0.65, 0.51
This commit is contained in:
tracer-ics2023
2024-09-21 21:57:43 +08:00
committed by zzy
parent 423b6cc4df
commit 2e17773ee5
3 changed files with 7 additions and 4 deletions

View File

@ -117,7 +117,7 @@ static int decode_exec(Decode *s) {
INSTPAT("0000000 ????? ????? 110 ????? 01100 11", or , R, R(rd) = src1 | src2);
INSTPAT("0000000 ????? ????? 111 ????? 01100 11", and , R, R(rd) = src1 & src2);
INSTPAT("0000000 00000 00000 000 00000 11100 11", ecall , N, C(MEPC) = s->pc, C(MSTATUS) = 0x1800, s->dnpc = C(MTVEC));
INSTPAT("0000000 00000 00000 000 00000 11100 11", ecall , N, isa_raise_intr(INTR_EMPTY, s->pc));
INSTPAT("0000000 00001 00000 000 00000 11100 11", ebreak , N, NEMUTRAP(s->pc, R(10))); // R(10) is $a0
INSTPAT("0000001 ????? ????? 000 ????? 01100 11", mul , R, R(rd) = (sword_t)src1 * (sword_t)src2);

View File

@ -33,7 +33,7 @@ enum {
};
static inline int check_cpr_idx(int idx) {
IFDEF(CONFIG_RT_CHECK, assert(idx == MSTATUS || idx == MEPC || idx == MCAUSE || idx == MTVEC));
IFDEF(CONFIG_RT_CHECK, assert(idx == MCAUSE || idx == MEPC || idx == MTVEC));
return idx;
}

View File

@ -15,12 +15,15 @@
#include <isa.h>
#include "../local-include/reg.h"
#define C(i) cpr(i)
word_t isa_raise_intr(word_t NO, vaddr_t epc) {
/* TODO: Trigger an interrupt/exception with ``NO''.
* Then return the address of the interrupt/exception vector.
*/
return 0;
C(MEPC) = epc;
C(MCAUSE) = NO;
return C(MTVEC);
}
word_t isa_query_intr() {