提交 607434b1 编写于 作者: Z Zihao Yu

Merge branch 'reset-at-0' into 'rv64'

Reset at 0

See merge request projectn/nemu!23
......@@ -6,7 +6,8 @@
#define PMEM_SIZE (128 * 1024 * 1024)
extern uint8_t pmem[];
#define IMAGE_START 0x100000
#define IMAGE_START 0x0
#define MAINARGS_START 0x1000
/* convert the guest physical address in the guest program to host virtual address in NEMU */
#define guest_to_host(p) ((void *)(pmem + (unsigned)p))
......
......@@ -78,8 +78,6 @@ void init_difftest(char *ref_so_file, long img_size, int port) {
ref_difftest_init(port);
ref_difftest_memcpy_from_dut(PC_START, guest_to_host(IMAGE_START), img_size);
char *mainargs = guest_to_host(0);
ref_difftest_memcpy_from_dut(PC_START - IMAGE_START, mainargs, strlen(mainargs) + 1);
ref_difftest_setregs(&cpu);
}
......
......@@ -11,7 +11,7 @@ void init_wp_pool();
void init_device();
void init_difftest(char *ref_so_file, long img_size, int port);
static char *mainargs = "";
static char *mainargs = NULL;
static char *log_file = NULL;
static char *diff_so_file = NULL;
static char *img_file = NULL;
......@@ -60,7 +60,9 @@ static inline long load_img() {
fclose(fp);
// mainargs
strcpy(guest_to_host(0), mainargs);
if (mainargs != NULL) {
strcpy(guest_to_host(MAINARGS_START), mainargs);
}
}
return size;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册