1: /*
   2:  * Addresses and bits for DEC's KT-11
   3:  * and macros for remapping kernel data space.
   4:  */
   5: 
   6: #define UISD    ((u_short *) 0177600)   /* first user I-space descriptor */
   7: #ifdef  ENABLE34
   8: #	define    DEC_UISA7   ((u_short *) 0177656)
   9:     extern  u_short *UISA, *UDSA, *KISA0, *KDSA1, *KDSA2, *KDSA5, *KDSA6;
  10: #else
  11: #	define    UISA    ((u_short *) 0177640)   /* first user I-space address */
  12: #	define    UDSA    ((u_short *) 0177660)   /* first user D-space address */
  13: #endif	ENABLE34
  14: 
  15: /*
  16:  * Access abilities
  17:  */
  18: #define RO  02      /* Read only */
  19: #define RW  06      /* Read and write */
  20: #define NOACC   0       /* Abort all accesses */
  21: #define ACCESS  07      /* Mask for access field */
  22: #define ED  010     /* Extension direction */
  23: #define TX  020     /* Software: text segment */
  24: #define ABS 040     /* Software: absolute address */
  25: 
  26: u_short *ka6;           /* nonseparate:  KISA6; separate:  KDSA6 */
  27: 
  28: #ifndef ENABLE34
  29: #	define    KISA0   ((u_short *) 0172340)
  30: #	define    KISA1   ((u_short *) 0172342)
  31: #	define    KISA5   ((u_short *) 0172352)
  32: #	define    KISA6   ((u_short *) 0172354)
  33: #	define    SSR3    ((u_short *) 0172516)
  34: #endif	ENABLE34
  35: 
  36: #define KISD1   ((u_short *) 0172302)
  37: #define KISD5   ((u_short *) 0172312)
  38: #define KISD6   ((u_short *) 0172314)
  39: #ifdef  KERN_NONSEP
  40: #	ifndef    ENABLE34
  41: #		define   KDSA5   KISA5
  42: #		define   KDSA6   KISA6
  43: #	endif	ENABLE34
  44: #	define    KDSD5   KISD5
  45: #	define    KDSD6   KISD6
  46: #else
  47: #	ifndef    ENABLE34
  48: #		define   KDSA5   ((u_short *) 0172372)
  49: #		define   KDSA6   ((u_short *) 0172374)
  50: #	endif	ENABLE34
  51: #	define    KDSD5   ((u_short *) 0172332)
  52: #	define    KDSD6   ((u_short *) 0172334)
  53: #endif
  54: #define SEG5    ((caddr_t) 0120000)
  55: 
  56: 
  57: /*
  58:  * Macros for resetting the kernel segmentation registers to map in
  59:  * out-of-address space data.
  60:  * If KDSA5 is used for kernel data space (NOKA5 not defined),
  61:  * only proc, file and text tables are allowed in that range.
  62:  * Routines can repoint KDSA5 to map in data such as buffers or clists
  63:  * without raising processor priority by calling these macros.
  64:  * Copy (in mch.s) uses two registers, KDSA5 and 6. If KDSA6 is in use,
  65:  * the prototype register kdsa6 will be non-zero, and the kernel will
  66:  * be running on a temporary stack in bss.
  67:  * Interrupt routines that access any of the structures in this range
  68:  * or the u. must call savemap (in machdep.c) to save the current mapping
  69:  * information in a local structure and restore it before returning.
  70:  * If KDSA5 is not used for static kernel data, only KDSA6 need be
  71:  * saved and restored to access all static data at interrupt time.
  72:  *
  73:  * USAGE:
  74:  *	To repoint KDSA5 from the top level,
  75:  *		mapseg5(addr, desc);	* KDSA5 now points at addr *
  76:  *		...
  77:  *		normalseg5();		* normal mapping *
  78:  *	To repoint KDSA5 from interrupt or top level,
  79:  *		segm saveregs;
  80:  *		saveseg5(saveregs);	* save previous mapping of segment 5 *
  81:  *		mapseg5(addr, desc);	* KDSA5 now points at addr *
  82:  *		...
  83:  *		restorseg5(saveregs);	* restore previous mapping *
  84:  *	To access proc, text, file or user structures from interrupt level,
  85:  *		mapinfo map;
  86:  *		savemap(map);		* save ALL mapping information, *
  87:  *					* restore normal mapping of KA5 and 6 *
  88:  *		...
  89:  *		restormap(map);		* restore previous mapping *
  90:  */
  91: 
  92: /*
  93:  *  Structure to hold a saved PAR/PDR pair.
  94:  */
  95: struct segm_reg {
  96:     unsigned    se_desc;
  97:     unsigned    se_addr;
  98: };
  99: typedef struct segm_reg segm;
 100: 
 101: unsigned    kdsa6;              /* saved KDSA6, if any */
 102: #define KD6 (((USIZE-1)<<8) | RW)   /* prototype descriptor for u. */
 103: #define NOMAP   65535           /* invalid PDR value */
 104: 
 105: /*
 106:  *	remap_area is a dummy var at start of possibly-mapped area,
 107:  *	for consistency check.  Only proc, text and file tables are after it,
 108:  *	and it must lie at <= 0120000, or other kernel data will be mapped out.
 109:  */
 110: extern  int remap_area;
 111: 
 112: #ifndef NOKA5
 113: 
 114: segm seg5;              /* prototype KDSA5, KDSD5 */
 115: typedef struct segm_reg mapinfo[2]; /* KA5, KA6 */
 116: 
 117: /* 	Restore normal kernel map for seg5.  */
 118: #define normalseg5()    restorseg5(seg5)
 119: 
 120: /*	save previous mapping information and restore normal mapping.  */
 121: #define savemap(map)    {if (*KDSA5 != seg5.se_addr) Savemap(map); \
 122:              else map[0].se_desc = NOMAP; }
 123: 
 124: /*	Restore previous mapping on return from interrupt.  */
 125: #define restormap(map)  {if (map[0].se_desc != NOMAP) Restormap(map); }
 126: 
 127: #else   NOKA5
 128: 
 129: typedef struct segm_reg mapinfo[1]; /* KDSA6 only */
 130: 
 131: /*
 132:  *	Restore normal kernel map for seg5: unneeded,
 133:  *	since no kernel data are in this range.
 134:  */
 135: #define normalseg5()    /* not needed */
 136: 
 137: /*	save previous mapping information and restore normal mapping.  */
 138: #define savemap(map)    if (kdsa6) { \
 139:         map[0].se_addr = *KDSA6; \
 140:         map[0].se_desc = *KDSD6; \
 141:         *KDSD6 = KD6; \
 142:         *KDSA6 = kdsa6; \
 143:     } else map[0].se_desc = NOMAP;
 144: 
 145: /*	Restore previous mapping on return from interrupt.  */
 146: #define restormap(map)  if (map[0].se_desc != NOMAP) { \
 147:         *KDSD6 = map[0].se_desc; \
 148:         *KDSA6 = map[0].se_addr; \
 149:     }
 150: 
 151: #endif	NOKA5
 152: 
 153: /*	Use segment 5 to access the given address.  */
 154: #define mapseg5(addr,desc)  {*KDSA5 = addr; *KDSD5 = desc;}
 155: 
 156: /*	Save the previous contents of KDSA5/KDSD5.  */
 157: #define saveseg5(save)      {save.se_addr = *KDSA5; save.se_desc = *KDSD5;}
 158: 
 159: /*	Restore the previous contents of KDSA5/KDSD5.  */
 160: #define restorseg5(save)    {*KDSD5 = save.se_desc; *KDSA5 = save.se_addr;}

