1 |
/* |
/* |
2 |
* Copyright (C) 2003-2005 Anders Gavare. All rights reserved. |
* Copyright (C) 2003-2006 Anders Gavare. All rights reserved. |
3 |
* |
* |
4 |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
5 |
* modification, are permitted provided that the following conditions are met: |
* modification, are permitted provided that the following conditions are met: |
25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: main.c,v 1.248 2005/11/23 02:17:00 debug Exp $ |
* $Id: main.c,v 1.256 2006/02/04 11:10:58 debug Exp $ |
29 |
*/ |
*/ |
30 |
|
|
31 |
#include <stdio.h> |
#include <stdio.h> |
56 |
char *progname; |
char *progname; |
57 |
|
|
58 |
int fully_deterministic = 0; |
int fully_deterministic = 0; |
59 |
|
int dyntrans_backend_enable = 1; |
60 |
|
|
61 |
|
|
62 |
/***************************************************************************** |
/***************************************************************************** |
195 |
#ifdef VERSION |
#ifdef VERSION |
196 |
printf("-" VERSION); |
printf("-" VERSION); |
197 |
#endif |
#endif |
198 |
printf(" Copyright (C) 2003-2005 Anders Gavare\n"); |
printf(" Copyright (C) 2003-2006 Anders Gavare\n"); |
199 |
printf("Read the source code and/or documentation for " |
printf("Read the source code and/or documentation for " |
200 |
"other Copyright messages.\n"); |
"other Copyright messages.\n"); |
201 |
|
|
220 |
printf("\nOther options:\n"); |
printf("\nOther options:\n"); |
221 |
printf(" -A disable alignment checks in some cases (for higher" |
printf(" -A disable alignment checks in some cases (for higher" |
222 |
" speed)\n"); |
" speed)\n"); |
223 |
#ifdef BINTRANS |
#if defined(BINTRANS) || defined(DYNTRANS_BACKEND) |
224 |
printf(" -B disable dynamic binary translation. (translation" |
printf(" -B disable native translation backends. (translation" |
225 |
" is turned on\n by default, if the host " |
" is turned on\n by default, if it is supposed for " |
226 |
"supports it)\n"); |
"the particular host)\n"); |
227 |
#endif |
#endif |
228 |
printf(" -C x try to emulate a specific CPU. (Use -H to get a " |
printf(" -C x try to emulate a specific CPU. (Use -H to get a " |
229 |
"list of types.)\n"); |
"list of types.)\n"); |
280 |
printf(" -X use X11\n"); |
printf(" -X use X11\n"); |
281 |
#endif /* WITH_X11 */ |
#endif /* WITH_X11 */ |
282 |
printf(" -x open up new xterms for emulated serial ports " |
printf(" -x open up new xterms for emulated serial ports " |
283 |
"(default is on when\n using configuration files, off" |
"(default is on when\n using configuration files or" |
284 |
" otherwise)\n"); |
" when X11 is used, off otherwise)\n"); |
285 |
#ifdef WITH_X11 |
#ifdef WITH_X11 |
286 |
printf(" -Y n scale down framebuffer windows by n x n times\n"); |
printf(" -Y n scale down framebuffer windows by n x n times\n"); |
287 |
#endif /* WITH_X11 */ |
#endif /* WITH_X11 */ |
298 |
" get a list of\n available emulation modes)\n"); |
" get a list of\n available emulation modes)\n"); |
299 |
|
|
300 |
printf("\nGeneral options:\n"); |
printf("\nGeneral options:\n"); |
301 |
|
printf(" -c cmd add cmd as a command to run before starting " |
302 |
|
"the simulation\n"); |
303 |
printf(" -D guarantee fully deterministic behaviour\n"); |
printf(" -D guarantee fully deterministic behaviour\n"); |
304 |
printf(" -H display a list of possible CPU and " |
printf(" -H display a list of possible CPU and " |
305 |
"machine types\n"); |
"machine types\n"); |
343 |
int msopts = 0; /* Machine-specific options used */ |
int msopts = 0; /* Machine-specific options used */ |
344 |
struct machine *m = emul_add_machine(emul, "default"); |
struct machine *m = emul_add_machine(emul, "default"); |
345 |
|
|
346 |
while ((ch = getopt(argc, argv, "ABC:Dd:E:e:HhI:iJj:KM:m:" |
while ((ch = getopt(argc, argv, "ABC:c:Dd:E:e:HhI:iJj:KM:m:" |
347 |
"Nn:Oo:p:QqRrSsTtUu:VvW:XxY:y:Z:z:")) != -1) { |
"Nn:Oo:p:QqRrSsTtUu:VvW:XxY:y:Z:z:")) != -1) { |
348 |
switch (ch) { |
switch (ch) { |
349 |
case 'A': |
case 'A': |
351 |
msopts = 1; |
msopts = 1; |
352 |
break; |
break; |
353 |
case 'B': |
case 'B': |
354 |
|
/* Turns off both bintrans and dyntrans. */ |
355 |
m->bintrans_enable = 0; |
m->bintrans_enable = 0; |
356 |
|
dyntrans_backend_enable = 0; |
357 |
msopts = 1; |
msopts = 1; |
358 |
break; |
break; |
359 |
case 'C': |
case 'C': |
360 |
m->cpu_name = strdup(optarg); |
m->cpu_name = strdup(optarg); |
361 |
msopts = 1; |
msopts = 1; |
362 |
break; |
break; |
363 |
|
case 'c': |
364 |
|
emul->n_debugger_cmds ++; |
365 |
|
emul->debugger_cmds = realloc(emul->debugger_cmds, |
366 |
|
emul->n_debugger_cmds * sizeof(char *)); |
367 |
|
if (emul->debugger_cmds == NULL) { |
368 |
|
fatal("out of memory\n"); |
369 |
|
exit(1); |
370 |
|
} |
371 |
|
emul->debugger_cmds[emul->n_debugger_cmds-1] = |
372 |
|
strdup(optarg); |
373 |
|
break; |
374 |
case 'D': |
case 'D': |
375 |
fully_deterministic = 1; |
fully_deterministic = 1; |
376 |
break; |
break; |
523 |
case 'X': |
case 'X': |
524 |
m->use_x11 = 1; |
m->use_x11 = 1; |
525 |
msopts = 1; |
msopts = 1; |
526 |
break; |
/* FALL-THROUGH */ |
527 |
case 'x': |
case 'x': |
528 |
console_allow_slaves(1); |
console_allow_slaves(1); |
529 |
break; |
break; |
667 |
exit(1); |
exit(1); |
668 |
} |
} |
669 |
|
|
670 |
|
#ifndef EXPERIMENTAL_NEWMIPS |
671 |
if (m->bintrans_enable && m->arch == ARCH_MIPS) { |
if (m->bintrans_enable && m->arch == ARCH_MIPS) { |
672 |
m->speed_tricks = 0; |
m->speed_tricks = 0; |
673 |
/* TODO: Print a warning about this? */ |
/* TODO: Print a warning about this? */ |
674 |
} |
} |
675 |
|
#endif |
676 |
|
|
677 |
if (m->n_breakpoints > 0 && |
if (m->n_breakpoints > 0 && |
678 |
m->bintrans_enable && m->arch == ARCH_MIPS) { |
m->bintrans_enable && m->arch == ARCH_MIPS) { |
764 |
#ifdef VERSION |
#ifdef VERSION |
765 |
debug("-" VERSION); |
debug("-" VERSION); |
766 |
#endif |
#endif |
767 |
debug(" Copyright (C) 2003-2005 Anders Gavare\n"); |
debug(" Copyright (C) 2003-2006 Anders Gavare\n"); |
768 |
debug("Read the source code and/or documentation for " |
debug("Read the source code and/or documentation for " |
769 |
"other Copyright messages.\n\n"); |
"other Copyright messages.\n\n"); |
770 |
|
|
807 |
fprintf(stderr, "out of memory\n"); |
fprintf(stderr, "out of memory\n"); |
808 |
exit(1); |
exit(1); |
809 |
} |
} |
|
emuls[n_emuls - 1] = |
|
|
emul_create_from_configfile(s); |
|
810 |
|
|
811 |
/* Always allow slave xterms when using multiple |
/* Always allow slave xterms when using multiple |
812 |
emulations: */ |
emulations: */ |
813 |
console_allow_slaves(1); |
console_allow_slaves(1); |
814 |
|
|
815 |
|
emuls[n_emuls - 1] = |
816 |
|
emul_create_from_configfile(s); |
817 |
} |
} |
818 |
} |
} |
819 |
|
|
827 |
} |
} |
828 |
|
|
829 |
device_set_exit_on_error(0); |
device_set_exit_on_error(0); |
830 |
console_warn_if_slaves_are_needed(); |
console_warn_if_slaves_are_needed(1); |
831 |
|
|
832 |
/* Run all emulations: */ |
/* Run all emulations: */ |
833 |
emul_run(emuls, n_emuls); |
emul_run(emuls, n_emuls); |