/[gxemul]/trunk/src/main.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/main.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 22 by dpavlin, Mon Oct 8 16:19:37 2007 UTC revision 32 by dpavlin, Mon Oct 8 16:20:58 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: main.c,v 1.256 2006/02/04 11:10:58 debug Exp $   *  $Id: main.c,v 1.284 2006/09/19 10:50:08 debug Exp $
29   */   */
30    
31  #include <stdio.h>  #include <stdio.h>
# Line 37  Line 37 
37    
38  #include "console.h"  #include "console.h"
39  #include "cpu.h"  #include "cpu.h"
40    #include "debugger.h"
41  #include "device.h"  #include "device.h"
42  #include "diskimage.h"  #include "diskimage.h"
43  #include "emul.h"  #include "emul.h"
44  #include "machine.h"  #include "machine.h"
45  #include "misc.h"  #include "misc.h"
46    #include "settings.h"
47    #include "timer.h"
48    
49    
50  extern volatile int single_step;  extern volatile int single_step;
51  extern int force_debugger_at_exit;  extern int force_debugger_at_exit;
 extern int show_opcode_statistics;  
52    
53  extern int optind;  extern int optind;
54  extern char *optarg;  extern char *optarg;
55    
56    struct settings *global_settings;
57    
58  int extra_argc;  int extra_argc;
59  char **extra_argv;  char **extra_argv;
60  char *progname;  char *progname;
61    
62  int fully_deterministic = 0;  int skip_srandom_call = 0;
 int dyntrans_backend_enable = 1;  
