1: mov $bootnm, r1
2: mov $2,r0 / ROOTINO
3: jsr pc,iget
4: clr r2 / offset
5: again:
6: jsr pc,readdir
7: beq restart / error - restart
8: mov 4(r0),r4 / dp->d_namlen
9: cmp r4,$bootlen / if (len == dp->d_namlen)
10: bne again / nope, go try next entry
11: mov r0,r3
12: add $6,r3 / r3 = dp->d_name
13: mov r1,r5 / r5 = filename
14: 9:
15: cmpb (r3)+,(r5)+
16: bne again / no match - go read next entry
17: sob r4,9b
18: mov (r0),r0 / r0 = dp->d_ino
19: jsr pc,iget / fetch boot's inode
20: br loadfile / 'boot'- go read it
21:
22: / get the inode specified in r0
23: iget:
24: add $INOFF,r0
25: mov r0,r5
26: ash $PBSHFT,r0
27: bic $!7777,r0
28: mov r0,dno
29: clr r0
30: jsr pc,rblk
31: bic $!17,r5
32: mov $INOSIZ,r0
33: mul r0,r5
34: add $buf,r5
35: mov $inod,r4
36: 1:
37: movb (r5)+,(r4)+
38: sob r0,1b
39: rts pc
40:
41: readdir:
42: bit $BSIZE-1,r2
43: bne 1f
44: jsr pc,rmblk / read mapped block (bno)
45: br err / end of file branch
46: clr r2 / start at beginning of buf
47: 1:
48: mov $buf,r0
49: add r2,r0 / dp = buf+offset
50: add buf+2(r2),r2 / dp += dp->d_reclen
51: tst (r0) / dp->d_ino == 0?
52: beq readdir / yes - go look at next
53: rts pc / return with r0 = &dp->d_ino
54: err:
55: clr r0 / return with
56: rts pc / dp = NULL
57:
58: loadfile:
59: clr bno / start at block 0 of inode in 'inod'
Defined functions
again
defined in line
5; used 2 times
err
defined in line
54; used 1 times
iget
defined in line
23; used 2 times