diff --git a/abstract-machine/am/src/platform/nemu/ioe/gpu.c b/abstract-machine/am/src/platform/nemu/ioe/gpu.c index 7a64389..7063e85 100644 --- a/abstract-machine/am/src/platform/nemu/ioe/gpu.c +++ b/abstract-machine/am/src/platform/nemu/ioe/gpu.c @@ -6,14 +6,14 @@ #define GET_H(var) uint16_t var = inw(VGACTL_ADDR) void __am_gpu_init() { - int i; - GET_W(w); - GET_H(h); - // int w = inw(VGACTL_ADDR + 2); // TODO: get the correct width - // int h = inw(VGACTL_ADDR); // TODO: get the correct height - uint32_t *fb = (uint32_t *)(uintptr_t)FB_ADDR; - for (i = 0; i < w * h; i ++) fb[i] = i; - outl(SYNC_ADDR, 1); + // int i; + // GET_W(w); + // GET_H(h); + // // int w = inw(VGACTL_ADDR + 2); // TODO: get the correct width + // // int h = inw(VGACTL_ADDR); // TODO: get the correct height + // uint32_t *fb = (uint32_t *)(uintptr_t)FB_ADDR; + // for (i = 0; i < w * h; i ++) fb[i] = i; + // outl(SYNC_ADDR, 1); } void __am_gpu_config(AM_GPU_CONFIG_T *cfg) { diff --git a/nemu/Kconfig b/nemu/Kconfig index d6ba87d..40129bc 100644 --- a/nemu/Kconfig +++ b/nemu/Kconfig @@ -1,22 +1,5 @@ mainmenu "NEMU Configuration Menu" -menu "NEMU Configuration Options" - config WATCHPOINT - bool "Enable Watchpoint" - default n - help - Say Y here if you want to enable watchpoint functionality. - This will add performance overhead but is useful for debugging. - config LOG_EXPR - bool "Enable make_token Log" - default n - help - Say Y here if you want to enable match rules Log - config TEST_EXPR - bool "Enable test expr program" - default n -endmenu - choice prompt "Base ISA" default ISA_riscv @@ -143,89 +126,8 @@ endmenu menu "Testing and Debugging" - -config TRACE - bool "Enable tracer" - default y - -config TRACE_START - depends on TRACE - int "When tracing is enabled (unit: number of instructions)" - default 0 - -config TRACE_END - depends on TRACE - int "When tracing is disabled (unit: number of instructions)" - default 10000 - -config ITRACE - depends on TRACE && TARGET_NATIVE_ELF && ENGINE_INTERPRETER - bool "Enable instruction tracer" - default y - -config ITRACE_COND - depends on ITRACE - string "Only trace instructions when the condition is true" - default "true" - - -config IRINGBUF - depends on TRACE && TARGET_NATIVE_ELF && ENGINE_INTERPRETER - bool "Enable iringbuf tracer" - default n - -config IRINGBUF_LINENUM - depends on IRINGBUF - int "Instruction ring buffer size" - default 16 - -config IRINGBUF_ASSERT_DISPLAY - depends on IRINGBUF - bool "Enable to log when assert failure(Warning it may display twice in `IRINGBUF_DISPLAY`)" - default y - -config IRINGBUF_DISPLAY - depends on IRINGBUF - bool "Enable to iringbuf log in 'statistic'(must end of log file) otherwise just in assert failure to log" - default n - - -config MTRACE - depends on TRACE && TARGET_NATIVE_ELF && ENGINE_INTERPRETER - bool "Enable memory tracer" - default n - -config MTRACE_COND - depends on MTRACE - string "Only trace memory when the condition is true (you can use 'addr' variable)" - default "addr != 0" - -config MTRACE_WRITE - depends on MTRACE - bool "Enable memory trace on write" - default y - -config MTRACE_READ - depends on MTRACE - bool "Enable memory trace on read" - default y - - -config FTRACE - depends on TRACE && TARGET_NATIVE_ELF && ENGINE_INTERPRETER - bool "Enable function tracer" - default n - -config FTRACE_DISPLAY - depends on FTRACE - bool "Enable to ftrace log in 'statistic'(must end of log file)" - default n - -config FTRACE_INST - depends on FTRACE - bool "Enable ftrace in itrace means in every instruction to show what function name" - default n - +source "src/cpu/Kconfig" # trace +source "src/monitor/Kconfig" # debug config DIFFTEST depends on TARGET_NATIVE_ELF diff --git a/nemu/src/cpu/Kconfig b/nemu/src/cpu/Kconfig new file mode 100644 index 0000000..57e94ab --- /dev/null +++ b/nemu/src/cpu/Kconfig @@ -0,0 +1,96 @@ +menuconfig TRACE + depends on TARGET_NATIVE_ELF && ENGINE_INTERPRETER + bool "Enable tracer" + default y + +if TRACE + +config TRACE_START + depends on TRACE + int "When tracing is enabled (unit: number of instructions)" + default 0 + +config TRACE_END + depends on TRACE + int "When tracing is disabled (unit: number of instructions)" + default 10000 + +menuconfig ITRACE + bool "Enable instruction tracer" + default y + +if ITRACE +config ITRACE_COND + depends on ITRACE + string "Only trace instructions when the condition is true" + default "true" +endif # ITRACE + +menuconfig IRINGBUF + bool "Enable iringbuf tracer" + default n + +if IRINGBUF +config IRINGBUF_LINENUM + depends on IRINGBUF + int "Instruction ring buffer size" + default 16 + +config IRINGBUF_ASSERT_DISPLAY + depends on IRINGBUF + bool "Enable to log when assert failure(Warning it may display twice in `IRINGBUF_DISPLAY`)" + default y + +config IRINGBUF_DISPLAY + depends on IRINGBUF + bool "Enable to iringbuf log in 'statistic'(must end of log file) otherwise just in assert failure to log" + default n +endif # IRINGBUF + +menuconfig MTRACE + bool "Enable memory tracer" + default n + +if MTRACE +config MTRACE_COND + depends on MTRACE + string "Only trace memory when the condition is true (you can use 'addr' variable)" + default "addr != 0" + +config MTRACE_WRITE + depends on MTRACE + bool "Enable memory trace on write" + default y + +config MTRACE_READ + depends on MTRACE + bool "Enable memory trace on read" + default y +endif # MTRACE + +menuconfig FTRACE + bool "Enable function tracer" + default n + +if FTRACE +config FTRACE_DISPLAY + depends on FTRACE + bool "Enable to ftrace log in 'statistic'(must end of log file)" + default n + +config FTRACE_INST + depends on FTRACE + bool "Enable ftrace in itrace means in every instruction to show what function name" + default n +endif # FTRACE + +menuconfig DTRACE + bool "Enable devices tracer" + default n + +if DTRACE + + +endif # DTRACE + +endif # TRACE diff --git a/nemu/src/device/audio.c b/nemu/src/device/audio.c index 0fb22f1..b03b731 100644 --- a/nemu/src/device/audio.c +++ b/nemu/src/device/audio.c @@ -38,7 +38,7 @@ static void audio_callback(void *userdata, uint8_t *stream, int len) { uint32_t read_cnt = MIN(count, len); uint32_t to_end_cnt = audio_base[reg_sbuf_size] - pos_read; int32_t out_bound_cnt = read_cnt - to_end_cnt; - memset(stream, 0, len); + // memset(stream, 0, len); if (out_bound_cnt > 0) { memcpy(stream, sbuf + pos_read, to_end_cnt); memcpy(stream + to_end_cnt, sbuf, out_bound_cnt); @@ -47,7 +47,7 @@ static void audio_callback(void *userdata, uint8_t *stream, int len) { } pos_read += read_cnt; pos_read %= audio_base[reg_sbuf_size]; - // if (len > read_cnt) memset(stream + read_cnt, 0, len - read_cnt); + if (len > read_cnt) memset(stream + read_cnt, 0, len - read_cnt); audio_base[reg_count] -= read_cnt; } diff --git a/nemu/src/monitor/Kconfig b/nemu/src/monitor/Kconfig new file mode 100644 index 0000000..a1971d8 --- /dev/null +++ b/nemu/src/monitor/Kconfig @@ -0,0 +1,16 @@ +menu "NEMU Configuration Options" + config WATCHPOINT + bool "Enable Watchpoint" + default n + help + Say Y here if you want to enable watchpoint functionality. + This will add performance overhead but is useful for debugging. + config LOG_EXPR + bool "Enable make_token Log" + default n + help + Say Y here if you want to enable match rules Log + config TEST_EXPR + bool "Enable test expr program" + default n +endmenu