63    
64    
65  /*****************************************************************************  /*****************************************************************************
# Line 193  static void usage(int longusage) Line 196  static void usage(int longusage)
196  {  {
197          printf("GXemul");          printf("GXemul");
198  #ifdef VERSION  #ifdef VERSION
199          printf("-" VERSION);          printf(" " VERSION);
200  #endif  #endif
201          printf("   Copyright (C) 2003-2006  Anders Gavare\n");          printf("    Copyright (C) 2003-2006  Anders Gavare\n");
202          printf("Read the source code and/or documentation for "          printf("Read the source code and/or documentation for "
203              "other Copyright messages.\n");              "other Copyright messages.\n");
204    
205          printf("\nusage: %s [machine, other, and general options] [file "          printf("\nusage: %s [machine, other, and general options] [file "
206              "[...]]\n", progname);              "[...]]\n", progname);
207          printf("   or  %s [general options] @configfile\n", progname);          printf("   or  %s [general options] @configfile\n", progname);
208    #ifdef UNSTABLE_DEVEL
209          printf("   or  %s [userland, other, and general options] file "          printf("   or  %s [userland, other, and general options] file "
210              "[args ...]\n", progname);              "[args ...]\n", progname);
211    #endif
212    
213          if (!longusage) {          if (!longusage) {
214                  printf("\nRun  %s -h  for help on command line options.\n",                  printf("\nRun  %s -h  for help on command line options.\n",
# Line 218  static void usage(int longusage) Line 223  static void usage(int longusage)
223              "with -E.)\n");              "with -E.)\n");
224    
225          printf("\nOther options:\n");          printf("\nOther options:\n");
         printf("  -A        disable alignment checks in some cases (for higher"  
             " speed)\n");  
 #if defined(BINTRANS) || defined(DYNTRANS_BACKEND)  
         printf("  -B        disable native translation backends. (translation"  
             " is turned on\n            by default, if it is supposed for "  
             "the particular host)\n");  
 #endif  
226          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 "
227              "list of types.)\n");              "list of types.)\n");
228          printf("  -d fname  add fname as a disk image. You can add \"xxx:\""          printf("  -d fname  add fname as a disk image. You can add \"xxx:\""
# Line 243  static void usage(int longusage) Line 241  static void usage(int longusage)
241          printf("                s      SCSI\n");          printf("                s      SCSI\n");
242          printf("                t      tape\n");          printf("                t      tape\n");
243          printf("                0-7    force a specific ID\n");          printf("                0-7    force a specific ID\n");
244          printf("  -I x      emulate clock interrupts at x Hz (affects"          printf("  -G port   listen to gdb remote connections on this port\n");
245              " rtc devices only, not\n");          printf("  -I hz     set the main cpu frequency to hz (not used by "
246          printf("            actual runtime speed) (this disables automatic"              "all combinations\n            of machines and guest OSes)");
             " clock adjustments)\n");  
247          printf("  -i        display each instruction as it is executed\n");          printf("  -i        display each instruction as it is executed\n");
248          printf("  -J        disable some speed tricks\n");          printf("  -J        disable dyntrans instruction combinations\n");
249          printf("  -j name   set the name of the kernel, for example:\n");          printf("  -j name   set the name of the kernel; for DECstation "
250          printf("                -j netbsd          for NetBSD/pmax\n");              "emulation, this passes\n            the name to the bootloader,"
251          printf("                -j bsd             for OpenBSD/pmax\n");              " for example:\n");
252          printf("                -j vmunix          for Ultrix/RISC\n");          printf("                -j netbsd     (NetBSD/pmax)      "
253                "-j bsd      (OpenBSD/pmax)\n");
254            printf("                -j vmsprite   (Sprite/pmax)      "
255                "-j vmunix   (Ultrix/RISC)\n");
256            printf("            For other emulation modes, if the boot disk is an"
257                " ISO9660\n            filesystem, -j sets the name of the"
258                " kernel to load.\n");
259          printf("  -M m      emulate m MBs of physical RAM\n");          printf("  -M m      emulate m MBs of physical RAM\n");
         printf("  -m nr     run at most nr instructions (on any cpu)\n");  
260          printf("  -N        display nr of instructions/second average, at"          printf("  -N        display nr of instructions/second average, at"
261              " regular intervals\n");              " regular intervals\n");
262          printf("  -n nr     set nr of CPUs (for SMP experiments)\n");          printf("  -n nr     set nr of CPUs (for SMP experiments)\n");
263          printf("  -O        force netboot (tftp instead of disk), even when"          printf("  -O        force netboot (tftp instead of disk), even when"
264              " a disk image is\n"              " a disk image is\n"
265              "            present (for DECstation, SGI, and ARC emulation)\n");              "            present (for DECstation, SGI, and ARC emulation)\n");
266          printf("  -o arg    set the boot argument (for DEC, ARC, or SGI"          printf("  -o arg    set the boot argument, for DEC, ARC, or SGI"
267              " emulation).\n");              " emulation\n");
268          printf("            Default arg for DEC is '-a', for ARC '-aN'.\n");          printf("            (default arg for DEC is -a, for ARC/SGI -aN)\n");
269          printf("  -p pc     add a breakpoint (remember to use the '0x' "          printf("  -p pc     add a breakpoint (remember to use the '0x' "
270              "prefix for hex!)\n");              "prefix for hex!)\n");
271          printf("  -Q        no built-in PROM emulation  (use this for "          printf("  -Q        no built-in PROM emulation  (use this for "
# Line 272  static void usage(int longusage) Line 274  static void usage(int longusage)
274          printf("  -r        register dumps before every instruction\n");          printf("  -r        register dumps before every instruction\n");
275          printf("  -S        initialize emulated RAM to random bytes, "          printf("  -S        initialize emulated RAM to random bytes, "
276              "instead of zeroes\n");              "instead of zeroes\n");
277          printf("  -T        enter the single-step debugger on "          printf("  -s f:name write statistics to file 'name', "
278              "unimplemented memory accesses\n");              "f is one or more of the following:\n");
279            printf("                v    virtual program counter\n");
280            printf("                p    physical equivalent of program counter\n");
281            printf("                i    internal ic->f representation of "
282                "the program counter\n");
283            printf("            and optionally:\n");
284            printf("                d    disable statistics gathering at "
285                "startup\n");
286            printf("                o    overwrite instead of append\n");
287          printf("  -t        show function trace tree\n");          printf("  -t        show function trace tree\n");
288          printf("  -U        enable slow_serial_interrupts_hack_for_linux\n");          printf("  -U        enable slow_serial_interrupts_hack_for_linux\n");
289  #ifdef WITH_X11  #ifdef WITH_X11
290          printf("  -X        use X11\n");          printf("  -X        use X11\n");
 #endif /*  WITH_X11  */  
