diff --git a/VAX/vax_cpu.c b/VAX/vax_cpu.c index e6ace209..b4a69ee4 100644 --- a/VAX/vax_cpu.c +++ b/VAX/vax_cpu.c @@ -227,6 +227,12 @@ R[rn] = rl; \ 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_MAX 65536 @@ -491,7 +497,7 @@ REG cpu_reg[] = { MTAB cpu_mod[] = { { 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" }, - { 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" }, MEM_MODIFIERS, /* Model specific memory modifiers from vaxXXX_defs.h */ { MTAB_XTD|MTAB_VDV|MTAB_NMO|MTAB_SHP, 0, "HISTORY", "HISTORY", @@ -2184,20 +2190,12 @@ for ( ;; ) { case BRB: BRANCHB (brdisp); /* branch */ - if (PC == fault_PC) { /* to self? */ - if (PSL_GETIPL (PSL) == 0x1F) /* int locked out? */ - ABORT (STOP_LOOP); /* infinite loop */ - cpu_idle (); /* idle loop */ - } + CHECK_FOR_IDLE_LOOP; break; case BRW: BRANCHW (brdisp); /* branch */ - if (PC == fault_PC) { /* to self? */ - if (PSL_GETIPL (PSL) == 0x1F) /* int locked out? */ - ABORT (STOP_LOOP); /* infinite loop */ - cpu_idle (); /* idle loop */ - } + CHECK_FOR_IDLE_LOOP; break; case BSBB: @@ -2470,20 +2468,16 @@ for ( ;; ) { break; case BLBS: - if (op0 & 1) /* br if bit set */ + if (op0 & 1) { /* br if bit set */ BRANCHB (brdisp); + CHECK_FOR_IDLE_LOOP; + } break; case BLBC: - if ((op0 & 1) == 0) /* br if bit clear */ - { + if ((op0 & 1) == 0) { /* br if bit clear */ BRANCHB (brdisp); - if (((cpu_idle_mask & VAX_IDLE_SYSV) != 0) &&/* running System V? */ - (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 */ + CHECK_FOR_IDLE_LOOP; } break; @@ -3546,8 +3540,7 @@ static struct os_idle os_tab[] = { { "OPENBSD", VAX_IDLE_BSDNEW }, { "QUASIJARUS", 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|VAX_IDLE_SYSV }, + { "ALL", VAX_IDLE_VMS|VAX_IDLE_ULTOLD|VAX_IDLE_ULT|VAX_IDLE_ULT1X|VAX_IDLE_QUAD|VAX_IDLE_BSDNEW }, { 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, "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, " 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, " sim> SET CPU NOIDLE disable idle detection\n\n"); fprintf (st, "Idle detection is disabled by default. Unless ALL is specified, idle\n");