From 26cf38804b690d2d1f53b786440ce6e8442a3d3a Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Thu, 4 Sep 2014 14:08:59 -0700 Subject: [PATCH] VAX780: Added idle support for SysVR2 A new idle mode (SYSV) is now available: sim> SET CPU IDLE=SYSV --- VAX/vax_cpu.c | 20 +++++++++++++++----- VAX/vax_defs.h | 1 + 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/VAX/vax_cpu.c b/VAX/vax_cpu.c index f94d580e..e6ace209 100644 --- a/VAX/vax_cpu.c +++ b/VAX/vax_cpu.c @@ -491,7 +491,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|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|SYSV|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", @@ -2476,7 +2476,15 @@ for ( ;; ) { case BLBC: 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 */ + } break; /* Extract field instructions - ext?v pos.rl,size.rb,base.wb,dst.wl @@ -3538,7 +3546,8 @@ static struct os_idle os_tab[] = { { "OPENBSD", VAX_IDLE_BSDNEW }, { "QUASIJARUS", VAX_IDLE_QUAD }, { "32V", VAX_IDLE_QUAD }, - { "ALL", VAX_IDLE_VMS|VAX_IDLE_ULTOLD|VAX_IDLE_ULT|VAX_IDLE_ULT1X|VAX_IDLE_QUAD|VAX_IDLE_BSDNEW }, + { "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 }, { NULL, 0 } }; @@ -3642,13 +3651,14 @@ 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|ALL}\n"); +fprintf (st, " sim> SET CPU IDLE{=VMS|ULTRIX|NETBSD|FREEBSD|32V|SYSV|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"); fprintf (st, "detection is operating system specific. If idle detection is enabled with\n"); -fprintf (st, "an incorrect operating system setting, simulator performance could be\n"); -fprintf (st, "impacted. The default operating system setting is VMS.\n\n"); +fprintf (st, "an incorrect operating system setting, simulator performance or correct\n"); +fprintf (st, "functionality could be impacted. The default operating system setting is\n"); +fprintf (st, "VMS.\n\n"); fprintf (st, "The CPU can maintain a history of the most recently executed instructions.\n"); fprintf (st, "This is controlled by the SET CPU HISTORY and SHOW CPU HISTORY commands:\n\n"); fprintf (st, " sim> SET CPU HISTORY clear history buffer\n"); diff --git a/VAX/vax_defs.h b/VAX/vax_defs.h index 3ede6806..cf1ff84d 100644 --- a/VAX/vax_defs.h +++ b/VAX/vax_defs.h @@ -724,6 +724,7 @@ enum opcodes { #define VAX_IDLE_ULT1X 0x08 /* Ultrix 1.x */ #define VAX_IDLE_QUAD 0x10 #define VAX_IDLE_BSDNEW 0x20 +#define VAX_IDLE_SYSV 0x40 extern uint32 cpu_idle_mask; /* idle mask */ void cpu_idle (void);