291          printf("  -x        open up new xterms for emulated serial ports "          printf("  -x        open up new xterms for emulated serial ports "
292              "(default is on when\n            using configuration files or"              "(default is on when\n            using configuration files or"
293              " when X11 is used, off otherwise)\n");              " when X11 is used, off otherwise)\n");
 #ifdef WITH_X11  
294          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");
295  #endif /*  WITH_X11  */  #endif /*  WITH_X11  */
         printf("  -y x      set max_random_cycles_per_chunk to x"  
             " (experimental)\n");  
296          printf("  -Z n      set nr of graphics cards, for emulating a "          printf("  -Z n      set nr of graphics cards, for emulating a "
297              "dual-head or tripple-head\n"              "dual-head or tripple-head\n"
298              "            environment (only for DECstation emulation)\n");              "            environment (only for DECstation emulation)\n");
299          printf("  -z disp   add disp as an X11 display to use for "          printf("  -z disp   add disp as an X11 display to use for "
300              "framebuffers\n");              "framebuffers\n");
301    
302    #ifdef UNSTABLE_DEVEL
303          printf("\nUserland options:\n");          printf("\nUserland options:\n");
304          printf("  -u emul   userland-only (syscall) emulation (use -H to"          printf("  -u emul   userland-only (syscall) emulation (use -H to"
305              " get a list of\n            available emulation modes)\n");              " get a list of\n            available emulation modes)\n");
306    #endif
307    
308          printf("\nGeneral options:\n");          printf("\nGeneral options:\n");
309          printf("  -c cmd    add cmd as a command to run before starting "          printf("  -c cmd    add cmd as a command to run before starting "
310              "the simulation\n");              "the simulation\n");
311          printf("  -D        guarantee fully deterministic behaviour\n");          printf("  -D        skip the srandom call at startup\n");
312          printf("  -H        display a list of possible CPU and "          printf("  -H        display a list of possible CPU and "
313              "machine types\n");              "machine types\n");
314          printf("  -h        display this help message\n");          printf("  -h        display this help message\n");
315          printf("  -K        force the debugger to be entered at the end "          printf("  -K        force the debugger to be entered at the end "
316              "of a simulation\n");              "of a simulation\n");
317          printf("  -q        quiet mode (don't print startup messages)\n");          printf("  -q        quiet mode (don't print startup messages)\n");
         printf("  -s        show opcode usage statistics after simulation\n");  
