> compile NEMU
ysyx_22040000 李心杨 Linux calcite 6.6.19 #1-NixOS SMP PREEMPT_DYNAMIC Fri Mar 1 12:35:11 UTC 2024 x86_64 GNU/Linux 18:47:11 up 5:53, 2 users, load average: 0.48, 0.46, 0.46
This commit is contained in:
parent
bcf8ec87ca
commit
8988980966
3 changed files with 7 additions and 7 deletions
|
@ -10,8 +10,8 @@ typedef struct {
|
|||
} func_t;
|
||||
|
||||
extern func_t *func_table;
|
||||
void ftrace_call(vaddr_t);
|
||||
void ftrace_return(vaddr_t);
|
||||
void ftrace_call(vaddr_t, vaddr_t);
|
||||
void ftrace_return(vaddr_t, vaddr_t);
|
||||
// const char *get_func_name(vaddr_t addr);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -64,9 +64,9 @@ static void ftrace(Decode *s, int rd, vaddr_t dst) {
|
|||
uint32_t i = s->isa.inst.val;
|
||||
int rs1 = BITS(i, 19, 15);
|
||||
if(rs1 == 1 && rd == 0) {
|
||||
ftrace_return(dst);
|
||||
ftrace_return(s->pc, dst);
|
||||
} else {
|
||||
ftrace_call(dst);
|
||||
ftrace_call(s->pc, dst);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ static int decode_exec(Decode *s) {
|
|||
INSTPAT("??????? ????? ????? ??? ????? 01101 11", lui , U, R(rd) = imm);
|
||||
INSTPAT("??????? ????? ????? ??? ????? 00101 11", auipc , U, R(rd) = s->pc + imm);
|
||||
|
||||
INSTPAT("??????? ????? ????? ??? ????? 11011 11", jal , J, do {s->dnpc = s->pc + imm; R(rd) = s->pc + 4; ftrace_call(s->pc + imm); } while(0));
|
||||
INSTPAT("??????? ????? ????? ??? ????? 11011 11", jal , J, do {s->dnpc = s->pc + imm; R(rd) = s->pc + 4; ftrace_call(s->pc, s->pc + imm); } while(0));
|
||||
INSTPAT("??????? ????? ????? ??? ????? 11001 11", jalr , I, do {s->dnpc = src1 + imm; R(rd) = s->pc + 4; ftrace(s, rd, src1 + imm); } while(0));
|
||||
INSTPAT("??????? ????? ????? 000 ????? 11000 11", beq , B, do_branch(s, src1 == src2, imm));
|
||||
INSTPAT("??????? ????? ????? 001 ????? 11000 11", bne , B, do_branch(s, src1 != src2, imm));
|
||||
|
|
|
@ -99,11 +99,11 @@ failed_nosym:
|
|||
return;
|
||||
}
|
||||
|
||||
void ftrace_call(vaddr_t addr) {
|
||||
void ftrace_call(vaddr_t pc, vaddr_t addr) {
|
||||
printf("[FTRACE] call [%s@0x%x]\n", get_func_name(addr), addr);
|
||||
}
|
||||
|
||||
void ftrace_return(vaddr_t addr) {
|
||||
void ftrace_return(vaddr_t pc, vaddr_t addr) {
|
||||
printf("[FTRACE] ret [%s@0x%x]\n", get_func_name(addr), addr);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue