1
0
mirror of https://github.com/open-simh/simh.git synced 2026-03-22 09:04:33 +00:00

Merge branch 'master' into HP2100Extensions

Conflicts:
	scp.c
This commit is contained in:
Mark Pizzolato
2012-04-11 19:33:11 -07:00
5 changed files with 53 additions and 31 deletions

View File

@@ -188,10 +188,6 @@
#define UNIT_CONH (1u << UNIT_V_CONH)
#define UNIT_MSIZE (1u << UNIT_V_MSIZE)
#define GET_CUR acc = ACC_MASK (PSL_GETCUR (PSL))
#define VAX_IDLE_VMS 0x01
#define VAX_IDLE_ULT 0x02
#define VAX_IDLE_ULTOLD 0x04
#define VAX_IDLE_QUAD 0x08
#define OPND_SIZE 16
#define INST_SIZE 52
@@ -3428,13 +3424,15 @@ struct os_idle {
static struct os_idle os_tab[] = {
{ "VMS", VAX_IDLE_VMS },
{ "NETBSD", VAX_IDLE_ULTOLD },
{ "NETBSDOLD", VAX_IDLE_ULTOLD },
{ "NETBSD", VAX_IDLE_BSDNEW },
{ "ULTRIX", VAX_IDLE_ULT },
{ "ULTRIXOLD", VAX_IDLE_ULTOLD },
{ "OPENBSD", VAX_IDLE_QUAD },
{ "OPENBSDOLD", VAX_IDLE_QUAD },
{ "OPENBSD", VAX_IDLE_BSDNEW },
{ "QUASIJARUS", VAX_IDLE_QUAD },
{ "32V", VAX_IDLE_QUAD },
{ "ALL", VAX_IDLE_VMS|VAX_IDLE_ULTOLD|VAX_IDLE_ULT|VAX_IDLE_QUAD },
{ "ALL", VAX_IDLE_VMS|VAX_IDLE_ULTOLD|VAX_IDLE_ULT|VAX_IDLE_QUAD|VAX_IDLE_BSDNEW },
{ NULL, 0 }
};
@@ -3459,10 +3457,8 @@ return sim_set_idle (uptr, val, cptr, desc);
t_stat cpu_show_idle (FILE *st, UNIT *uptr, int32 val, void *desc)
{
if (sim_idle_enab && (cpu_idle_type != 0)) {
if (sim_idle_enab && (cpu_idle_type != 0))
fprintf (st, "idle=%s, ", os_tab[cpu_idle_type - 1].name);
sim_show_idle (st, uptr, val, desc);
}
else fprintf (st, "idle disabled");
sim_show_idle (st, uptr, val, desc);
return SCPE_OK;
}

View File

@@ -1520,6 +1520,9 @@ switch (prn) { /* case on reg # */
case MT_IPL: /* IPL */
PSL = (PSL & ~PSL_IPL) | ((val & PSL_M_IPL) << PSL_V_IPL);
if ((VAX_IDLE_BSDNEW & cpu_idle_mask) && /* New NetBSD and OpenBSD */
(val == 1)) /* IPL 1 */
cpu_idle(); /* idle loop */
break;
case MT_ASTLVL: /* ASTLVL */

View File

@@ -718,6 +718,14 @@ enum opcodes {
else cc = 0; \
if (((uint32) s1) < ((uint32) s2)) cc = cc | CC_C
#define VAX_IDLE_VMS 0x01
#define VAX_IDLE_ULT 0x02
#define VAX_IDLE_ULTOLD 0x04
#define VAX_IDLE_QUAD 0x08
#define VAX_IDLE_BSDNEW 0x10
extern uint32 cpu_idle_mask; /* idle mask */
void cpu_idle (void);
/* Model dependent definitions */
#if defined (VAX_780)

16
scp.c
View File

@@ -91,7 +91,7 @@
22-Mar-05 JDB Modified DO command to allow ten-level nesting
18-Mar-05 RMS Moved DETACH tests into detach_unit (Dave Bryan)
Revised interface to fprint_sym, fparse_sym
13-Mar-05 JDB [local fix 4] ASSERT now requires a conditional operator
13-Mar-05 JDB ASSERT now requires a conditional operator
25-Feb-05 JDB [local fix 3] Added SCPE_CHALT message string
[local fix 3] Added halt unit support in show_queue
07-Feb-05 RMS Added ASSERT command (Dave Bryan)
@@ -839,6 +839,7 @@ if (!sim_quiet) {
if (sim_dflt_dev == NULL) /* if no default */
sim_dflt_dev = sim_devices[0];
stat = do_cmd (-1, "simh.rc"); /* simh.rc proc cmd file */
sprintf(nbuf, "%s.rc", sim_name);
stat = do_cmd (-1, nbuf); /* {sim_name}.rc proc cmd file */
if (*cbuf) /* cmd file arg? */
@@ -1028,7 +1029,10 @@ t_stat do_cmd_label (int32 flag, char *fcptr, char *label)
char *cptr, cbuf[CBUFSIZE], gbuf[CBUFSIZE], *c, quote, *do_arg[10];
FILE *fpin;
CTAB *cmdp;
int32 echo, saved_sim_do_echo = sim_do_echo, saved_sim_show_message = sim_show_message, nargs, errabort, i;
int32 echo, nargs, errabort, i;
int32 saved_sim_do_echo = sim_do_echo,
saved_sim_show_message = sim_show_message,
saved_sim_on_inherit = sim_on_inherit;
t_bool interactive, isdo, staying;
t_stat stat, stat_nomessage;
char *ocptr;
@@ -1206,8 +1210,10 @@ Cleanup_Return:
fclose (fpin); /* close file */
sim_gotofile = NULL;
sim_do_echo = saved_sim_do_echo; /* restore echo state we entered with */
if (flag >= 0)
if (flag >= 0) {
sim_show_message = saved_sim_show_message; /* restore message display state we entered with */
sim_on_inherit = saved_sim_on_inherit; /* restore ON inheritance state we entered with */
}
for (i=0; i<SCPE_MAX_ERR; i++) { /* release any on commands */
free (sim_on_actions[sim_do_depth][i]);
sim_on_actions[sim_do_depth][i] = NULL;
@@ -1410,9 +1416,7 @@ t_value val;
t_stat r;
cptr = get_sim_opt (CMD_OPT_SW|CMD_OPT_DFT, cptr, &r); /* get sw, default */
/* [JDB local fix 4] begin */
sim_stab.boolop = -1; /* no relational op dflt */
/* [JDB local fix 4] end */
if (*cptr == 0) /* must be more */
return SCPE_2FARG;
cptr = get_glyph (cptr, gbuf, 0); /* get register */
@@ -1439,10 +1443,8 @@ else {
}
if (*cptr != 0) /* must be done */
return SCPE_2MARG;
/* [JDB local fix 4] begin */
if (!get_search (gbuf, rptr->radix, &sim_stab) || /* parse condition */
(sim_stab.boolop == -1)) /* relational op reqd */
/* [JDB local fix 4] end */
return SCPE_MISVAL;
val = get_rval (rptr, idx); /* get register value */
if (test_search (val, &sim_stab)) /* test condition */

View File

@@ -83,6 +83,7 @@ t_bool sim_idle_enab = FALSE; /* global flag */
volatile t_bool sim_idle_wait = FALSE; /* global flag */
static uint32 sim_idle_rate_ms = 0;
static uint32 sim_os_sleep_min_ms = 0;
static uint32 sim_idle_stable = SIM_IDLE_STDFLT;
static uint32 sim_throt_ms_start = 0;
static uint32 sim_throt_ms_stop = 0;
@@ -155,10 +156,11 @@ return;
uint32 sim_os_ms_sleep_init (void)
{
#if defined (__VAX)
return 10; /* VAX/VMS is 10ms */
sim_os_sleep_min_ms = 10; /* VAX/VMS is 10ms */
#else
return 1; /* Alpha/VMS is 1ms */
sim_os_sleep_min_ms = 1; /* Alpha/VMS is 1ms */
#endif
return sim_os_sleep_min_ms;
}
uint32 sim_os_ms_sleep (unsigned int msec)
@@ -224,6 +226,7 @@ TIMECAPS timers;
if (timeGetDevCaps (&timers, sizeof (timers)) != TIMERR_NOERROR)
return 0;
sim_os_sleep_min_ms = timers.wPeriodMin;
if ((timers.wPeriodMin == 0) || (timers.wPeriodMin > SIM_IDLE_MAX))
return 0;
if (timeBeginPeriod (timers.wPeriodMin) != TIMERR_NOERROR)
@@ -234,7 +237,7 @@ Sleep (1);
Sleep (1);
Sleep (1);
Sleep (1);
return timers.wPeriodMin; /* sim_idle_rate_ms */
return sim_os_sleep_min_ms; /* sim_idle_rate_ms */
}
uint32 sim_os_ms_sleep (unsigned int msec)
@@ -280,7 +283,7 @@ return;
uint32 sim_os_ms_sleep_init (void)
{
return FALSE;
return 0;
}
uint32 sim_os_ms_sleep (unsigned int msec)
@@ -322,7 +325,7 @@ return;
uint32 sim_os_ms_sleep_init (void)
{
return 1;
return sim_os_sleep_min_ms = 1;
}
uint32 sim_os_ms_sleep (unsigned int milliseconds)
@@ -392,6 +395,7 @@ for (i = 0, tot = 0; i < sleep1Samples; i++) {
tot += (t2 - t1);
}
tim = (tot + (sleep1Samples - 1)) / sleep1Samples;
sim_os_sleep_min_ms = tim;
if (tim > SIM_IDLE_MAX)
tim = 0;
return tim;
@@ -631,10 +635,18 @@ t_stat sim_set_idle (UNIT *uptr, int32 val, char *cptr, void *desc)
t_stat r;
uint32 v;
if (sim_idle_rate_ms == 0)
if (sim_idle_rate_ms == 0) {
printf ("Idling is not available, Minimum OS sleep time is %dms\n", sim_os_sleep_min_ms);
if (sim_log)
fprintf (sim_log, "Idling is not available, Minimum OS sleep time is %dms\n", sim_os_sleep_min_ms);
return SCPE_NOFNC;
if ((val != 0) && (sim_idle_rate_ms > (uint32) val))
}
if ((val != 0) && (sim_idle_rate_ms > (uint32) val)) {
printf ("Idling is not available, Minimum OS sleep time is %dms, Requied minimum OS sleep is %dms\n", sim_os_sleep_min_ms, val);
if (sim_log)
fprintf (sim_log, "Idling is not available, Minimum OS sleep time is %dms, Requied minimum OS sleep is %dms\n", sim_os_sleep_min_ms, val);
return SCPE_NOFNC;
}
if (cptr) {
v = (uint32) get_uint (cptr, 10, SIM_IDLE_STMAX, &r);
if ((r != SCPE_OK) || (v < SIM_IDLE_STMIN))
@@ -663,12 +675,12 @@ return SCPE_OK;
t_stat sim_show_idle (FILE *st, UNIT *uptr, int32 val, void *desc)
{
if (sim_idle_enab) {
if (sim_idle_enab)
fprintf (st, "idle enabled");
if (sim_switches & SWMASK ('D'))
fprintf (st, ", stability wait = %ds, minimum sleep resolution = %dms", sim_idle_stable, sim_idle_rate_ms);
}
else fputs ("idle disabled", st);
else
fprintf (st, "idle disabled");
if (sim_switches & SWMASK ('D'))
fprintf (st, ", stability wait = %ds, minimum sleep resolution = %dms", sim_idle_stable, sim_os_sleep_min_ms);
return SCPE_OK;
}
@@ -755,11 +767,12 @@ else {
}
if (sim_switches & SWMASK ('D')) {
fprintf (st, "minimum sleep resolution = %d ms\n", sim_idle_rate_ms);
if (sim_throt_type != 0)
fprintf (st, "Throttle interval = %d cycles\n", sim_throt_wait);
}
}
if (sim_switches & SWMASK ('D'))
fprintf (st, "minimum sleep resolution = %d ms\n", sim_os_sleep_min_ms);
return SCPE_OK;
}