diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2003-12-18 20:06:16 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2003-12-18 20:06:16 +0000 |
commit | a02952ebdaba37a9997ba922bee62c3004170ba4 (patch) | |
tree | bdc794141da344b22de2008b26572c99925b1f2e /sys/arch/macppc | |
parent | 914623fd2826a14a3625099ede57a6d8cab61056 (diff) |
Fix for monotomic time, lasttb is now in sync with 'time'. ok otto@
Diffstat (limited to 'sys/arch/macppc')
-rw-r--r-- | sys/arch/macppc/macppc/clock.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/sys/arch/macppc/macppc/clock.c b/sys/arch/macppc/macppc/clock.c index 249836aa5d3..768f6743f96 100644 --- a/sys/arch/macppc/macppc/clock.c +++ b/sys/arch/macppc/macppc/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.11 2003/10/16 05:03:22 deraadt Exp $ */ +/* $OpenBSD: clock.c,v 1.12 2003/12/18 20:06:15 drahn Exp $ */ /* $NetBSD: clock.c,v 1.1 1996/09/30 16:34:40 ws Exp $ */ /* @@ -258,12 +258,6 @@ decr_intr(struct clockframe *frame) */ ppc_mtdec(nextevent - tb); - /* - * lasttb is used during microtime. Set it to the virtual - * start of this tick interval. - */ - lasttb = nexttimerevent - ticks_per_intr; - if (cpl & SPL_CLOCK) { tickspending += nticks; statspending += nstats; @@ -286,13 +280,19 @@ decr_intr(struct clockframe *frame) * Do softclock stuff only on the last iteration. */ frame->pri = s | SINT_CLOCK; - if (nticks > 1) - while (--nticks > 1) - hardclock(frame); + while (nticks > 1) { + /* sync lasttb with hardclock */ + lasttb += ticks_per_intr; + hardclock(frame); + nticks--; + } frame->pri = s; - if (nticks) + if (nticks) { + /* sync lasttb with hardclock */ + lasttb += ticks_per_intr; hardclock(frame); + } while (nstats-- > 0) statclock(frame); @@ -398,10 +398,9 @@ microtime(struct timeval *tvp) s = ppc_intr_disable(); tb = ppc_mftb(); - ticks = (tb - lasttb) * ns_per_tick; + ticks = ((tb - lasttb) * ns_per_tick) / 1000; *tvp = time; ppc_intr_enable(s); - ticks /= 1000; tvp->tv_usec += ticks; while (tvp->tv_usec >= 1000000) { tvp->tv_usec -= 1000000; |