SCP: stop_cpu and sim_is_running variables t_bool

This commit is contained in:
Mark Pizzolato 2018-02-02 05:02:27 -08:00
parent 797feeaff3
commit 760e7f2810
6 changed files with 22 additions and 33 deletions

View file

@ -170,7 +170,6 @@ extern void setClockFrequency(const uint32 Value);
extern uint32 PCX;
extern int32 SR;
extern UNIT cpu_unit;
extern volatile int32 stop_cpu;
/* Debug Flags */
static DEBTAB generic_dt[] = {

View file

@ -257,8 +257,7 @@ t_stat vt_clk (UNIT * this)
static int divider;
if (++divider == CLK_TPS/10) {
divider = 0;
if (SCPE_STOP == sim_poll_kbd())
stop_cpu = 1;
sim_poll_kbd();
}
}
@ -1093,9 +1092,6 @@ int vt_getc (int num)
} else {
/* Console (keyboard) input. */
c = sim_poll_kbd();
if (c == SCPE_STOP) {
stop_cpu = 1; /* just in case */
}
if (! (c & SCPE_KFLAG))
return -1;
}

View file

@ -38,7 +38,6 @@
#define UNIT_V_PCH (UNIT_V_UF + 0) /* output conv */
#define UNIT_PCH (1 << UNIT_V_PCH)
extern volatile int32 stop_cpu;
extern uint8 M[];
extern int32 BS, iochk, ind[64];
extern UNIT cpu_unit;

24
scp.c
View file

@ -541,7 +541,7 @@ UNIT *sim_dfunit = NULL;
DEVICE **sim_internal_devices = NULL;
uint32 sim_internal_device_count = 0;
int32 sim_opt_out = 0;
int32 sim_is_running = 0;
volatile t_bool sim_is_running = FALSE;
t_bool sim_processing_event = FALSE;
uint32 sim_brk_summ = 0;
uint32 sim_brk_types = 0;
@ -564,7 +564,7 @@ size_t *sim_sub_instr_off = NULL;
static double sim_time;
static uint32 sim_rtime;
static int32 noqueue_time;
volatile int32 stop_cpu = 0;
volatile t_bool stop_cpu = FALSE;
static unsigned int sim_stop_sleep_ms = 250;
static char **sim_argv;
t_value *sim_eval = NULL;
@ -2264,12 +2264,12 @@ if (sim_vm_init != NULL) /* call once only */
(*sim_vm_init)();
sim_finit (); /* init fio package */
setenv ("SIM_NAME", sim_name, 1); /* Publish simulator name */
stop_cpu = 0;
stop_cpu = FALSE;
sim_interval = 0;
sim_time = sim_rtime = 0;
noqueue_time = 0;
sim_clock_queue = QUEUE_LIST_END;
sim_is_running = 0;
sim_is_running = FALSE;
sim_log = NULL;
if (sim_emax <= 0)
sim_emax = 1;
@ -4189,7 +4189,7 @@ while (*cptr) {
if ((wait > 0.0) && (!stop_cpu))
sim_os_ms_sleep ((unsigned)wait);
}
stop_cpu = 0; /* Clear in case sleep was interrupted */
stop_cpu = FALSE; /* Clear in case sleep was interrupted */
return SCPE_OK;
}
@ -7206,30 +7206,26 @@ for (i = 1; (dptr = sim_devices[i]) != NULL; i++) { /* reposition all */
return sim_messagef (SCPE_IERR, "Can't seek to %u in %s for %s\n", (unsigned)uptr->pos, uptr->filename, sim_uname (uptr));
}
}
stop_cpu = 0;
sim_is_running = 1; /* flag running */
if ((r = sim_ttrun ()) != SCPE_OK) { /* set console mode */
sim_is_running = 0; /* flag idle */
sim_ttcmd ();
return sim_messagef (SCPE_TTYERR, "sim_ttrun() returned: %s\n", sim_error_text (r));
}
if ((r = sim_check_console (30)) != SCPE_OK) { /* check console, error? */
sim_is_running = 0; /* flag idle */
sim_ttcmd ();
sim_messagef (r, "sim_check_console () returned: %s\n", sim_error_text (r));
}
#ifdef SIGHUP
if (signal (SIGHUP, int_handler) == SIG_ERR) { /* set WRU */
sim_is_running = 0; /* flag idle */
sim_ttcmd ();
return sim_messagef (SCPE_SIGERR, "Can't establish SIGHUP");
}
#endif
if (signal (SIGTERM, int_handler) == SIG_ERR) { /* set WRU */
sim_is_running = 0; /* flag idle */
sim_ttcmd ();
return sim_messagef (SCPE_SIGERR, "Can't establish SIGTERM");
}
stop_cpu = FALSE;
sim_is_running = TRUE; /* flag running */
if (sim_step) /* set step timer */
sim_activate (&sim_step_unit, sim_step);
fflush(stdout); /* flush stdout */
@ -7286,7 +7282,7 @@ if ((SCPE_BARE_STATUS(r) == SCPE_STOP) && /* WRU exit from sim
(sim_on_actions[sim_do_depth][SCPE_STOP] == NULL) &&/* without a handler for a STOP condition */
(sim_on_actions[sim_do_depth][0] == NULL))
sim_os_ms_sleep (sim_stop_sleep_ms); /* wait a bit for SIGINT */
sim_is_running = 0; /* flag idle */
sim_is_running = FALSE; /* flag idle */
sim_stop_timer_services (); /* disable wall clock timing */
sim_ttcmd (); /* restore console */
sim_brk_clrall (BRK_TYP_DYN_STEPOVER); /* cancel any step/over subroutine breakpoints */
@ -7451,7 +7447,7 @@ return sim_cancel (&sim_step_unit);
void int_handler (int sig)
{
stop_cpu = 1;
stop_cpu = TRUE;
return;
}
@ -9895,7 +9891,7 @@ else
sim_debug (SIM_DBG_EVENT, sim_dflt_dev, "Processing Queue Complete New Interval = %d(%s)\n", sim_interval, sim_uname(sim_clock_queue));
if ((reason == SCPE_OK) && stop_cpu) {
stop_cpu = 0;
stop_cpu = FALSE;
reason = SCPE_STOP;
}
sim_processing_event = FALSE;

