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