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.255 2006/06/24 19:52:27 debug Exp $ |
29 |
* |
* |
30 |
* Emulation startup and misc. routines. |
* Emulation startup and misc. routines. |
31 |
*/ |
*/ |
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[]; |
1581 |
while (go) { |
while (go) { |
1582 |
go = 0; |
go = 0; |
1583 |
|
|
1584 |
x11_check_event(emuls, n_emuls); |
/* Flush X11 and serial console output every now and then: */ |
1585 |
|
if (emuls[0]->machines[0]->ncycles > |
1586 |
for (i=0; i<n_emuls; i++) { |
emuls[0]->machines[0]->ncycles_flush + (1<<18)) { |
1587 |
e = emuls[i]; |
x11_check_event(emuls, n_emuls); |
1588 |
if (e == NULL) |
console_flush(); |
1589 |
continue; |
emuls[0]->machines[0]->ncycles_flush = |
1590 |
|
emuls[0]->machines[0]->ncycles; |
1591 |
for (j=0; j<e->n_machines; j++) { |
} |
1592 |
if (e->machines[j]->gdb.port > 0) |
|
1593 |
debugger_gdb_check_incoming( |
if (emuls[0]->machines[0]->ncycles > |
1594 |
e->machines[j]); |
emuls[0]->machines[0]->ncycles_show + (1<<25)) { |
1595 |
|
emuls[0]->machines[0]->ncycles_since_gettimeofday += |
1596 |
/* TODO: cpu_run() is a strange name, since |
(emuls[0]->machines[0]->ncycles - |
1597 |
there can be multiple cpus in a machine */ |
emuls[0]->machines[0]->ncycles_show); |
1598 |
anything = cpu_run(e, e->machines[j]); |
cpu_show_cycles(emuls[0]->machines[0], 0); |
1599 |
if (anything) |
emuls[0]->machines[0]->ncycles_show = |
1600 |
go = 1; |
emuls[0]->machines[0]->ncycles; |
1601 |
} |
} |
1602 |
|
|
1603 |
|
if (single_step == ENTER_SINGLE_STEPPING) { |
1604 |
|
/* TODO: Cleanup! */ |
1605 |
|
old_instruction_trace = |
1606 |
|
emuls[0]->machines[0]->instruction_trace; |
1607 |
|
old_quiet_mode = quiet_mode; |
1608 |
|
old_show_trace_tree = |
1609 |
|
emuls[0]->machines[0]->show_trace_tree; |
1610 |
|
emuls[0]->machines[0]->instruction_trace = 1; |
1611 |
|
emuls[0]->machines[0]->show_trace_tree = 1; |
1612 |
|
quiet_mode = 0; |
1613 |
|
single_step = SINGLE_STEPPING; |
1614 |
|
} |
1615 |
|
|
1616 |
|
if (single_step == SINGLE_STEPPING) |
1617 |
|
debugger(); |
1618 |
|
|
1619 |
|
e = emuls[0]; /* Note: Only 1 emul supported now. */ |
1620 |
|
|
1621 |
|
for (j=0; j<e->n_machines; j++) { |
1622 |
|
if (e->machines[j]->gdb.port > 0) |
1623 |
|
debugger_gdb_check_incoming(e->machines[j]); |
1624 |
|
|
1625 |
|
anything = machine_run(e->machines[j]); |
1626 |
|
if (anything) |
1627 |
|
go = 1; |
1628 |
} |
} |
1629 |
} |
} |
1630 |
|
|