diff options
author | bde <bde@FreeBSD.org> | 1996-08-02 21:16:13 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1996-08-02 21:16:13 +0000 |
commit | 1cfe857c9e58f273e2440e88bd52dcc079c7b143 (patch) | |
tree | 468b09de3ff6a36f8aa2bdacf3048d0753491b51 /sys/i386 | |
parent | efc595aadd6311584f5d295bf3e954daefb1234d (diff) | |
download | FreeBSD-src-1cfe857c9e58f273e2440e88bd52dcc079c7b143.zip FreeBSD-src-1cfe857c9e58f273e2440e88bd52dcc079c7b143.tar.gz |
Eliminated i586_ctr_rate. Use i586_ctr_freq instead.
Changed i586_ctr_bias from long long to u_int. Only the low 32 bits
are used now that microtime uses a multiplication to do the scaling.
Previously the high 32 bits had to match those of rdtsc() to prevent
overflow traps and invalid timeval adjustments.
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/include/clock.h | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/sys/i386/include/clock.h b/sys/i386/include/clock.h index 0439363..f50da08 100644 --- a/sys/i386/include/clock.h +++ b/sys/i386/include/clock.h @@ -3,7 +3,7 @@ * Garrett Wollman, September 1994. * This file is in the public domain. * - * $Id: clock.h,v 1.14 1996/06/14 11:00:56 asami Exp $ + * $Id: clock.h,v 1.15 1996/07/30 19:26:55 bde Exp $ */ #ifndef _MACHINE_CLOCK_H_ @@ -21,7 +21,7 @@ */ #define CPU_CLOCKUPDATE(otime, ntime) \ do { \ - if(i586_ctr_rate) { \ + if (i586_ctr_freq != 0) { \ disable_intr(); \ i586_ctr_bias = i586_last_tick; \ *(otime) = *(ntime); \ @@ -40,7 +40,6 @@ #define I586_CTR_COMULTIPLIER_SHIFT 20 #define I586_CTR_MULTIPLIER_SHIFT 32 -#define I586_CTR_RATE_SHIFT 8 #if defined(KERNEL) && !defined(LOCORE) #include <sys/cdefs.h> @@ -57,12 +56,11 @@ extern int statclock_disable; extern int wall_cmos_clock; #if defined(I586_CPU) || defined(I686_CPU) +extern u_int i586_ctr_bias; extern u_int i586_ctr_comultiplier; extern u_int i586_ctr_freq; extern u_int i586_ctr_multiplier; -extern unsigned i586_ctr_rate; /* fixed point */ extern long long i586_last_tick; -extern long long i586_ctr_bias; extern unsigned long i586_avg_tick; #endif extern int timer0_max_count; @@ -77,11 +75,11 @@ cpu_thisticklen(u_long dflt) long long old; long len; - if (i586_ctr_rate) { + if (i586_ctr_freq != 0) { old = i586_last_tick; i586_last_tick = rdtsc(); - len = ((i586_last_tick - old) << I586_CTR_RATE_SHIFT) - / i586_ctr_rate; + len = ((i586_last_tick - old) * i586_ctr_multiplier) + >> I586_CTR_MULTIPLIER_SHIFT; i586_avg_tick = i586_avg_tick * 15 / 16 + len / 16; } return dflt; |