318          printf("  -V        start up in the single-step debugger, paused\n");          printf("  -V        start up in the single-step debugger, paused\n");
319          printf("  -v        verbose debug messages\n");          printf("  -v        verbose debug messages\n");
320          printf("\n");          printf("\n");
# Line 338  int get_cmd_args(int argc, char *argv[], Line 345  int get_cmd_args(int argc, char *argv[],
345          char ***diskimagesp, int *n_diskimagesp)          char ***diskimagesp, int *n_diskimagesp)
346  {  {
347          int ch, res, using_switch_d = 0, using_switch_Z = 0;          int ch, res, using_switch_d = 0, using_switch_Z = 0;
348            int using_switch_e = 0, using_switch_E = 0;
349          char *type = NULL, *subtype = NULL;          char *type = NULL, *subtype = NULL;
350          int n_cpus_set = 0;          int n_cpus_set = 0;
351          int msopts = 0;         /*  Machine-specific options used  */          int msopts = 0;         /*  Machine-specific options used  */
352          struct machine *m = emul_add_machine(emul, "default");          struct machine *m = emul_add_machine(emul, "default");
353    
354          while ((ch = getopt(argc, argv, "ABC:c:Dd:E:e:HhI:iJj:KM:m:"          char *opts =
355              "Nn:Oo:p:QqRrSsTtUu:VvW:XxY:y:Z:z:")) != -1) {              "C:c:Dd:E:e:G:HhI:iJj:KM:Nn:Oo:p:QqRrSs:tU"
356    #ifdef UNSTABLE_DEVEL
357                "u:"
358    #endif
359                "VvW:"
360    #ifdef WITH_X11
361                "XxY:"
362    #endif
363                "Z:z:";
364    
365            while ((ch = getopt(argc, argv, opts)) != -1) {
366                  switch (ch) {                  switch (ch) {
                 case 'A':  
                         m->dyntrans_alignment_check = 0;  
                         msopts = 1;  
                         break;  
                 case 'B':  
                         /*  Turns off both bintrans and dyntrans.  */  
                         m->bintrans_enable = 0;  
                         dyntrans_backend_enable = 0;  
                         msopts = 1;  
                         break;  
367                  case 'C':                  case 'C':
368                          m->cpu_name = strdup(optarg);                          m->cpu_name = strdup(optarg);
369                          msopts = 1;                          msopts = 1;
# Line 372  int get_cmd_args(int argc, char *argv[], Line 380  int get_cmd_args(int argc, char *argv[],
380                              strdup(optarg);                              strdup(optarg);
381                          break;                          break;
382                  case 'D':                  case 'D':
383                          fully_deterministic = 1;                          skip_srandom_call = 1;
384                          break;                          break;
385                  case 'd':                  case 'd':
386                          /*  diskimage_add() is called further down  */                          /*  diskimage_add() is called further down  */
# Line 388  int get_cmd_args(int argc, char *argv[], Line 396  int get_cmd_args(int argc, char *argv[],
396                          msopts = 1;                          msopts = 1;
397                          break;                          break;
398                  case 'E':                  case 'E':
399                            if (using_switch_E ++ > 0) {
400                                    fprintf(stderr, "-E already used.\n");
401                                    exit(1);
402                            }
403                          type = optarg;                          type = optarg;
404                          msopts = 1;                          msopts = 1;
405                          break;                          break;
406                  case 'e':                  case 'e':
407                            if (using_switch_e ++ > 0) {
408                                    fprintf(stderr, "-e already used.\n");
409                                    exit(1);
410                            }
411                          subtype = optarg;                          subtype = optarg;
412                          msopts = 1;                          msopts = 1;
413                          break;                          break;
414                    case 'G':
415                            m->gdb.port = atoi(optarg);
416                            if (m->gdb.port < 1 || m->gdb.port > 65535) {
417                                    fprintf(stderr, "Invalid debugger port %i.\n",
418                                        m->gdb.port);
419                                    exit(1);
420                            }
421                            /*  Note: implicit -V  */
422                            single_step = ENTER_SINGLE_STEPPING;
423                            msopts = 1;
424                            break;
425                  case 'H':                  case 'H':
426                          machine_list_available_types_and_cpus();                          machine_list_available_types_and_cpus();
427                          exit(1);                          exit(1);
# Line 403  int get_cmd_args(int argc, char *argv[], Line 430  int get_cmd_args(int argc, char *argv[],
430                          exit(1);                          exit(1);
431                  case 'I':                  case 'I':
432                          m->emulated_hz = atoi(optarg);                          m->emulated_hz = atoi(optarg);
                         m->automatic_clock_adjustment = 0;  
433                          msopts = 1;                          msopts = 1;
434                          break;                          break;
435                  case 'i':                  case 'i':
# Line 411  int get_cmd_args(int argc, char *argv[], Line 437  int get_cmd_args(int argc, char *argv[],
437                          msopts = 1;                          msopts = 1;
438                          break;                          break;
439                  case 'J':                  case 'J':
440                          m->speed_tricks = 0;                          m->allow_instruction_combinations = 0;
441                          msopts = 1;                          msopts = 1;
442                          break;                          break;
443                  case 'j':                  case 'j':
# Line 429  int get_cmd_args(int argc, char *argv[], Line 455  int get_cmd_args(int argc, char *argv[],
455                          m->physical_ram_in_mb = atoi(optarg);                          m->physical_ram_in_mb = atoi(optarg);
456                          msopts = 1;                          msopts = 1;
457                          break;                          break;
                 case 'm':  
                         m->max_instructions = atoi(optarg);  
                         msopts = 1;  
                         break;  
458                  case 'N':                  case 'N':
459                          m->show_nr_of_instructions = 1;                          m->show_nr_of_instructions = 1;
460                          msopts = 1;                          msopts = 1;
# Line 488  int get_cmd_args(int argc, char *argv[], Line 510  int get_cmd_args(int argc, char *argv[],
510                          msopts = 1;                          msopts = 1;
511                          break;                          break;
512                  case 's':                  case 's':
513                          show_opcode_statistics = 1;                          machine_statistics_init(m, optarg);
                         break;  
                 case 'T':  
                         m->single_step_on_bad_addr = 1;  
514                          msopts = 1;                          msopts = 1;
515                          break;                          break;
516                  case 't':                  case 't':
# Line 512  int get_cmd_args(int argc, char *argv[], Line 531  int get_cmd_args(int argc, char *argv[],
531                          msopts = 1;                          msopts = 1;
532                          break;                          break;
533                  case 'V':                  case 'V':
534                          single_step = 1;                          single_step = ENTER_SINGLE_STEPPING;
535                          break;                          break;
536                  case 'v':                  case 'v':
537                          verbose ++;                          verbose ++;
# Line 539  int get_cmd_args(int argc, char *argv[], Line 558  int get_cmd_args(int argc, char *argv[],
558                          }                          }
559                          msopts = 1;                          msopts = 1;
560                          break;                          break;
                 case 'y':  
                         m->max_random_cycles_per_chunk = atoi(optarg);  
                         msopts = 1;  
                         break;  
561                  case 'Z':                  case 'Z':
562                          m->n_gfx_cards = atoi(optarg);                          m->n_gfx_cards = atoi(optarg);
563                          using_switch_Z = 1;                          using_switch_Z = 1;
# Line 614  int get_cmd_args(int argc, char *argv[], Line 629  int get_cmd_args(int argc, char *argv[],
629                  quiet_mode = 0;                  quiet_mode = 0;
630          }          }
631    
         if ((m->instruction_trace || m->register_dump || m->show_trace_tree)  
             && m->bintrans_enable) {  
                 if (m->arch == ARCH_MIPS)  
                         fprintf(stderr, "Implicitly turning off bintrans.\n");  
                 m->bintrans_enable = 0;  
         }  
   
632    
633          /*          /*
634           *  Usually, an executable filename must be supplied.           *  Usually, an executable filename must be supplied.
# Line 667  int get_cmd_args(int argc, char *argv[], Line 675  int get_cmd_args(int argc, char *argv[],
675                  exit(1);                  exit(1);
676          }          }
677    
 #ifndef EXPERIMENTAL_NEWMIPS  
         if (m->bintrans_enable && m->arch == ARCH_MIPS) {  
                 m->speed_tricks = 0;  
                 /*  TODO: Print a warning about this?  */  
         }  
 #endif  
   
         if (m->n_breakpoints > 0 &&  
             m->bintrans_enable && m->arch == ARCH_MIPS) {  
                 fprintf(stderr, "Breakpoints and MIPS binary translation "  
                     "don't work too well together right now.\n");  
                 exit(1);  
         }  
   
 #ifndef BINTRANS  
         if (m->bintrans_enable) {  
                 fprintf(stderr, "WARNING: %s was compiled without "  
                     "bintrans support. Ignoring -b.\n", progname);  
                 m->bintrans_enable = 0;  
         }  
 #endif  
   
 #ifndef WITH_X11  
         if (m->use_x11) {  
                 fprintf(stderr, "WARNING: %s was compiled without "  
                     "X11 support. Ignoring -X.\n", progname);  
                 m->use_x11 = 0;  
         }  
 #endif  
   
678          if (!using_switch_Z && !m->use_x11)          if (!using_switch_Z && !m->use_x11)
679                  m->n_gfx_cards = 0;                  m->n_gfx_cards = 0;
680    
         m->bintrans_enabled_from_start = m->bintrans_enable;  
   
681          return 0;          return 0;
682  }  }
683    
# Line 718  int get_cmd_args(int argc, char *argv[], Line 694  int get_cmd_args(int argc, char *argv[],
694   */   */
695  int main(int argc, char *argv[])  int main(int argc, char *argv[])
696  {  {
697            /*  Setting constants:  */
698            const int constant_yes = 1;
699            const int constant_true = 1;
700            const int constant_no = 0;
701            const int constant_false = 0;
702    
703          struct emul **emuls;          struct emul **emuls;
704          char **diskimages = NULL;          char **diskimages = NULL;
705          int n_diskimages = 0;          int n_diskimages = 0;
706          int n_emuls;          int n_emuls;
707          int i;          int i;
708    
709    
710          progname = argv[0];          progname = argv[0];
711    
712    
713            /*
714             *  Create the settings object, and add global settings to it:
715             *
716             *  Read-only "constants":     yes, no, true, false.
717             *  Global emulator settings:  verbose, single_step, ...
718             */
719            global_settings = settings_new();
720    
721            settings_add(global_settings, "yes", 0, SETTINGS_TYPE_INT,
722                SETTINGS_FORMAT_YESNO, (void *)&constant_yes);
723            settings_add(global_settings, "no", 0, SETTINGS_TYPE_INT,
724                SETTINGS_FORMAT_YESNO, (void *)&constant_no);
725            settings_add(global_settings, "true", 0, SETTINGS_TYPE_INT,
726                SETTINGS_FORMAT_BOOL, (void *)&constant_true);
727            settings_add(global_settings, "false", 0, SETTINGS_TYPE_INT,
728                SETTINGS_FORMAT_BOOL, (void *)&constant_false);
729    
730            settings_add(global_settings, "single_step", 0,
731                SETTINGS_TYPE_INT, SETTINGS_FORMAT_YESNO, (void *)&single_step);
732            settings_add(global_settings, "force_debugger_at_exit", 1,
733                SETTINGS_TYPE_INT, SETTINGS_FORMAT_YESNO,
734                (void *)&force_debugger_at_exit);
735            settings_add(global_settings, "verbose", 1,
736                SETTINGS_TYPE_INT, SETTINGS_FORMAT_YESNO, (void *)&verbose);
737            settings_add(global_settings, "quiet_mode", 1,
738                SETTINGS_TYPE_INT, SETTINGS_FORMAT_YESNO, (void *)&quiet_mode);
739    
740            /*  Initialize all emulator subsystems:  */
741          console_init();          console_init();
742          cpu_init();          cpu_init();
743          device_init();          device_init();
744          machine_init();          machine_init();
745            timer_init();
746          useremul_init();          useremul_init();
747    
748          emuls = malloc(sizeof(struct emul *));          emuls = malloc(sizeof(struct emul *));
# Line 745  int main(int argc, char *argv[]) Line 758  int main(int argc, char *argv[])
758                  fprintf(stderr, "out of memory\n");                  fprintf(stderr, "out of memory\n");
759                  exit(1);                  exit(1);
760          }          }
761            settings_add(global_settings, "emul[0]", 1,
762                SETTINGS_TYPE_SUBSETTINGS, 0, emuls[0]->settings);
763    
764          get_cmd_args(argc, argv, emuls[0], &diskimages, &n_diskimages);          get_cmd_args(argc, argv, emuls[0], &diskimages, &n_diskimages);
765    
766          if (!fully_deterministic) {          if (!skip_srandom_call) {
767                  /*  TODO: More than just time(). Use gettimeofday().  */                  struct timeval tv;
768                  srandom(time(NULL) ^ (getpid() << 12));                  gettimeofday(&tv, NULL);
769          } else {                  srandom(tv.tv_sec ^ getpid() ^ tv.tv_usec);
                 /*  Fully deterministic. -I must have been supplied.  */  
                 if (emuls[0]->machines[0]->automatic_clock_adjustment) {  
                         fatal("Cannot have -D without -I.\n");  
                         exit(1);  
                 }  
770          }          }
771    
772          /*  Print startup message:  */          /*  Print startup message:  */
773          debug("GXemul");          debug("GXemul");
774  #ifdef VERSION  #ifdef VERSION
775          debug("-" VERSION);          debug(" " VERSION);
776  #endif  #endif
777          debug("   Copyright (C) 2003-2006  Anders Gavare\n");          debug("    Copyright (C) 2003-2006  Anders Gavare\n");
778          debug("Read the source code and/or documentation for "          debug("Read the source code and/or documentation for "
779              "other Copyright messages.\n\n");              "other Copyright messages.\n\n");
780    
781          if (emuls[0]->machines[0]->machine_type == MACHINE_NONE)          if (emuls[0]->machines[0]->machine_type == MACHINE_NONE) {
782                  n_emuls --;                  n_emuls --;
783          else {          } else {
784                  for (i=0; i<n_diskimages; i++)                  for (i=0; i<n_diskimages; i++)
785                          diskimage_add(emuls[0]->machines[0], diskimages[i]);                          diskimage_add(emuls[0]->machines[0], diskimages[i]);
786          }          }
# Line 795  int main(int argc, char *argv[]) Line 805  int main(int argc, char *argv[])
805          /*  Initialize emulations from config files:  */          /*  Initialize emulations from config files:  */
806          for (i=1; i<argc; i++) {          for (i=1; i<argc; i++) {
807                  if (argv[i][0] == '@') {                  if (argv[i][0] == '@') {
808                            char tmpstr[50];
809                          char *s = argv[i] + 1;                          char *s = argv[i] + 1;
810                          if (strlen(s) == 0 && i+1 < argc &&                          if (strlen(s) == 0 && i+1 < argc &&
811                              argv[i+1][0] != '@') {                              argv[i+1][0] != '@') {
# Line 812  int main(int argc, char *argv[]) Line 823  int main(int argc, char *argv[])
823                              emulations:  */                              emulations:  */
824                          console_allow_slaves(1);                          console_allow_slaves(1);
825    
826                            /*  Destroy the temporary emuls[0], since it will
827                                be overwritten:  */
828                            if (n_emuls == 1) {
829                                    emul_destroy(emuls[0]);
830                                    settings_remove(global_settings, "emul[0]");
831                            }
832    
833                          emuls[n_emuls - 1] =                          emuls[n_emuls - 1] =
834                              emul_create_from_configfile(s);                              emul_create_from_configfile(s);
835    
836                            snprintf(tmpstr, sizeof(tmpstr), "emul[%i]", n_emuls-1);
837                            settings_add(global_settings, tmpstr, 1,
838                                SETTINGS_TYPE_SUBSETTINGS, 0,
839                                emuls[n_emuls-1]->settings);
840                  }                  }
841          }          }
842    
# Line 829  int main(int argc, char *argv[]) Line 852  int main(int argc, char *argv[])
852          device_set_exit_on_error(0);          device_set_exit_on_error(0);
853          console_warn_if_slaves_are_needed(1);          console_warn_if_slaves_are_needed(1);
854    
855    
856          /*  Run all emulations:  */          /*  Run all emulations:  */
857          emul_run(emuls, n_emuls);          emul_run(emuls, n_emuls);
858    
859    
860            /*
861             *  Deinitialize everything:
862             */
863    
864            console_deinit();
865    
866            for (i=0; i<n_emuls; i++)
867                    emul_destroy(emuls[i]);
868    
869            settings_remove_all(global_settings);
870            settings_destroy(global_settings);
871    
872          return 0;          return 0;
873  }  }
874    

Legend:
Removed from v.22  
changed lines
  Added in v.32

  ViewVC Help
Powered by ViewVC 1.1.26