386BSD 0.1 development
[unix-history] / usr / src / sys.386bsd / kern / kern_clock.c
index 3d2a6ac..af7f75b 100644 (file)
@@ -276,7 +276,7 @@ gatherstats(framep)
                if (curproc == NULL && CLKF_BASEPRI(framep))
                        cpstate = CP_IDLE;
 #ifdef GPROF
                if (curproc == NULL && CLKF_BASEPRI(framep))
                        cpstate = CP_IDLE;
 #ifdef GPROF
-               s = CLKF_PC(framep) - s_lowpc;
+               s = (u_long) CLKF_PC(framep) - (u_long) s_lowpc;
                if (profiling < 2 && s < s_textsize)
                        kcount[s / (HISTFRACTION * sizeof (*kcount))]++;
 #endif
                if (profiling < 2 && s < s_textsize)
                        kcount[s / (HISTFRACTION * sizeof (*kcount))]++;
 #endif
@@ -319,6 +319,12 @@ softclock(frame)
                splx(s);
                (*func)(arg, a);
        }
                splx(s);
                (*func)(arg, a);
        }
+
+       /*
+        * If no process to work with, we're finished.
+        */
+       if (curproc == 0) return;
+
        /*
         * If trapped user-mode and profiling, give it
         * a profiling tick.
        /*
         * If trapped user-mode and profiling, give it
         * a profiling tick.