|
|
1.1 root 1: /*
2: * RK07 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: /* RK611 registers and bits */
28: .set HK,0177440-0160000 /* address of RK611 */
29: .set HK_cs1,HK+0 /* control and status */
30: .set HK_wc,HK+2 /* word count */
31: .set HK_ba,HK+4 /* bus address */
32: .set HK_da,HK+6 /* disk address */
33: .set HK_dc,HK+020 /* desired cylinder */
34: .set HKSECT,22
35: .set HKTRAC,3
36: .set HKST,HKSECT*HKTRAC
37: .set HK_GO,1 /* go bit */
38: .set HK_PACK,2 /* pack acknowledge */
39: .set HK_RCOM,020 /* read command */
40: .set HK_SEL7,02000 /* select RK07 disk */
41: .set HK_pRDY,7 /* position of ready bit */
42: .set HK_pERR,15 /* position of error bit */
43:
44: init:
45: /* r9 UBA address */
46: /* r10 umem addr */
47: .word 0 /* entry mask for dec monitor */
48: nop;nop;nop;nop;nop;nop;nop;nop /* some no-ops for 750 boot to skip */
49: nop;nop;
50: /* get cpu type and find the first uba */
51: mfpr $SID,r0
52: extzv $24,$8,r0,r0 /* get cpu type */
53: ashl $2,r0,r1
54: movab physUBA,r2 /* get physUBA[cpu] */
55: addl2 r1,r2
56: movl (r2),r9
57: movab physUMEM,r2 /* get physUMEM[cpu] */
58: addl2 r1,r2
59: movl (r2),r10
60: /* if 780, init uba */
61: cmpl r0,$1
62: bneq 2f
63: movl $UBAinit,UBA_CR(r9)
64: 1:
65: bbc $pUBIC,UBA_CNFGR(r9),1b
66: 2:
67: /* init rk611, set vv in drive 0; if any errors, give up */
68: movw $HK_SEL7+HK_GO,HK_cs1(r10)
69: 1:
70: movw HK_cs1(r10),r0
71: bbc $HK_pRDY,r0,1b
72: bbs $HK_pERR,r0,9f
73: movw $HK_SEL7+HK_PACK+HK_GO,HK_cs1(r10)
74: 1:
75: movw HK_cs1(r10),r0
76: bbc $HK_pRDY,r0,1b
77: bbc $HK_pERR,r0,start
78: 9:
79: halt
80: /* relocate to high core */
81: start:
82: movl r5,r11 /* boot flags */
83: movl $RELOC,sp
84: moval init,r6
85: movc3 $end,(r6),(sp)
86: jmp *$RELOC+start2
87: /* now running relocated */
88: /* search for ``boot'' in root inode */
89: start2:
90: movl $names+RELOC,r6
91: movzbl $ROOTINO,r0
92: nxti:
93: clrw *$bno
94: bsbw iget
95: tstb (r6)
96: beql getfil
97: get1b:
98: bsbw rmblk
99: beql start2
100: movl $buf,r7
101: nxtent:
102: tstw (r7)
103: beql dirchk
104: cmpc3 $NAMSIZ,(r6),2(r7)
105: bneq dirchk
106: movzwl (r7),r0
107: addl2 $NAMSIZ,r6
108: brb nxti
109: dirchk:
110: acbl $buf+BLKSIZ-1,$DIRSIZ,r7,nxtent
111: brb get1b
112: /* found inode for desired file... read it in */
113: getfil:
114: clrl bufptr
115: getlop:
116: bsbb rmblk
117: beql clear
118: addl2 $BLKSIZ,bufptr
119: brb getlop
120: clear:
121: movl *$size,r3
122: clrcor:
123: clrq (r3)
124: acbl $RELOC,$8,r3,clrcor
125: /* run loaded program */
126: movl $3,r10 /* major("/dev/hk0a") */
127: calls $0,*$0
128: brw start2
129: /* iget: get inode block whose # is in r0 */
130: iget:
131: addl3 $(INOBLK*(NBOO+NSUP))-1,r0,r8
132: divl3 $INOBLK,r8,r4
133: bsbw rblk
134: bicl2 $INOMSK,r8
135: mull2 $INOSIZ,r8
136: addl2 $buf,r8
137: movc3 $time-inode,(r8),*$inode
138: rsb
139: /* rmblk: read in bno into addr */
140: rmblk:
141: movzwl *$bno,r0
142: addw2 $3,*$bno
143: addl2 $addr,r0
144: /* this boot assumes only small files (<=20 blocks) */
145: extzv $0,$24,(r0),r4
146: bneq rblk
147: rsb
148: /* rblk: read disk block whose number is in r4 */
149: rblk:
150: mull2 $BLKSIZ/512,r4
151: clrl r5
152: ediv $HKST,r4,r0,r1
153: movw r0,HK_dc(r10)
154: clrl r2
155: ediv $HKSECT,r1,r1,r0
156: insv r1,$8,$3,r0
157: movw r0,HK_da(r10)
158: movw $-BLKSIZ/2,HK_wc(r10)
159: ashl $-9,bufptr,r0
160: bisl3 $0x80000000,r0,UBA_MAP(r9)
161: incl r0
162: bisl3 $0x80000000,r0,UBA_MAP+4(r9)
163: clrw HK_ba(r10)
164: movw $HK_SEL7+HK_RCOM+HK_GO,HK_cs1(r10)
165: hkrdy:
166: movw HK_cs1(r10),r0
167: bbc $HK_pRDY,r0,hkrdy
168: bbs $HK_pERR,r0,hkerr
169: bicpsw $2
170: rsb
171: hkerr:
172: halt /* ungraceful */
173: bufptr: .long buf
174: names: .byte 'b,'o,'o,'t,0,0,0,0,0,0,0,0,0,0
175: .byte 0
176: physUBA:
177: .long 0
178: .long 0x20006000 /* 11/780 */
179: .long 0xf30000 /* 11/750 */
180: .long 0xf26000 /* 11/7ZZ */
181: physUMEM:
182: .long 0
183: .long 0x2013e000 /* 11/780 */
184: .long 0xffe000 /* 11/750 */
185: .long 0xffe000 /* 11/7ZZ */
186: end:
187: .set buf,RELOC-1536
188: .set inode,RELOC-512
189: .set mode,inode
190: .set nlink,mode+2
191: .set uid,nlink+2
192: .set gid,uid+2
193: .set size,gid+2
194: .set addr,size+4
195: .set time,addr+40
196: .set bno,time+12
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.