Subject: delay() doesn't check for 0 parameter Index: sys/pdp/mch_xxx.s 2.11BSD Description: The delay routine does not check for a count of zero being passed. This results in a delay of approximately 65536*65536 microseconds - on an 11/70 this is about 4200 seconds, obviously not what was intended to be a short delay. Repeat-By: This was noticed when a 'panic("sleep");' occurred, the system went to sync the disc buffers and then sat in delay() for a long long time because the first iteration in the loop passes a count of 0L to delay(). Fix: Apply the following patch to mch_xxx.s and rebuild the kernel. The extra space taken by the "beq" was compensated for by moving the 'noop' entry point to the 'rts' of the 'delay' routine. ------------------------------------------------------------------------- *** /sys/pdp/mch_xxx.s.old Wed Aug 15 23:31:32 1990 --- /sys/pdp/mch_xxx.s Wed Oct 23 07:55:11 1991 *************** *** 16,26 **** * happen between a pair of spl's in C. We use noop rather than inserting * meaningless instructions between the spl's to prevent any future C * optimizer `improvements' from causing problems. ! */ ! ENTRY(noop) ! rts pc / do absolutely nothing ! ! /* * delay(usec) * long usec; * --- 16,22 ---- * happen between a pair of spl's in C. We use noop rather than inserting * meaningless instructions between the spl's to prevent any future C * optimizer `improvements' from causing problems. ! * * delay(usec) * long usec; * *************** *** 32,37 **** --- 28,34 ---- mov 2(sp),r0 / r0 = hiint(usec) mov 4(sp),r1 / r1 = loint(usec) ashc $1,r0 / sob's ~= 1/2 micro second, + beq 2f / oops, got passed a delay of 0L-leave tst r1 /* * If the low int of the loop counter is zero, the double sob loop *************** *** 43,49 **** 1: sob r1,1b / sit on our hands for a while ... sob r0,1b ! 9: rts pc /* --- 40,47 ---- 1: sob r1,1b / sit on our hands for a while ... sob r0,1b ! 2: ! ENTRY(noop) rts pc /*