Revision 586314f2 linux-user/main.c
b/linux-user/main.c | ||
---|---|---|
27 | 27 |
|
28 | 28 |
#include "cpu-i386.h" |
29 | 29 |
|
30 |
#define DEBUG_LOGFILE "/tmp/gemu.log" |
|
31 |
|
|
32 |
FILE *logfile = NULL; |
|
33 |
int loglevel; |
|
34 |
|
|
30 | 35 |
unsigned long x86_stack_size; |
31 | 36 |
unsigned long stktop; |
32 | 37 |
|
... | ... | |
83 | 88 |
void usage(void) |
84 | 89 |
{ |
85 | 90 |
printf("gemu version 0.1, Copyright (c) 2003 Fabrice Bellard\n" |
86 |
"usage: gemu program [arguments...]\n" |
|
91 |
"usage: gemu [-d] program [arguments...]\n"
|
|
87 | 92 |
"Linux x86 emulator\n" |
88 | 93 |
); |
89 | 94 |
exit(1); |
... | ... | |
95 | 100 |
struct target_pt_regs regs1, *regs = ®s1; |
96 | 101 |
struct image_info info1, *info = &info1; |
97 | 102 |
CPUX86State *env; |
103 |
int optind; |
|
98 | 104 |
|
99 | 105 |
if (argc <= 1) |
100 | 106 |
usage(); |
101 |
|
|
102 |
filename = argv[1]; |
|
107 |
loglevel = 0; |
|
108 |
optind = 1; |
|
109 |
if (argv[optind] && !strcmp(argv[optind], "-d")) { |
|
110 |
loglevel = 1; |
|
111 |
optind++; |
|
112 |
} |
|
113 |
filename = argv[optind]; |
|
114 |
|
|
115 |
/* init debug */ |
|
116 |
if (loglevel) { |
|
117 |
logfile = fopen(DEBUG_LOGFILE, "w"); |
|
118 |
if (!logfile) { |
|
119 |
perror(DEBUG_LOGFILE); |
|
120 |
exit(1); |
|
121 |
} |
|
122 |
setvbuf(logfile, NULL, _IOLBF, 0); |
|
123 |
} |
|
103 | 124 |
|
104 | 125 |
/* Zero out regs */ |
105 | 126 |
memset(regs, 0, sizeof(struct target_pt_regs)); |
Also available in: Unified diff