4
scp.h
View file

@ -347,12 +347,12 @@ extern struct timespec sim_deb_basetime; /* debug base time for r
extern DEVICE **sim_internal_devices;
extern uint32 sim_internal_device_count;
extern UNIT *sim_clock_queue;
extern int32 sim_is_running;
extern volatile t_bool sim_is_running;
extern t_bool sim_processing_event; /* Called from sim_process_event */
extern char *sim_prompt; /* prompt string */
extern const char *sim_savename; /* Simulator Name used in Save/Restore files */
extern t_value *sim_eval;
extern volatile int32 stop_cpu;
extern volatile t_bool stop_cpu;
extern uint32 sim_brk_types; /* breakpoint info */
extern uint32 sim_brk_dflt;
extern uint32 sim_brk_summ;

View file

@ -1397,7 +1397,7 @@ for (i=(was_active_command ? sim_rem_cmd_active_line : 0);
continue;
}
else {
sim_is_running = 0;
sim_is_running = FALSE;
sim_rem_collect_all_registers ();
sim_stop_timer_services ();
if (rem->act == NULL) {
@ -1422,7 +1422,7 @@ for (i=(was_active_command ? sim_rem_cmd_active_line : 0);
if (rem->single_mode) {
if (c == sim_int_char) { /* ^E (the interrupt character) must start continue mode console interaction */
rem->single_mode = FALSE; /* enter multi command mode */
sim_is_running = 0;
sim_is_running = FALSE;
sim_rem_collect_all_registers ();
sim_stop_timer_services ();
stat = SCPE_STOP;
@ -1787,7 +1787,7 @@ for (i=(was_active_command ? sim_rem_cmd_active_line : 0);
tmxr_linemsg (lpj, "Simulator Running...");
tmxr_send_buffered_data (lpj);
}
sim_is_running = 1;
sim_is_running = TRUE;
sim_start_timer_services ();
}
if (cmdp && (cmdp->action == &x_continue_cmd))
@ -2768,7 +2768,7 @@ if (!sim_rem_master_mode) {
else
c = SCPE_OK;
if (c == SCPE_STOP) { /* ^E */
stop_cpu = 1; /* Force a stop (which is picked up by sim_process_event */
stop_cpu = TRUE; /* Force a stop (which is picked up by sim_process_event */
return SCPE_OK;
}
if ((sim_con_tmxr.master == 0) && /* not Telnet? */
@ -2958,7 +2958,6 @@ extern pthread_mutex_t sim_tmxr_poll_lock;
extern pthread_cond_t sim_tmxr_poll_cond;
extern int32 sim_tmxr_poll_count;
extern t_bool sim_tmxr_poll_running;
extern int32 sim_is_running;
pthread_t sim_console_poll_thread; /* Keyboard Polling Thread Id */
t_bool sim_console_poll_running = FALSE;