> 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:53:37 up 3 days, 17:59,  1 user,  load average: 0.94, 0.65, 0.45
This commit is contained in:
tracer-ics2023
2024-09-20 22:53:38 +08:00
committed by zzy
parent 3f1f764cc3
commit abc0720fe2
5 changed files with 124 additions and 110 deletions

View File

@ -6,14 +6,14 @@
#define GET_H(var) uint16_t var = inw(VGACTL_ADDR) #define GET_H(var) uint16_t var = inw(VGACTL_ADDR)
void __am_gpu_init() { void __am_gpu_init() {
int i; // int i;
GET_W(w); // GET_W(w);
GET_H(h); // GET_H(h);
// int w = inw(VGACTL_ADDR + 2); // TODO: get the correct width // // int w = inw(VGACTL_ADDR + 2); // TODO: get the correct width
// int h = inw(VGACTL_ADDR); // TODO: get the correct height // // int h = inw(VGACTL_ADDR); // TODO: get the correct height
uint32_t *fb = (uint32_t *)(uintptr_t)FB_ADDR; // uint32_t *fb = (uint32_t *)(uintptr_t)FB_ADDR;
for (i = 0; i < w * h; i ++) fb[i] = i; // for (i = 0; i < w * h; i ++) fb[i] = i;
outl(SYNC_ADDR, 1); // outl(SYNC_ADDR, 1);
} }
void __am_gpu_config(AM_GPU_CONFIG_T *cfg) { void __am_gpu_config(AM_GPU_CONFIG_T *cfg) {

View File

@ -1,22 +1,5 @@
mainmenu "NEMU Configuration Menu" 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 choice
prompt "Base ISA" prompt "Base ISA"
default ISA_riscv default ISA_riscv
@ -143,89 +126,8 @@ endmenu
menu "Testing and Debugging" menu "Testing and Debugging"
source "src/cpu/Kconfig" # trace
config TRACE source "src/monitor/Kconfig" # debug
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
config DIFFTEST config DIFFTEST
depends on TARGET_NATIVE_ELF depends on TARGET_NATIVE_ELF

96
nemu/src/cpu/Kconfig Normal file
View File

@ -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

View File

@ -38,7 +38,7 @@ static void audio_callback(void *userdata, uint8_t *stream, int len) {
uint32_t read_cnt = MIN(count, len); uint32_t read_cnt = MIN(count, len);
uint32_t to_end_cnt = audio_base[reg_sbuf_size] - pos_read; uint32_t to_end_cnt = audio_base[reg_sbuf_size] - pos_read;
int32_t out_bound_cnt = read_cnt - to_end_cnt; int32_t out_bound_cnt = read_cnt - to_end_cnt;
memset(stream, 0, len); // memset(stream, 0, len);
if (out_bound_cnt > 0) { if (out_bound_cnt > 0) {
memcpy(stream, sbuf + pos_read, to_end_cnt); memcpy(stream, sbuf + pos_read, to_end_cnt);
memcpy(stream + to_end_cnt, sbuf, out_bound_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 += read_cnt;
pos_read %= audio_base[reg_sbuf_size]; 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; audio_base[reg_count] -= read_cnt;
} }

16
nemu/src/monitor/Kconfig Normal file
View File

@ -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