diff options
author | phk <phk@FreeBSD.org> | 1998-02-20 16:36:17 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1998-02-20 16:36:17 +0000 |
commit | 044e1e629691b102791a17fc6db270846b71b01c (patch) | |
tree | 73eeeac34c8a9254ecd3686eaa03c76379171a5c /sys/i386/isa/random_machdep.c | |
parent | fba9e5d6630c11aef2f66bef4dd7fbf45179be87 (diff) | |
download | FreeBSD-src-044e1e629691b102791a17fc6db270846b71b01c.zip FreeBSD-src-044e1e629691b102791a17fc6db270846b71b01c.tar.gz |
Replace TOD clock code with more systematic approach.
Highlights:
* Simple model for underlying hardware.
* Hardware basis for timekeeping can be changed on the fly.
* Only one hardware clock responsible for TOD keeping.
* Provides a real nanotime() function.
* Time granularity: .232E-18 seconds.
* Frequency granularity: .238E-12 s/s
* Frequency adjustment is continuous in time.
* Less overhead for frequency adjustment.
* Improves xntpd performance.
Reviewed by: bde, bde, bde
Diffstat (limited to 'sys/i386/isa/random_machdep.c')
-rw-r--r-- | sys/i386/isa/random_machdep.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/sys/i386/isa/random_machdep.c b/sys/i386/isa/random_machdep.c index f066949..7fd8364 100644 --- a/sys/i386/isa/random_machdep.c +++ b/sys/i386/isa/random_machdep.c @@ -1,7 +1,7 @@ /* * random_machdep.c -- A strong random number generator * - * $Id: random_machdep.c,v 1.19 1997/10/28 15:58:13 bde Exp $ + * $Id: random_machdep.c,v 1.20 1997/12/26 20:42:11 phk Exp $ * * Version 0.95, last modified 18-Oct-95 * @@ -190,21 +190,8 @@ add_timer_randomness(struct random_bucket *r, struct timer_rand_state *state, u_int nbits; u_int32_t time; -#if defined(I586_CPU) || defined(I686_CPU) - if (tsc_freq != 0) { - num ^= (u_int32_t) rdtsc() << 16; - r->entropy_count += 2; - } else { -#endif - disable_intr(); - outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH); - num ^= inb(TIMER_CNTR0) << 16; - num ^= inb(TIMER_CNTR0) << 24; - enable_intr(); - r->entropy_count += 2; -#if defined(I586_CPU) || defined(I686_CPU) - } -#endif + num ^= timecounter->get_timecount() << 16; + r->entropy_count += 2; time = ticks; |