1: #include "../h/param.h"
2: #include "../h/systm.h"
3: #include "../h/acct.h"
4: #include "../h/dir.h"
5: #include "../h/user.h"
6: #include "../h/inode.h"
7: #include "../h/proc.h"
8: #include "../h/seg.h"
9: #include "../h/map.h"
10: #include "../h/reg.h"
11: #include "../h/buf.h"
12:
13: /*
14: * Icode is the octal bootstrap
15: * program executed in user mode
16: * to bring up the system.
17: */
18: int icode[] =
19: {
20: 0104413, /* sys exec; init; initp */
21: 0000014,
22: 0000010,
23: 0000777, /* br . */
24: 0000014, /* initp: init; 0 */
25: 0000000,
26: 0062457, /* init: </etc/init\0> */
27: 0061564,
28: 0064457,
29: 0064556,
30: 0000164,
31: };
32: int szicode = sizeof(icode);
33:
34: /*
35: * Machine-dependent startup code
36: */
37: startup()
38: {
39: register i;
40:
41: /*
42: * zero and free all of core
43: */
44:
45: i = ka6->r[0] + USIZE;
46: UISD->r[0] = 077406;
47: for(;;) {
48: UISA->r[0] = i;
49: if(fuibyte((caddr_t)0) < 0)
50: break;
51: clearseg(i);
52: maxmem++;
53: mfree(coremap, 1, i);
54: i++;
55: }
56: if(cputype == 70)
57: for(i=0; i<62; i+=2) {
58: UBMAP->r[i] = i<<12;
59: UBMAP->r[i+1] = 0;
60: }
61: printf("mem = %D\n", ctob((long)maxmem));
62: if(MAXMEM < maxmem)
63: maxmem = MAXMEM;
64: mfree(swapmap, nswap, 1);
65: swplo--;
66:
67: /*
68: * determine clock
69: */
70:
71: UISA->r[7] = ka6->r[1]; /* io segment */
72: UISD->r[7] = 077406;
73: }
74:
75: /*
76: * set up a physical address
77: * into users virtual address space.
78: */
79: sysphys()
80: {
81: register i, s, d;
82: register struct a {
83: int segno;
84: int size;
85: int phys;
86: } *uap;
87:
88: if(!suser())
89: return;
90: uap = (struct a *)u.u_ap;
91: i = uap->segno;
92: if(i < 0 || i >= 8)
93: goto bad;
94: s = uap->size;
95: if(s < 0 || s > 128)
96: goto bad;
97: d = u.u_uisd[i+8];
98: if(d != 0 && (d&ABS) == 0)
99: goto bad;
100: u.u_uisd[i+8] = 0;
101: u.u_uisa[i+8] = 0;
102: if(!u.u_sep) {
103: u.u_uisd[i] = 0;
104: u.u_uisa[i] = 0;
105: }
106: if(s) {
107: u.u_uisd[i+8] = ((s-1)<<8) | RW|ABS;
108: u.u_uisa[i+8] = uap->phys;
109: if(!u.u_sep) {
110: u.u_uisa[i] = u.u_uisa[i+8];
111: u.u_uisd[i] = u.u_uisd[i+8];
112: }
113: }
114: sureg();
115: return;
116:
117: bad:
118: u.u_error = EINVAL;
119: }
120:
121: /*
122: * Determine which clock is attached, and start it.
123: * panic: no clock found
124: */
125: #define CLOCK1 ((physadr)0177546)
126: #define CLOCK2 ((physadr)0172540)
127: clkstart()
128: {
129: lks = CLOCK1;
130: if(fuiword((caddr_t)lks) == -1) {
131: lks = CLOCK2;
132: if(fuiword((caddr_t)lks) == -1)
133: panic("no clock");
134: }
135: lks->r[0] = 0115;
136: }
137:
138: /*
139: * Let a process handle a signal by simulating an interrupt
140: */
141: sendsig(p, signo)
142: caddr_t p;
143: {
144: register unsigned n;
145:
146: n = u.u_ar0[R6] - 4;
147: grow(n);
148: suword((caddr_t)n+2, u.u_ar0[RPS]);
149: suword((caddr_t)n, u.u_ar0[R7]);
150: u.u_ar0[R6] = n;
151: u.u_ar0[RPS] &= ~TBIT;
152: u.u_ar0[R7] = (int)p;
153: }
154:
155: /*
156: * 11/70 routine to allocate the
157: * UNIBUS map and initialize for
158: * a unibus device.
159: * The code here and in
160: * rhstart assumes that an rh on an 11/70
161: * is an rh70 and contains 22 bit addressing.
162: */
163: int maplock;
164:
165: mapalloc(bp)
166: register struct buf *bp;
167: {
168: register i, a;
169:
170: if(cputype != 70)
171: return;
172: spl6();
173: while(maplock&B_BUSY) {
174: maplock |= B_WANTED;
175: sleep((caddr_t)&maplock, PSWP+1);
176: }
177: maplock |= B_BUSY;
178: spl0();
179: bp->b_flags |= B_MAP;
180: a = bp->b_xmem;
181: for(i=16; i<32; i+=2)
182: UBMAP->r[i+1] = a;
183: for(a++; i<48; i+=2)
184: UBMAP->r[i+1] = a;
185: bp->b_xmem = 1;
186: }
187:
188: mapfree(bp)
189: struct buf *bp;
190: {
191:
192: bp->b_flags &= ~B_MAP;
193: if(maplock&B_WANTED)
194: wakeup((caddr_t)&maplock);
195: maplock = 0;
196: }
Defined functions
Defined variables
icode
defined in line
18; used 3 times
Defined struct's
a
defined in line
82; used 2 times
Defined macros