Defined variables

kdsa6 defined in line 101; used 4 times
seg5 defined in line 114; used 4 times

Defined struct's

segm_reg defined in line 95; used 6 times

Defined typedef's

segm defined in line 99; used 14 times

Defined macros

ABS defined in line 24; used 7 times
ACCESS defined in line 21; used 1 times
DEC_UISA7 defined in line 8; used 3 times
ED defined in line 22; used 3 times
KD6 defined in line 102; used 2 times
KDSA5 defined in line 48; used 7 times
KDSA6 defined in line 49; used 7 times
KDSD5 defined in line 51; used 5 times
KDSD6 defined in line 52; used 6 times
KISA0 defined in line 29; used 6 times
KISA1 defined in line 30; never used
KISA5 defined in line 31; used 1 times
  • in line 41
KISA6 defined in line 32; used 1 times
  • in line 42
KISD1 defined in line 36; never used
KISD5 defined in line 37; used 1 times
  • in line 44
KISD6 defined in line 38; used 1 times
  • in line 45
NOACC defined in line 20; used 3 times
NOMAP defined in line 103; used 6 times
SEG5 defined in line 54; used 6 times
SSR3 defined in line 33; never used
TX defined in line 23; used 5 times
UDSA defined in line 12; used 2 times
UISA defined in line 11; used 25 times
UISD defined in line 6; used 21 times
mapseg5 defined in line 154; used 12 times
normalseg5 defined in line 135; used 2 times
restorseg5 defined in line 160; used 17 times
saveseg5 defined in line 157; used 15 times

Usage of this include

Last modified: 1983-09-07
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1285
Valid CSS Valid XHTML 1.0 Strict