diff --git a/nemu/.metals/metals.log b/nemu/.metals/metals.log new file mode 100644 index 0000000..6c3b991 --- /dev/null +++ b/nemu/.metals/metals.log @@ -0,0 +1,3 @@ +2024.02.03 20:20:12 INFO Started: Metals version 1.2.0+12-644090c2-SNAPSHOT in folders '/home/xin/repo/ysyx-workbench/nemu' for client Visual Studio Code 1.85.2. +2024.02.03 20:20:13 WARN Build server is not auto-connectable. +2024.02.03 20:20:13 WARN no build tool detected in workspace '/home/xin/repo/ysyx-workbench/nemu'. The most common cause for this problem is that the editor was opened in the wrong working directory, for example if you use sbt then the workspace directory should contain build.sbt.  diff --git a/nemu/.metals/metals.mv.db b/nemu/.metals/metals.mv.db new file mode 100644 index 0000000..634be79 Binary files /dev/null and b/nemu/.metals/metals.mv.db differ diff --git a/nemu/.vscode/settings.json b/nemu/.vscode/settings.json index 0acacd4..c9da297 100644 --- a/nemu/.vscode/settings.json +++ b/nemu/.vscode/settings.json @@ -1,3 +1,6 @@ { - "digital-ide.welcome.show": false + "digital-ide.welcome.show": false, + "files.watcherExclude": { + "**/target": true + } } \ No newline at end of file diff --git a/nemu/src/monitor/sdb/sdb.c b/nemu/src/monitor/sdb/sdb.c index 1e0789e..7e1ebed 100644 --- a/nemu/src/monitor/sdb/sdb.c +++ b/nemu/src/monitor/sdb/sdb.c @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include @@ -125,17 +125,13 @@ static word_t parse_uint(const char *arg, bool *success) { } } -static paddr_t parse_expr(const char *arg, bool *success) { +static vaddr_t parse_expr(const char *arg, bool *success) { if (arg == NULL) { puts("Invalid expr argument."); *success = false; return 0; } else { - // bool res = false; - // FIXME: We cannot use `parse_uint` here, it accept `-1234` as input - // paddr_t addr = parse_uint(arg, &res); - // *success = res; - paddr_t addr; + vaddr_t addr; yy_scan_string(arg); *success = !yyparse(&addr); yylex_destroy(); @@ -197,11 +193,11 @@ static int cmd_x(char *args) { if (!res) goto wrong_usage; addr = addr & ~(WORD_BYTES - 1); - for (paddr_t paddr = addr; paddr < addr + n; paddr += WORD_BYTES) { - word_t value = paddr_read(addr, WORD_BYTES); + for (vaddr_t vaddr = addr; vaddr < addr + n; vaddr += WORD_BYTES) { + word_t value = vaddr_read(addr, WORD_BYTES); printf("\e[1;34m" FMT_PADDR "\e[0m" " " FMT_WORD "\n", - paddr, value); + vaddr, value); } return 0; diff --git a/nemu/src/monitor/sdb/sdb.h b/nemu/src/monitor/sdb/sdb.h index b1c87de..e94846c 100644 --- a/nemu/src/monitor/sdb/sdb.h +++ b/nemu/src/monitor/sdb/sdb.h @@ -18,20 +18,4 @@ #include -// TODO: Cache expression evalutation result in ExprResult -enum ExprType { - EXPR_TYPE_MEM_ADDR, - EXPR_TYPE_REG -}; - -union ExprValue { - word_t addr; - word_t *reg; -}; - -typedef struct ExprResult { - union ExprValue val; - enum ExprType type; -} ExprResult; - #endif diff --git a/nemu/src/monitor/sdb/watchpoint.c b/nemu/src/monitor/sdb/watchpoint.c index d6440d3..2618bba 100644 --- a/nemu/src/monitor/sdb/watchpoint.c +++ b/nemu/src/monitor/sdb/watchpoint.c @@ -97,12 +97,4 @@ int wp_remove_by_number(int number) { return 0; } -int wp_eval_all() { - WP *wp; - for (wp = head; wp != NULL; wp = wp->next) { - - } - return 0; -} - /* TODO: Implement the functionality of watchpoint */