VAX: Simplified idle detection which allows more operating systems to properly detect when they are idling.
Removed the recently added SET CPU IDLE=SYSV since any SET CPU IDLE command will work for SysV. Existing configurations probably did a SET CPU IDLE=32V which works fine now. Changed things based on the realization that ANY branch instruction which tests memory and then branches to itself is an idle loop if the branch is taken. This is without regard to address space, access mode, If interrupts are disabled, then it is a hung system and the simulation should halt.
This commit is contained in:
parent
7c9e33663c
commit
d6456e506d
1 changed files with 16 additions and 23 deletions
|
@ -227,6 +227,12 @@
|
||||||
R[rn] = rl; \
|
R[rn] = rl; \
|
||||||
R[rn + 1] = rh; \
|
R[rn + 1] = rh; \
|
||||||
}
|
}
|
||||||
|
#define CHECK_FOR_IDLE_LOOP if (PC == fault_PC) { /* to self? */ \
|
||||||
|
if (PSL_GETIPL (PSL) == 0x1F) /* int locked out? */ \
|
||||||
|
ABORT (STOP_LOOP); /* infinite loop */ \
|
||||||
|
cpu_idle (); /* idle loop */ \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#define HIST_MIN 64
|
#define HIST_MIN 64
|
||||||
#define HIST_MAX 65536
|
#define HIST_MAX 65536
|
||||||
|
@ -491,7 +497,7 @@ REG cpu_reg[] = {
|
||||||
MTAB cpu_mod[] = {
|
MTAB cpu_mod[] = {
|
||||||
{ UNIT_CONH, 0, "HALT to SIMH", "SIMHALT", NULL, NULL, NULL, "Set HALT to trap to simulator" },
|
{ UNIT_CONH, 0, "HALT to SIMH", "SIMHALT", NULL, NULL, NULL, "Set HALT to trap to simulator" },
|
||||||
{ UNIT_CONH, UNIT_CONH, "HALT to console", "CONHALT", NULL, NULL, NULL, "Set HALT to trap to console ROM" },
|
{ UNIT_CONH, UNIT_CONH, "HALT to console", "CONHALT", NULL, NULL, NULL, "Set HALT to trap to console ROM" },
|
||||||
{ MTAB_XTD|MTAB_VDV, 0, "IDLE", "IDLE={VMS|ULTRIX|NETBSD|OPENBSD|ULTRIXOLD|OPENBSDOLD|QUASIJARUS|32V|SYSV|ALL}", &cpu_set_idle, &cpu_show_idle, NULL, "Display idle detection mode" },
|
{ MTAB_XTD|MTAB_VDV, 0, "IDLE", "IDLE={VMS|ULTRIX|NETBSD|OPENBSD|ULTRIXOLD|OPENBSDOLD|QUASIJARUS|32V|ALL}", &cpu_set_idle, &cpu_show_idle, NULL, "Display idle detection mode" },
|
||||||
{ MTAB_XTD|MTAB_VDV, 0, NULL, "NOIDLE", &sim_clr_idle, NULL, NULL, "Disables idle detection" },
|
{ MTAB_XTD|MTAB_VDV, 0, NULL, "NOIDLE", &sim_clr_idle, NULL, NULL, "Disables idle detection" },
|
||||||
MEM_MODIFIERS, /* Model specific memory modifiers from vaxXXX_defs.h */
|
MEM_MODIFIERS, /* Model specific memory modifiers from vaxXXX_defs.h */
|
||||||
{ MTAB_XTD|MTAB_VDV|MTAB_NMO|MTAB_SHP, 0, "HISTORY", "HISTORY",
|
{ MTAB_XTD|MTAB_VDV|MTAB_NMO|MTAB_SHP, 0, "HISTORY", "HISTORY",
|
||||||
|
@ -2184,20 +2190,12 @@ for ( ;; ) {
|
||||||
|
|
||||||
case BRB:
|
case BRB:
|
||||||
BRANCHB (brdisp); /* branch */
|
BRANCHB (brdisp); /* branch */
|
||||||
if (PC == fault_PC) { /* to self? */
|
CHECK_FOR_IDLE_LOOP;
|
||||||
if (PSL_GETIPL (PSL) == 0x1F) /* int locked out? */
|
|
||||||
ABORT (STOP_LOOP); /* infinite loop */
|
|
||||||
cpu_idle (); /* idle loop */
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BRW:
|
case BRW:
|
||||||
BRANCHW (brdisp); /* branch */
|
BRANCHW (brdisp); /* branch */
|
||||||
if (PC == fault_PC) { /* to self? */
|
CHECK_FOR_IDLE_LOOP;
|
||||||
if (PSL_GETIPL (PSL) == 0x1F) /* int locked out? */
|
|
||||||
ABORT (STOP_LOOP); /* infinite loop */
|
|
||||||
cpu_idle (); /* idle loop */
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BSBB:
|
case BSBB:
|
||||||
|
@ -2470,20 +2468,16 @@ for ( ;; ) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLBS:
|
case BLBS:
|
||||||
if (op0 & 1) /* br if bit set */
|
if (op0 & 1) { /* br if bit set */
|
||||||
BRANCHB (brdisp);
|
BRANCHB (brdisp);
|
||||||
|
CHECK_FOR_IDLE_LOOP;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLBC:
|
case BLBC:
|
||||||
if ((op0 & 1) == 0) /* br if bit clear */
|
if ((op0 & 1) == 0) { /* br if bit clear */
|
||||||
{
|
|
||||||
BRANCHB (brdisp);
|
BRANCHB (brdisp);
|
||||||
if (((cpu_idle_mask & VAX_IDLE_SYSV) != 0) &&/* running System V? */
|
CHECK_FOR_IDLE_LOOP;
|
||||||
(PC == fault_PC) && /* to self? */
|
|
||||||
(fault_PC & 0x80000000) && /* in system space? */
|
|
||||||
(PSL_GETIPL (PSL) == 0x0) && /* at IPL 0? */
|
|
||||||
(PSL_GETCUR(PSL) == KERN)) /* in Kernel Mode? */
|
|
||||||
cpu_idle (); /* idle loop */
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -3546,8 +3540,7 @@ static struct os_idle os_tab[] = {
|
||||||
{ "OPENBSD", VAX_IDLE_BSDNEW },
|
{ "OPENBSD", VAX_IDLE_BSDNEW },
|
||||||
{ "QUASIJARUS", VAX_IDLE_QUAD },
|
{ "QUASIJARUS", VAX_IDLE_QUAD },
|
||||||
{ "32V", VAX_IDLE_QUAD },
|
{ "32V", VAX_IDLE_QUAD },
|
||||||
{ "SYSV", VAX_IDLE_SYSV },
|
{ "ALL", VAX_IDLE_VMS|VAX_IDLE_ULTOLD|VAX_IDLE_ULT|VAX_IDLE_ULT1X|VAX_IDLE_QUAD|VAX_IDLE_BSDNEW },
|
||||||
{ "ALL", VAX_IDLE_VMS|VAX_IDLE_ULTOLD|VAX_IDLE_ULT|VAX_IDLE_ULT1X|VAX_IDLE_QUAD|VAX_IDLE_BSDNEW|VAX_IDLE_SYSV },
|
|
||||||
{ NULL, 0 }
|
{ NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3651,7 +3644,7 @@ fprintf (st, " -u interpret address as virtual, user mode\n\n");
|
||||||
fprintf (st, "The CPU attempts to detect when the simulator is idle. When idle, the\n");
|
fprintf (st, "The CPU attempts to detect when the simulator is idle. When idle, the\n");
|
||||||
fprintf (st, "simulator does not use any resources on the host system. Idle detection is\n");
|
fprintf (st, "simulator does not use any resources on the host system. Idle detection is\n");
|
||||||
fprintf (st, "controlled by the SET IDLE and SET NOIDLE commands:\n\n");
|
fprintf (st, "controlled by the SET IDLE and SET NOIDLE commands:\n\n");
|
||||||
fprintf (st, " sim> SET CPU IDLE{=VMS|ULTRIX|NETBSD|FREEBSD|32V|SYSV|ALL}\n");
|
fprintf (st, " sim> SET CPU IDLE{=VMS|ULTRIX|NETBSD|FREEBSD|32V|ALL}\n");
|
||||||
fprintf (st, " enable idle detection\n");
|
fprintf (st, " enable idle detection\n");
|
||||||
fprintf (st, " sim> SET CPU NOIDLE disable idle detection\n\n");
|
fprintf (st, " sim> SET CPU NOIDLE disable idle detection\n\n");
|
||||||
fprintf (st, "Idle detection is disabled by default. Unless ALL is specified, idle\n");
|
fprintf (st, "Idle detection is disabled by default. Unless ALL is specified, idle\n");
|
||||||
|
|
Loading…
Add table
Reference in a new issue