|
|
1.1 root 1: /*
2: * UP disk boot program to load "/boot" from
3: * a UNIX filesystem (starting at block 1 on pack on
4: * drive 0) into low core and to execute that file.
5: *
6: * This program can only read regular small 1k byte (3bsd+) files
7: * from the root of a UNIX filesystem.
8: */
9: .set BLKSIZ,1024 /* file system block size */
10: .set RELOC,0x50000
11: .set INOSIZ,64 /* no. bytes/inode entry */
12: .set INOBLK,BLKSIZ/INOSIZ /* no. inodes/disc block */
13: .set INOMSK,0xfffffff0 /* changes with inode size */
14: .set NAMSIZ,14 /* bytes in directory name */
15: .set ENTADR,024 /* offset to entry addr in a.out */
16: .set DIRSIZ,16 /* size of directory entry, bytes */
17: .set ROOTINO,2 /* root dir inode no. */
18: .set NBOO,1
19: .set NSUP,1
20: .set SID,62 /* system ID register */
21: /* UBA registers */
22: .set UBA_CNFGR,0 /* UBA configuration register */
23: .set UBA_CR,4 /* UBA control register offset */
24: .set UBA_MAP,0x800 /* UBA offset to map reg's */
25: .set UBAinit,1 /* UBA init bit in UBA control reg */
26: .set pUBIC,16 /* Unibus init complete */
27: /* UP registers and bits */
28: .set UP,0176700-0160000 /* address of UP controller */
29: .set UP_cs1,UP+0 /* control and status */
30: .set UP_wc,UP+2 /* word count */
31: .set UP_ba,UP+4 /* bus address */
32: .set UP_da,UP+6 /* disk address */
33: .set UP_cs2,UP+010 /* cs2 register */
34: .set UP_of,UP+032 /* offset register */
35: .set UP_dc,UP+034 /* desired cylinder */
36: .set UP_hr,UP+036 /* holding register */
37: .set UPHR_MAXTRAK,0100030
38: .set UPSEC,32
39: .set UP_GO,1 /* go bit */
40: .set UP_PACK,022 /* pack acknowledge */
41: .set UP_DCLR,010 /* drive clear */
42: .set UP_PRESET,020 /* read-in-preset */
43: .set UP_RCOM,070 /* read command */
44: .set UPCS2_CLR,040
45: .set UP_pRDY,7 /* position of ready bit */
46: .set UP_pERR,15 /* position of error bit */
47: .set UP_FMT22,010000
48:
49: init:
50: .word 0 /* entry mask for dec monitor */
51: nop;nop;nop;nop;nop;nop;nop;nop /* some no-ops for 750 boot to skip */
52: nop;nop;
53: /* get cpu type and find the first uba */
54: mfpr $SID,r0
55: extzv $24,$8,r0,r0 /* get cpu type */
56: ashl $2,r0,r1
57: movab physUBA,r2 /* get physUBA[cpu] */
58: addl2 r1,r2
59: movl (r2),r9
60: movab physUMEM,r2 /* get physUMEM[cpu] */
61: addl2 r1,r2
62: movl (r2),r10
63: /* if 780, init uba */
64: cmpl r0,$1
65: bneq 2f
66: movl $UBAinit,UBA_CR(r9)
67: 1:
68: bbc $pUBIC,UBA_CNFGR(r9),1b
69: 2:
70: movl $5000000,r0
71: 1:
72: sobgtr r0,1b
73: /* init up, set vv in drive 0; if any errors, give up */
74: movw $UPCS2_CLR,UP_cs2(r10)
75: movw $UP_DCLR+UP_GO,UP_cs1(r10)
76: movw $UP_PRESET+UP_GO,UP_cs1(r10)
77: movw $UP_FMT22,UP_of(r10)
78: 1:
79: movw UP_cs1(r10),r0
80: bbc $UP_pRDY,r0,1b
81: /* relocate to high core */
82: start:
83: movl r5,r11 /* boot flags */
84: movl $RELOC,sp
85: moval init,r6
86: movc3 $end,(r6),(sp)
87: jmp *$RELOC+start2
88: /* now running relocated */
89: start2:
90: /* determine tracks; for now must get 10 or 19, otw assume 19 */
91: /* always assume 32 sectors for now; this all handles fuji's and 300mbs */
92: movw $UPHR_MAXTRAK,UP_hr(r10)
93: movw UP_hr(r10),r0
94: incl r0
95: movw r0,*$uptrk
96: 1:
97: mull3 $32,r0,*$upst
98: /* search for ``boot'' in root inode */
99: movl $names+RELOC,r6
100: movzbl $ROOTINO,r0
101: nxti:
102: clrw *$bno
103: bsbw iget
104: tstb (r6)
105: beql getfil
106: get1b:
107: bsbw rmblk
108: beql start2
109: movl $buf,r7
110: nxtent:
111: tstw (r7)
112: beql dirchk
113: cmpc3 $NAMSIZ,(r6),2(r7)
114: bneq dirchk
115: movzwl (r7),r0
116: addl2 $NAMSIZ,r6
117: brb nxti
118: dirchk:
119: acbl $buf+BLKSIZ-1,$DIRSIZ,r7,nxtent
120: brb get1b
121: /* found inode for desired file... read it in */
122: getfil:
123: clrl bufptr
124: getlop:
125: bsbb rmblk
126: beql clear
127: addl2 $BLKSIZ,bufptr
128: brb getlop
129: clear:
130: movl *$size,r3
131: clrcor:
132: clrq (r3)
133: acbl $RELOC,$8,r3,clrcor
134: /* run loaded program */
135: movl $2,r10 /* major("/dev/up0a") */
136: calls $0,*$0
137: brw start2
138: /* iget: get inode block whose # is in r0 */
139: iget:
140: addl3 $(INOBLK*(NBOO+NSUP))-1,r0,r8
141: divl3 $INOBLK,r8,r4
142: bsbw rblk
143: bicl2 $INOMSK,r8
144: mull2 $INOSIZ,r8
145: addl2 $buf,r8
146: movc3 $time-inode,(r8),*$inode
147: rsb
148: /* rmblk: read in bno into addr */
149: rmblk:
150: movzwl *$bno,r0
151: addw2 $3,*$bno
152: addl2 $addr,r0
153: /* this boot assumes only small files (<=20 blocks) */
154: extzv $0,$24,(r0),r4
155: bneq rblk
156: rsb
157: /* rblk: read disk block whose number is in r4 */
158: rblk:
159: mull2 $BLKSIZ/512,r4
160: clrl r5
161: ediv *$upst,r4,r0,r1
162: movw r0,UP_dc(r10)
163: clrl r2
164: ediv $UPSEC,r1,r1,r0
165: insv r1,$8,$5,r0
166: movw r0,UP_da(r10)
167: movw $-BLKSIZ/2,UP_wc(r10)
168: ashl $-9,bufptr,r0
169: bisl3 $0x80000000,r0,UBA_MAP(r9)
170: incl r0
171: bisl3 $0x80000000,r0,UBA_MAP+4(r9)
172: clrw UP_ba(r10)
173: movw $UP_RCOM+UP_GO,UP_cs1(r10)
174: uprdy:
175: movw UP_cs1(r10),r0
176: bbc $UP_pRDY,r0,uprdy
177: rsb
178: bufptr: .long buf
179: names: .byte 'b,'o,'o,'t,0,0,0,0,0,0,0,0,0,0
180: .byte 0
181: physUBA:
182: .long 0
183: .long 0x20006000 /* 11/780 */
184: .long 0xf30000 /* 11/750 */
185: .long 0xf26000 /* 11/7ZZ */
186: physUMEM:
187: .long 0
188: .long 0x2013e000 /* 11/780 */
189: .long 0xffe000 /* 11/750 */
190: .long 0xffe000 /* 11/7ZZ */
191: end:
192: .set buf,RELOC-1536
193: .set inode,RELOC-512
194: .set mode,inode
195: .set nlink,mode+2
196: .set uid,nlink+2
197: .set gid,uid+2
198: .set size,gid+2
199: .set addr,size+4
200: .set time,addr+40
201: .set bno,time+12
202: .set uptrk,bno+4
203: .set upst,uptrk+4
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.