提交 49ef8f25 编写于 作者: Z Zihao Yu

device: add argsrom to support mainargs in AM

上级 7293c4a9
#include "common.h"
#include "device/map.h"
#define ARGSROM_MMIO 0xa2000000
static uint8_t *argsrom_base;
char* get_mainargs(void);
void init_argsrom() {
argsrom_base = new_space(4096);
strcpy((char *)argsrom_base, get_mainargs());
add_mmio_map("argsrom", ARGSROM_MMIO, argsrom_base, 4096, NULL);
}
#include "common.h"
void init_argsrom();
#ifdef HAS_IOE
#include <sys/time.h>
......@@ -64,6 +66,7 @@ void sdl_clear_event_queue() {
}
void init_device() {
init_argsrom();
init_serial();
init_timer();
init_vga();
......@@ -83,6 +86,7 @@ void init_device() {
#else
void init_device() {
init_argsrom();
}
#endif /* HAS_IOE */
......@@ -9,6 +9,7 @@ void init_device();
void init_difftest(char *ref_so_file, long img_size);
FILE *log_fp = NULL;
static char *mainargs = "";
static char *log_file = NULL;
static char *diff_so_file = NULL;
static char *img_file = NULL;
......@@ -68,9 +69,10 @@ static inline long load_img() {
static inline void parse_args(int argc, char *argv[]) {
int o;
while ( (o = getopt(argc, argv, "-bl:d:")) != -1) {
while ( (o = getopt(argc, argv, "-bl:d:a:")) != -1) {
switch (o) {
case 'b': is_batch_mode = true; break;
case 'a': mainargs = optarg; break;
case 'l': log_file = optarg; break;
case 'd': diff_so_file = optarg; break;
case 1:
......@@ -83,6 +85,10 @@ static inline void parse_args(int argc, char *argv[]) {
}
}
char* get_mainargs(void) {
return mainargs;
}
int init_monitor(int argc, char *argv[]) {
/* Perform some global initialization. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册