提交 dcc2ce51 编写于 作者: Z Zihao Yu

Merge branch 'main-return' into 'rv64'

main: return 0 only when hitting good trap

See merge request projectn/nemu!7
int init_monitor(int, char *[]);
void ui_mainloop(int);
int goodtrap(void);
int main(int argc, char *argv[]) {
/* Initialize the monitor. */
......@@ -8,5 +9,5 @@ int main(int argc, char *argv[]) {
/* Receive commands from user. */
ui_mainloop(is_batch_mode);
return 0;
return !goodtrap();
}
......@@ -14,6 +14,10 @@
NEMUState nemu_state = {.state = NEMU_STOP};
int goodtrap(void) {
return (nemu_state.state == NEMU_END && nemu_state.halt_ret == 0);
}
void interpret_rtl_exit(int state, vaddr_t halt_pc, uint32_t halt_ret) {
nemu_state = (NEMUState) { .state = state, .halt_pc = halt_pc, .halt_ret = halt_ret };
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册