1: /*
   2:  *	SCCS id	@(#)enable34.c	2.1 (Berkeley)	11/20/83
   3:  */
   4: 
   5: /*
   6:  *	All information relevant to the ENABLE/34 is supplied with
   7:  *	the permission of ABLE Computer and may not be disclosed in
   8:  *	any manner to sites not licensed by the University of California
   9:  *	for the Second Berkeley Software Distribution.
  10:  *
  11:  *	ENABLE/34 support routines.
  12:  *	Warning:  if part of an overlaid kernel, this module must be
  13:  *	loaded in the base segment.
  14:  */
  15: 
  16: #include "param.h"
  17: #ifdef  ENABLE34
  18: #include <sys/systm.h>
  19: #include <sys/dir.h>
  20: #include <sys/user.h>
  21: #include <sys/inode.h>
  22: #include <sys/proc.h>
  23: #include <sys/seg.h>
  24: #include <sys/iopage.h>
  25: #include <sys/enable34.h>
  26: 
  27: 
  28: /*
  29:  *	Turn on an ENABLE/34 and fudge the PARs to achieve the ``nominal map,''
  30:  *	i.e.		0163700 - 0163716:	KISA0 - KISA7
  31:  * 			0163720 - 0163736:	UISA0 - UISA7
  32:  * 			0163740 - 0163756:	UDSA0 - UDSA7
  33:  * 			0163760 - 0163776:	KDSA0 - KDSA7
  34:  *
  35:  *	Assumes that DEC memory management is already on.  This routine
  36:  *	cannot be interruptible since we might be changing PARs which
  37:  *	point to overlay pages.
  38:  */
  39: 
  40: /*
  41:  * Shorthand:
  42:  */
  43: #define A   ((u_short *) 0163700)       /* ENABLE/34 PARs */
  44: #define KI  ((u_short *) 0172340)       /* DEC Kernel I PARs */
  45: #ifndef KERN_NONSEP
  46: #define KD  ((u_short *) 0172360)       /* DEC Kernel D PARs */
  47: #else
  48: #define KD  KI              /* DEC Kernel D PARs */
  49: #endif
  50: #define UI  ((u_short *) 0177640)       /* DEC User I PARs */
  51: #ifndef NONSEPARATE
  52: #define UD  ((u_short *) 0177660)       /* DEC User D PARs */
  53: #else
  54: #define UD  UI              /* DEC User D PARs */
  55: #endif
  56: 
  57: void
  58: enableon()
  59: {
  60:     register i, s;
  61:     extern  bool_t  enable34, sep_id;
  62: 
  63:     if (!enable34)
  64:         panic ("enableon");
  65:     else
  66:         if (*ENABLE_SSR4)
  67:             return;
  68:         else
  69:             s   = spl7();
  70: 
  71:     for (i = 0; i < 31; i++)
  72:         A[i]    = (u_short) 0200 * (u_short) i;
  73:     A[31]   = (u_short) 0200 * (u_short) 511;
  74: 
  75:     /*
  76: 	 *	Ok so far because the ENABLE mapping is not turned on.
  77: 	 *	Since the above map is the identity map, turning on
  78: 	 *	ENABLE mapping will cause no harm.
  79: 	 */
  80:     *ENABLE_SSR3    = ENABLE_SSR3_PARS_ON | ENABLE_SSR3_UBMAP_ON;
  81:     *ENABLE_SSR4    |= ENABLE_SSR4_MAP_ON;
  82: 
  83:     for (i = 0; i < 7; i++)
  84:         A[i + 24]   = sep_id ?  KD[i] : KI[i];
  85:     for (i = 0; i < 8; i++)
  86:         A[i + 16]   = KI[i];
  87: 
  88:     /*
  89: 	 *	Wiggle around changing DEC PARs to the nominal map.  This is
  90: 	 *	possible because we have extra A[] entries to use.  Even though
  91: 	 *	the values of A[] and K?[] change, A[K?[]] is unchanged.
  92: 	 */
  93:     for (i = 0; i < 8; i++) {
  94: #ifndef KERN_NONSEP
  95:         KD[i]   = (u_short) 0200 * (u_short) (i + 24);
  96: #endif
  97:         KI[i]   = (u_short) 0200 * (u_short) (i + 16);
  98:         A[i]    = A[i + 16];
  99:         KI[i]   = (u_short) 0200 * (u_short) i;
 100:     }
 101: 
 102:     /*
 103: 	 *	The kernel mode part of the nominal map has been established.
 104: 	 *	Now do the user mode part.  This is much easier.
 105: 	 */
 106:     for (i = 0; i < 8; i++) {
 107:         A[i + 8]    = UI[i];
 108:         A[i + 16]   = sep_id ?  UD[i] : UI[i];
 109: #ifndef NONSEPARATE
 110:         UI[i]   = (u_short) 0200 * (u_short) (i + 8);
 111:         if (sep_id)
 112: #endif
 113:             UD[i]   = (u_short) 0200 * (u_short) (i + 16);
 114:     }
 115: 
 116:     for (i = 0; i < 32; i++)
 117:         if (A[i] == 07600)
 118:             A[i]    = (u_short) 0200 * (u_short) 511;
 119: 
 120:     splx(s);
 121: }
 122: 
 123: /*
 124:  *	Routines for probing the I/O page.  We must repoint the DEC
 125:  *	segmentation registers because of the second level of indirection
 126:  *	introduced by the ENABLE/34 segmentation registers.  These routines
 127:  *	cannot be interruptible.
 128:  */
 129: 
 130: #define MapUI7                              \
 131:             register saveuisa7  = *DEC_UISA7;       \
 132:             register s  = spl7();           \
 133:             *DEC_UISA7  = 0177600;
 134: #define UnmapUI7                            \
 135:             *DEC_UISA7  = saveuisa7;            \
 136:             splx (s);
 137: 
 138: fiobyte (addr)
 139: {
 140:     register val;
 141: 
 142:     MapUI7;
 143:     val = fuibyte (addr);
 144:     UnmapUI7;
 145:     return (val);
 146: }
 147: 
 148: fioword (addr)
 149: {
 150:     register val;
 151: 
 152:     MapUI7;
 153:     val = fuiword (addr);
 154:     UnmapUI7;
 155:     return (val);
 156: }
 157: #endif	ENABLE34

Defined functions

enableon defined in line 57; used 2 times
fiobyte defined in line 138; never used

Defined macros

A defined in line 43; used 10 times
KD defined in line 48; used 2 times
KI defined in line 44; used 5 times
MapUI7 defined in line 130; used 2 times
UD defined in line 54; used 2 times
UI defined in line 50; used 4 times
UnmapUI7 defined in line 134; used 2 times
Last modified: 1983-11-20
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 904
Valid CSS Valid XHTML 1.0 Strict