/[gxemul]/trunk/src/emul.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/emul.c

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

revision 24 by dpavlin, Mon Oct 8 16:19:56 2007 UTC revision 28 by dpavlin, Mon Oct 8 16:20:26 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: emul.c,v 1.254 2006/06/22 13:22:40 debug Exp $   *  $Id: emul.c,v 1.258 2006/07/20 21:52:59 debug Exp $
29   *   *
30   *  Emulation startup and misc. routines.   *  Emulation startup and misc. routines.
31   */   */
# Line 55  Line 55 
55  #include "x11.h"  #include "x11.h"
56    
57    
 extern int force_debugger_at_exit;  
   
58  extern int extra_argc;  extern int extra_argc;
59  extern char **extra_argv;  extern char **extra_argv;
60    
61  extern int verbose;  extern int verbose;
62  extern int quiet_mode;  extern int quiet_mode;
63    extern int force_debugger_at_exit;
64    extern int single_step;
65    extern int old_show_trace_tree;
66    extern int old_instruction_trace;
67    extern int old_quiet_mode;
68    extern int quiet_mode;
69    
70  extern struct emul *debugger_emul;  extern struct emul *debugger_emul;
71  extern struct diskimage *diskimages[];  extern struct diskimage *diskimages[];
# Line 1275  void emul_machine_setup(struct machine * Line 1279  void emul_machine_setup(struct machine *
1279                  case ARCH_SPARC:                  case ARCH_SPARC:
1280                          break;                          break;
1281    
1282                    case ARCH_TRANSPUTER:
1283                            cpu->pc &= 0xffffffffULL;
1284                            break;
1285    
1286                  case ARCH_X86:                  case ARCH_X86:
1287                          /*                          /*
1288                           *  NOTE: The toc field is used to indicate an ELF32                           *  NOTE: The toc field is used to indicate an ELF32
# Line 1577  void emul_run(struct emul **emuls, int n Line 1585  void emul_run(struct emul **emuls, int n
1585          while (go) {          while (go) {
1586                  go = 0;                  go = 0;
1587    
1588                  x11_check_event(emuls, n_emuls);                  /*  Flush X11 and serial console output every now and then:  */
1589                    if (emuls[0]->machines[0]->ninstrs >
1590                  for (i=0; i<n_emuls; i++) {                      emuls[0]->machines[0]->ninstrs_flush + (1<<19)) {
1591                          e = emuls[i];                          x11_check_event(emuls, n_emuls);
1592                          if (e == NULL)                          console_flush();
1593                                  continue;                          emuls[0]->machines[0]->ninstrs_flush =
1594                                emuls[0]->machines[0]->ninstrs;
1595                          for (j=0; j<e->n_machines; j++) {                  }
1596                                  if (e->machines[j]->gdb.port > 0)  
1597                                          debugger_gdb_check_incoming(                  if (emuls[0]->machines[0]->ninstrs >
1598                                              e->machines[j]);                      emuls[0]->machines[0]->ninstrs_show + (1<<25)) {
1599                            emuls[0]->machines[0]->ninstrs_since_gettimeofday +=
1600                                  /*  TODO: cpu_run() is a strange name, since                              (emuls[0]->machines[0]->ninstrs -
1601                                      there can be multiple cpus in a machine  */                               emuls[0]->machines[0]->ninstrs_show);
1602                                  anything = cpu_run(e, e->machines[j]);                          cpu_show_cycles(emuls[0]->machines[0], 0);
1603                                  if (anything)                          emuls[0]->machines[0]->ninstrs_show =
1604                                          go = 1;                              emuls[0]->machines[0]->ninstrs;
1605                          }                  }
1606    
1607                    if (single_step == ENTER_SINGLE_STEPPING) {
1608                            /*  TODO: Cleanup!  */
1609                            old_instruction_trace =
1610                                emuls[0]->machines[0]->instruction_trace;
1611                            old_quiet_mode = quiet_mode;
1612                            old_show_trace_tree =
1613                                emuls[0]->machines[0]->show_trace_tree;
1614                            emuls[0]->machines[0]->instruction_trace = 1;
1615                            emuls[0]->machines[0]->show_trace_tree = 1;
1616                            quiet_mode = 0;
1617                            single_step = SINGLE_STEPPING;
1618                    }
1619    
1620                    if (single_step == SINGLE_STEPPING)
1621                            debugger();
1622    
1623                    e = emuls[0];   /*  Note: Only 1 emul supported now.  */
1624    
1625                    for (j=0; j<e->n_machines; j++) {
1626                            if (e->machines[j]->gdb.port > 0)
1627                                    debugger_gdb_check_incoming(e->machines[j]);
1628    
1629                            anything = machine_run(e->machines[j]);
1630                            if (anything)
1631                                    go = 1;
1632                  }                  }
1633          }          }
1634    

Legend:
Removed from v.24  
changed lines
  Added in v.28

  ViewVC Help
Powered by ViewVC 1.1.26