diff options
author | Jason Wright <jason@cvs.openbsd.org> | 2003-02-22 23:50:38 +0000 |
---|---|---|
committer | Jason Wright <jason@cvs.openbsd.org> | 2003-02-22 23:50:38 +0000 |
commit | ea39c95f66c09728e56b7476aeb02d0a5bbb6d21 (patch) | |
tree | 7c9e09d3b8780009f2f973bde96e579db9cc6dcf /sys/arch | |
parent | 4fa578c028dc2117a0b55b1bc48ec93bfc777e50 (diff) |
always use %tick based microtime (ie. remove conditional for counter-timer)
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/sparc64/sparc64/clock.c | 47 |
1 files changed, 16 insertions, 31 deletions
diff --git a/sys/arch/sparc64/sparc64/clock.c b/sys/arch/sparc64/sparc64/clock.c index a757e1374f6..ce2b0a1e01a 100644 --- a/sys/arch/sparc64/sparc64/clock.c +++ b/sys/arch/sparc64/sparc64/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.15 2003/02/17 01:29:20 henric Exp $ */ +/* $OpenBSD: clock.c,v 1.16 2003/02/22 23:50:37 jason Exp $ */ /* $NetBSD: clock.c,v 1.41 2001/07/24 19:29:25 eeh Exp $ */ /* @@ -1080,36 +1080,21 @@ void microtime(tvp) struct timeval *tvp; { - if (timerreg_4u.t_timer == NULL) { - int s; - u_int64_t tick; - - s = splhigh(); - __asm __volatile("rd %%tick, %0" : "=r" (tick) :); - tick &= TICK_TICKS; - tick -= lasttick; - tvp->tv_sec = time.tv_sec; - tvp->tv_usec = time.tv_usec; - splx(s); - - tick = (tick * USECPERSEC) / cpu_clockrate; - - tvp->tv_sec += tick / USECPERSEC; - tvp->tv_usec += tick % USECPERSEC; - } else { - struct timeval t1, t2; - int64_t t_tick; - - do { - - t1 = time; - t_tick = timerreg_4u.t_timer->t_count; - t2 = time; - } while (t1.tv_sec != t2.tv_sec || t1.tv_usec != t2.tv_usec); - - tvp->tv_sec = t1.tv_sec; - tvp->tv_usec = t1.tv_usec + t_tick; - } + int s; + u_int64_t tick; + + s = splhigh(); + __asm __volatile("rd %%tick, %0" : "=r" (tick) :); + tick &= TICK_TICKS; + tick -= lasttick; + tvp->tv_sec = time.tv_sec; + tvp->tv_usec = time.tv_usec; + splx(s); + + tick = (tick * USECPERSEC) / cpu_clockrate; + + tvp->tv_sec += tick / USECPERSEC; + tvp->tv_usec += tick % USECPERSEC; while (tvp->tv_usec >= USECPERSEC) { tvp->tv_sec++; |