summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/clock.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1998-03-30 09:56:58 +0000
committerphk <phk@FreeBSD.org>1998-03-30 09:56:58 +0000
commit9b703b14551addf9806978973e2ddc427d4908b4 (patch)
tree91f2de8432f719153d0de9465a9ebeee33c29077 /sys/i386/isa/clock.c
parentadd2782c4ec0d7c4447da2b33d1413a2754f8a3e (diff)
downloadFreeBSD-src-9b703b14551addf9806978973e2ddc427d4908b4.zip
FreeBSD-src-9b703b14551addf9806978973e2ddc427d4908b4.tar.gz
Eradicate the variable "time" from the kernel, using various measures.
"time" wasn't a atomic variable, so splfoo() protection were needed around any access to it, unless you just wanted the seconds part. Most uses of time.tv_sec now uses the new variable time_second instead. gettime() changed to getmicrotime(0. Remove a couple of unneeded splfoo() protections, the new getmicrotime() is atomic, (until Bruce sets a breakpoint in it). A couple of places needed random data, so use read_random() instead of mucking about with time which isn't random. Add a new nfs_curusec() function. Mark a couple of bogosities involving the now disappeard time variable. Update ffs_update() to avoid the weird "== &time" checks, by fixing the one remaining call that passwd &time as args. Change profiling in ncr.c to use ticks instead of time. Resolution is the same. Add new function "tvtohz()" to avoid the bogus "splfoo(), add time, call hzto() which subtracts time" sequences. Reviewed by: bde
Diffstat (limited to 'sys/i386/isa/clock.c')
-rw-r--r--sys/i386/isa/clock.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/i386/isa/clock.c b/sys/i386/isa/clock.c
index 6588165..1df24b7 100644
--- a/sys/i386/isa/clock.c
+++ b/sys/i386/isa/clock.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
- * $Id: clock.c,v 1.116 1998/03/14 03:11:50 tegge Exp $
+ * $Id: clock.c,v 1.117 1998/03/16 10:06:58 phk Exp $
*/
/*
@@ -237,12 +237,19 @@ clkintr(struct clockframe frame)
if ((timer0_prescaler_count += timer0_max_count)
>= hardclock_max_count) {
timer0_prescaler_count -= hardclock_max_count;
+#ifdef FIXME
+ /*
+ * XXX: This magic doesn't work, but It shouldn't be
+ * needed now anyway since we will not be able to
+ * aquire the i8254 if it is used for timecounting.
+ */
/*
* See microtime.s for this magic.
*/
time.tv_usec += (27465 * timer0_prescaler_count) >> 15;
if (time.tv_usec >= 1000000)
time.tv_usec -= 1000000;
+#endif
hardclock(&frame);
setdelayed();
timer0_max_count = hardclock_max_count;
@@ -844,7 +851,7 @@ inittodr(time_t base)
sec += tz.tz_minuteswest * 60 + (wall_cmos_clock ? adjkerntz : 0);
- y = time.tv_sec - sec;
+ y = time_second - sec;
if (y <= -2 || y >= 2) {
/* badly off, adjust it */
s = splclock();
@@ -873,7 +880,7 @@ resettodr()
return;
s = splclock();
- tm = time.tv_sec;
+ tm = time_second;
splx(s);
/* Disable RTC updates and interrupts. */
OpenPOWER on IntegriCloud