diff --git a/nemu/.result.tmp b/nemu/.result.tmp deleted file mode 100644 index e69de29..0000000 diff --git a/nemu/Makefile b/nemu/Makefile index e5e37c3..e5e5838 100644 --- a/nemu/Makefile +++ b/nemu/Makefile @@ -94,4 +94,4 @@ integration-tests: $(IMAGES) test: unit-tests integration-tests -.PHONY: test unit-tests integration-tests \ No newline at end of file +.PHONY: test unit-tests integration-tests diff --git a/nemu/default.nix b/nemu/default.nix index a886b79..e746a7c 100644 --- a/nemu/default.nix +++ b/nemu/default.nix @@ -38,7 +38,7 @@ stdenv.mkDerivation rec { doCheck = true; checkPhase = '' - export IMAGES_PATH=${am-kernels}/share/images + export IMAGES_PATH=${am-kernels}/share/binary make test ''; @@ -49,7 +49,7 @@ stdenv.mkDerivation rec { shellHook = '' export NEMU_HOME=$(pwd) - export IMAGES_PATH=${am-kernels}/share/images + export IMAGES_PATH=${am-kernels}/share/binary ''; meta = with lib; { diff --git a/nemu/include/debug.h b/nemu/include/debug.h index 3aae781..329c64a 100644 --- a/nemu/include/debug.h +++ b/nemu/include/debug.h @@ -18,6 +18,7 @@ #include #include +#include IFDEF(CONFIG_ITRACE, void log_itrace_print()); diff --git a/nemu/src/isa/riscv32/inst.c b/nemu/src/isa/riscv32/inst.c index 41c2098..1c41c63 100644 --- a/nemu/src/isa/riscv32/inst.c +++ b/nemu/src/isa/riscv32/inst.c @@ -62,6 +62,7 @@ static void do_branch(Decode *s, bool condition, word_t offset) { } } +#ifdef CONFIG_FTRACE static void ftrace_jalr(Decode *s, int rd, vaddr_t dst) { uint32_t i = s->isa.inst.val; int rs1 = BITS(i, 19, 15); @@ -71,6 +72,7 @@ static void ftrace_jalr(Decode *s, int rd, vaddr_t dst) { ftrace_call(s->pc, dst); } } +#endif static int decode_exec(Decode *s) { int rd = 0; diff --git a/nemu/src/monitor/monitor.c b/nemu/src/monitor/monitor.c index 6755edf..0154208 100644 --- a/nemu/src/monitor/monitor.c +++ b/nemu/src/monitor/monitor.c @@ -133,8 +133,12 @@ void init_monitor(int argc, char *argv[]) { // printf("elf_file: %s\n", elf_file); if(elf_file != NULL) { +#ifdef CONFIG_FTRACE void init_elf(const char *path); init_elf(elf_file); +#else + Warning("Elf file provided, but ftrace not turned on. Ignoring elf file."); +#endif } #ifndef CONFIG_ISA_loongarch32r diff --git a/nemu/src/utils/ftrace.c b/nemu/src/utils/ftrace.c index ec668c0..ea2f2b6 100644 --- a/nemu/src/utils/ftrace.c +++ b/nemu/src/utils/ftrace.c @@ -10,7 +10,6 @@ static vaddr_t ftrace_stack[CONFIG_FTRACE_STACK_SIZE] = {0}; static vaddr_t ftrace_stack_len = 0; func_t *func_table = NULL; int func_table_len = 0, func_table_size = 8; -#endif static int cmp_func_t(const void *a, const void *b) { return ((func_t *)a)->start > ((func_t *)b)->start; @@ -122,3 +121,4 @@ void ftrace_return(vaddr_t pc, vaddr_t addr) { Trace("%*s0x%x ret 0x%x <%s+0x%x>", ftrace_stack_len, "", pc, addr, f == NULL ? "???" : f->name, addr - f->start); } +#endif