sun merge
[unix-history] / usr / src / sys / kern / kern_clock.c
index 4281dcb..6769872 100644 (file)
@@ -1,4 +1,7 @@
-/*     kern_clock.c    4.46    82/12/09        */
+/*     kern_clock.c    4.48    82/12/17        */
+
+#include "../machine/reg.h"
+#include "../machine/psl.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
 #include "../h/user.h"
 #include "../h/kernel.h"
 #include "../h/proc.h"
 #include "../h/user.h"
 #include "../h/kernel.h"
 #include "../h/proc.h"
-#include "../h/psl.h"
 #include "../h/vm.h"
 #include "../h/text.h"
 #include "../h/vm.h"
 #include "../h/text.h"
-#ifdef vax
-#include "../vax/mtpr.h"
-#endif
 #ifdef MUSH
 #include "../h/quota.h"
 #include "../h/share.h"
 #endif
 
 #ifdef MUSH
 #include "../h/quota.h"
 #include "../h/share.h"
 #endif
 
+#ifdef vax
+#include "../vax/mtpr.h"
+#endif
+
+#
 /*
  * Clock handling routines.
  *
 /*
  * Clock handling routines.
  *
@@ -72,6 +76,10 @@ hardclock(regs)
        register struct proc *p;
        register int s, cpstate;
 
        register struct proc *p;
        register int s, cpstate;
 
+#ifdef sun
+       if (USERMODE(ps))               /* aston needs ar0 */
+               u.u_ar0 = &regs.r_r0;
+#endif
        /*
         * Update real-time timeout queue.
         * At front of queue are some number of events which are ``due''.
        /*
         * Update real-time timeout queue.
         * At front of queue are some number of events which are ``due''.
@@ -227,12 +235,10 @@ softclock(pc, ps)
 {
 #endif
 #ifdef sun
 {
 #endif
 #ifdef sun
-softclock(sirret, regs)
-       caddr_t sirreg;
-       struct regs regs;
+softclock()
 {
 {
-       int ps = regs.r_sr;
-       caddr_t pc = (caddr_t)regs.r_pc;
+       int ps = u.u_ar0[PS];
+       caddr_t pc = (caddr_t)u.u_ar0[PC];
 #endif
 
        for (;;) {
 #endif
 
        for (;;) {
@@ -283,7 +289,8 @@ timeout(fun, arg, tim)
        pnew->c_arg = arg;
        pnew->c_func = fun;
        for (p1 = &calltodo; (p2 = p1->c_next) && p2->c_time < t; p1 = p2)
        pnew->c_arg = arg;
        pnew->c_func = fun;
        for (p1 = &calltodo; (p2 = p1->c_next) && p2->c_time < t; p1 = p2)
-               t -= p2->c_time;
+               if (p2->c_time > 0)
+                       t -= p2->c_time;
        p1->c_next = pnew;
        pnew->c_next = p2;
        pnew->c_time = t;
        p1->c_next = pnew;
        pnew->c_next = p2;
        pnew->c_time = t;