Subject: Block 0 can fail to find /boot Index: sys/mdec/*.s 2.11BSD Description: The block 0 disk bootblock can fail to find the /boot program. Because a common template ('boilerplate') was used all of the block 0 programs have the bug. Repeat-By: Have a 4 character file ('unix') preceed 'boot' in the '/' directory. The block 0 code will not be able to find the secondary boot program. Fix: Apply the following patch to all of the block 0 bootstraps. The problem was a failure to reinitialize R5 with the "$bootlen" after finding a filename which was "$bootlen" characters long. When the first filename of length "$bootlen" (4) was found R5 was used to compare the filename strings. If the filenames did not compare as equal the next entry from the directory was read but R5 was left holding an address in the middle of "$bootnm" rather than the constant "$bootlen" (4). The fix is to not even bother using R5 to hold "$bootlen". The length comparison is done directly using the directory entry length in R4. A side effect is that the block 0 bootstrap is reduced 2 bytes in size with this fix. ------------------------------cut here------------------------------------- *** /sys/mdec/boilerplate.old Wed May 23 15:50:27 1990 --- /sys/mdec/boilerplate Tue Mar 10 18:13:48 1992 *************** *** 1,13 **** mov $bootnm, r1 mov $2,r0 / ROOTINO jsr pc,iget - mov $bootlen,r5 / len = strlen(pathnamecomponent) clr r2 / offset again: jsr pc,readdir beq restart / error - restart mov 4(r0),r4 / dp->d_namlen ! cmp r4,r5 / if (len == dp->d_namlen) bne again / nope, go try next entry mov r0,r3 add $6,r3 / r3 = dp->d_name --- 1,12 ---- mov $bootnm, r1 mov $2,r0 / ROOTINO jsr pc,iget clr r2 / offset again: jsr pc,readdir beq restart / error - restart mov 4(r0),r4 / dp->d_namlen ! cmp r4,$bootlen / if (len == dp->d_namlen) bne again / nope, go try next entry mov r0,r3 add $6,r3 / r3 = dp->d_name *** /sys/mdec/bruboot.s.old Sat Jun 15 11:42:10 1991 --- /sys/mdec/bruboot.s Tue Mar 10 18:09:33 1992 *************** *** 87,99 **** mov $bootnm, r1 mov $2,r0 / ROOTINO jsr pc,iget - mov $bootlen,r5 / len = strlen(pathnamecomponent) clr r2 / offset again: jsr pc,readdir beq restart / error - restart mov 4(r0),r4 / dp->d_namlen ! cmp r4,r5 / if (len == dp->d_namlen) bne again / nope, go try next entry mov r0,r3 add $6,r3 / r3 = dp->d_name --- 87,98 ---- mov $bootnm, r1 mov $2,r0 / ROOTINO jsr pc,iget clr r2 / offset again: jsr pc,readdir beq restart / error - restart mov 4(r0),r4 / dp->d_namlen ! cmp r4,$bootlen / if (bootlen == dp->d_namlen) bne again / nope, go try next entry mov r0,r3 add $6,r3 / r3 = dp->d_name *** /sys/mdec/dvhpuboot.s.old Wed Apr 24 13:08:07 1991 --- /sys/mdec/dvhpuboot.s Tue Mar 10 18:09:13 1992 *************** *** 74,86 **** mov $bootnm, r1 mov $2,r0 / ROOTINO jsr pc,iget - mov $bootlen,r5 / len = strlen(pathnamecomponent) clr r2 / offset again: jsr pc,readdir beq restart / error - restart mov 4(r0),r4 / dp->d_namlen ! cmp r4,r5 / if (len == dp->d_namlen) bne again / nope, go try next entry mov r0,r3 add $6,r3 / r3 = dp->d_name --- 74,85 ---- mov $bootnm, r1 mov $2,r0 / ROOTINO jsr pc,iget clr r2 / offset again: jsr pc,readdir beq restart / error - restart mov 4(r0),r4 / dp->d_namlen ! cmp r4,$bootlen / if (bootlen == dp->d_namlen) bne again / nope, go try next entry mov r0,r3 add $6,r3 / r3 = dp->d_name *** /sys/mdec/hkuboot.s.old Fri Dec 20 02:11:54 1991 --- /sys/mdec/hkuboot.s Tue Mar 10 18:10:09 1992 *************** *** 79,91 **** mov $bootnm, r1 mov $2,r0 / ROOTINO jsr pc,iget - mov $bootlen,r5 / len = strlen(pathnamecomponent) clr r2 / offset again: jsr pc,readdir beq restart / error - restart mov 4(r0),r4 / dp->d_namlen ! cmp r4,r5 / if (len == dp->d_namlen) bne again / nope, go try next entry mov r0,r3 add $6,r3 / r3 = dp->d_name --- 79,90 ---- mov $bootnm, r1 mov $2,r0 / ROOTINO jsr pc,iget clr r2 / offset again: jsr pc,readdir beq restart / error - restart mov 4(r0),r4 / dp->d_namlen ! cmp r4,$bootlen / if (bootlen == dp->d_namlen) bne again / nope, go try next entry mov r0,r3 add $6,r3 / r3 = dp->d_name *** /sys/mdec/hpuboot.s.old Wed Apr 24 13:08:15 1991 --- /sys/mdec/hpuboot.s Tue Mar 10 18:10:29 1992 *************** *** 73,85 **** mov $bootnm, r1 mov $2,r0 / ROOTINO jsr pc,iget - mov $bootlen,r5 / len = strlen(pathnamecomponent) clr r2 / offset again: jsr pc,readdir beq restart / error - restart mov 4(r0),r4 / dp->d_namlen ! cmp r4,r5 / if (len == dp->d_namlen) bne again / nope, go try next entry mov r0,r3 add $6,r3 / r3 = dp->d_name --- 73,84 ---- mov $bootnm, r1 mov $2,r0 / ROOTINO jsr pc,iget clr r2 / offset again: jsr pc,readdir beq restart / error - restart mov 4(r0),r4 / dp->d_namlen ! cmp r4,$bootlen / if (bootlen == dp->d_namlen) bne again / nope, go try next entry mov r0,r3 add $6,r3 / r3 = dp->d_name *** /sys/mdec/rauboot.s.old Wed Apr 24 13:08:18 1991 --- /sys/mdec/rauboot.s Tue Mar 10 18:11:06 1992 *************** *** 123,135 **** mov $bootnm, r1 mov $2,r0 / ROOTINO jsr pc,iget - mov $bootlen,r5 / len = strlen(pathnamecomponent) clr r2 / offset again: jsr pc,readdir beq restart / error - restart mov 4(r0),r4 / dp->d_namlen ! cmp r4,r5 / if (len == dp->d_namlen) bne again / nope, go try next entry mov r0,r3 add $6,r3 / r3 = dp->d_name --- 123,134 ---- mov $bootnm, r1 mov $2,r0 / ROOTINO jsr pc,iget clr r2 / offset again: jsr pc,readdir beq restart / error - restart mov 4(r0),r4 / dp->d_namlen ! cmp r4,$bootlen / if (bootlen == dp->d_namlen) bne again / nope, go try next entry mov r0,r3 add $6,r3 / r3 = dp->d_name *** /sys/mdec/rkuboot.s.old Wed Apr 24 13:08:22 1991 --- /sys/mdec/rkuboot.s Tue Mar 10 18:11:24 1992 *************** *** 71,83 **** mov $bootnm, r1 mov $2,r0 / ROOTINO jsr pc,iget - mov $bootlen,r5 / len = strlen(pathnamecomponent) clr r2 / offset again: jsr pc,readdir beq restart / error - restart mov 4(r0),r4 / dp->d_namlen ! cmp r4,r5 / if (len == dp->d_namlen) bne again / nope, go try next entry mov r0,r3 add $6,r3 / r3 = dp->d_name --- 71,82 ---- mov $bootnm, r1 mov $2,r0 / ROOTINO jsr pc,iget clr r2 / offset again: jsr pc,readdir beq restart / error - restart mov 4(r0),r4 / dp->d_namlen ! cmp r4,$bootlen / if (bootlen == dp->d_namlen) bne again / nope, go try next entry mov r0,r3 add $6,r3 / r3 = dp->d_name *** /sys/mdec/rluboot.s.old Wed Apr 24 13:08:33 1991 --- /sys/mdec/rluboot.s Tue Mar 10 18:11:43 1992 *************** *** 76,88 **** mov $bootnm, r1 mov $2,r0 / ROOTINO jsr pc,iget - mov $bootlen,r5 / len = strlen(pathnamecomponent) clr r2 / offset again: jsr pc,readdir beq restart / error - restart mov 4(r0),r4 / dp->d_namlen ! cmp r4,r5 / if (len == dp->d_namlen) bne again / nope, go try next entry mov r0,r3 add $6,r3 / r3 = dp->d_name --- 76,87 ---- mov $bootnm, r1 mov $2,r0 / ROOTINO jsr pc,iget clr r2 / offset again: jsr pc,readdir beq restart / error - restart mov 4(r0),r4 / dp->d_namlen ! cmp r4,$bootlen / if (bootlen == dp->d_namlen) bne again / nope, go try next entry mov r0,r3 add $6,r3 / r3 = dp->d_name *** /sys/mdec/rm03uboot.s.old Wed Apr 24 13:08:36 1991 --- /sys/mdec/rm03uboot.s Tue Mar 10 18:12:01 1992 *************** *** 75,87 **** mov $bootnm, r1 mov $2,r0 / ROOTINO jsr pc,iget - mov $bootlen,r5 / len = strlen(pathnamecomponent) clr r2 / offset again: jsr pc,readdir beq restart / error - restart mov 4(r0),r4 / dp->d_namlen ! cmp r4,r5 / if (len == dp->d_namlen) bne again / nope, go try next entry mov r0,r3 add $6,r3 / r3 = dp->d_name --- 75,86 ---- mov $bootnm, r1 mov $2,r0 / ROOTINO jsr pc,iget clr r2 / offset again: jsr pc,readdir beq restart / error - restart mov 4(r0),r4 / dp->d_namlen ! cmp r4,$bootlen / if (bootlen == dp->d_namlen) bne again / nope, go try next entry mov r0,r3 add $6,r3 / r3 = dp->d_name *** /sys/mdec/rm05uboot.s.old Wed Apr 24 13:08:46 1991 --- /sys/mdec/rm05uboot.s Tue Mar 10 18:12:18 1992 *************** *** 75,87 **** mov $bootnm, r1 mov $2,r0 / ROOTINO jsr pc,iget - mov $bootlen,r5 / len = strlen(pathnamecomponent) clr r2 / offset again: jsr pc,readdir beq restart / error - restart mov 4(r0),r4 / dp->d_namlen ! cmp r4,r5 / if (len == dp->d_namlen) bne again / nope, go try next entry mov r0,r3 add $6,r3 / r3 = dp->d_name --- 75,86 ---- mov $bootnm, r1 mov $2,r0 / ROOTINO jsr pc,iget clr r2 / offset again: jsr pc,readdir beq restart / error - restart mov 4(r0),r4 / dp->d_namlen ! cmp r4,$bootlen / if (bootlen == dp->d_namlen) bne again / nope, go try next entry mov r0,r3 add $6,r3 / r3 = dp->d_name *** /sys/mdec/si51uboot.s.old Wed Apr 24 13:08:49 1991 --- /sys/mdec/si51uboot.s Tue Mar 10 18:12:38 1992 *************** *** 74,86 **** mov $bootnm, r1 mov $2,r0 / ROOTINO jsr pc,iget - mov $bootlen,r5 / len = strlen(pathnamecomponent) clr r2 / offset again: jsr pc,readdir beq restart / error - restart mov 4(r0),r4 / dp->d_namlen ! cmp r4,r5 / if (len == dp->d_namlen) bne again / nope, go try next entry mov r0,r3 add $6,r3 / r3 = dp->d_name --- 74,85 ---- mov $bootnm, r1 mov $2,r0 / ROOTINO jsr pc,iget clr r2 / offset again: jsr pc,readdir beq restart / error - restart mov 4(r0),r4 / dp->d_namlen ! cmp r4,$bootlen / if (bootlen == dp->d_namlen) bne again / nope, go try next entry mov r0,r3 add $6,r3 / r3 = dp->d_name *** /sys/mdec/si94uboot.s.old Wed Apr 24 13:08:53 1991 --- /sys/mdec/si94uboot.s Tue Mar 10 18:12:56 1992 *************** *** 74,86 **** mov $bootnm, r1 mov $2,r0 / ROOTINO jsr pc,iget - mov $bootlen,r5 / len = strlen(pathnamecomponent) clr r2 / offset again: jsr pc,readdir beq restart / error - restart mov 4(r0),r4 / dp->d_namlen ! cmp r4,r5 / if (len == dp->d_namlen) bne again / nope, go try next entry mov r0,r3 add $6,r3 / r3 = dp->d_name --- 74,85 ---- mov $bootnm, r1 mov $2,r0 / ROOTINO jsr pc,iget clr r2 / offset again: jsr pc,readdir beq restart / error - restart mov 4(r0),r4 / dp->d_namlen ! cmp r4,$bootlen / if (bootlen == dp->d_namlen) bne again / nope, go try next entry mov r0,r3 add $6,r3 / r3 = dp->d_name *** /sys/mdec/si95uboot.s.old Wed Apr 24 13:09:02 1991 --- /sys/mdec/si95uboot.s Tue Mar 10 18:13:12 1992 *************** *** 73,85 **** mov $bootnm, r1 mov $2,r0 / ROOTINO jsr pc,iget - mov $bootlen,r5 / len = strlen(pathnamecomponent) clr r2 / offset again: jsr pc,readdir beq restart / error - restart mov 4(r0),r4 / dp->d_namlen ! cmp r4,r5 / if (len == dp->d_namlen) bne again / nope, go try next entry mov r0,r3 add $6,r3 / r3 = dp->d_name --- 73,84 ---- mov $bootnm, r1 mov $2,r0 / ROOTINO jsr pc,iget clr r2 / offset again: jsr pc,readdir beq restart / error - restart mov 4(r0),r4 / dp->d_namlen ! cmp r4,$bootlen / if (bootlen == dp->d_namlen) bne again / nope, go try next entry mov r0,r3 add $6,r3 / r3 = dp->d_name