Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/sommerfeld_i386mp_1]: src/sys/arch/i386 Call tsc_microset() on each cpu ...



details:   https://anonhg.NetBSD.org/src/rev/4450c74b3328
branches:  sommerfeld_i386mp_1
changeset: 482405:4450c74b3328
user:      sommerfeld <sommerfeld%NetBSD.org@localhost>
date:      Sun May 27 00:02:18 2001 +0000

description:
Call tsc_microset() on each cpu early in boot, so that microtime()
doesn't generate spurious crud the first time it's invoked.

diffstat:

 sys/arch/i386/i386/cpu.c  |   6 +++++-
 sys/arch/i386/isa/clock.c |  13 +++++++++++--
 2 files changed, 16 insertions(+), 3 deletions(-)

diffs (54 lines):

diff -r a993638dfac7 -r 4450c74b3328 sys/arch/i386/i386/cpu.c
--- a/sys/arch/i386/i386/cpu.c  Sat May 26 22:13:08 2001 +0000
+++ b/sys/arch/i386/i386/cpu.c  Sun May 27 00:02:18 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.1.2.21 2001/05/07 21:15:04 sommerfeld Exp $ */
+/* $NetBSD: cpu.c,v 1.1.2.22 2001/05/27 00:02:18 sommerfeld Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -534,6 +534,10 @@
        s = splhigh();
        enable_intr();
        printf("%s: CPU %d running\n",ci->ci_dev->dv_xname, cpu_number());
+#if defined(I586_CPU) || defined(I686_CPU)
+       if (ci->ci_feature_flags & CPUID_TSC)
+               tsc_microset(ci);
+#endif
        microtime(&ci->ci_schedstate.spc_runtime);
        splx(s);
 }
diff -r a993638dfac7 -r 4450c74b3328 sys/arch/i386/isa/clock.c
--- a/sys/arch/i386/isa/clock.c Sat May 26 22:13:08 2001 +0000
+++ b/sys/arch/i386/isa/clock.c Sun May 27 00:02:18 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: clock.c,v 1.63.2.5 2001/05/26 22:13:11 sommerfeld Exp $        */
+/*     $NetBSD: clock.c,v 1.63.2.6 2001/05/27 00:02:18 sommerfeld Exp $        */
 
 /*-
  * Copyright (c) 1993, 1994 Charles M. Hannum.
@@ -747,7 +747,10 @@
        mc_todregs rtclk;
        struct clock_ymdhms dt;
        int s;
-
+#if defined(I586_CPU) || defined(I686_CPU)
+       struct cpu_info *ci = curcpu();
+       extern struct timeval tsc_time;
+#endif
        /*
         * We mostly ignore the suggested time and go for the RTC clock time
         * stored in the CMOS RAM.  If the time can't be obtained from the
@@ -805,6 +808,12 @@
 #ifdef DEBUG_CLOCK
        printf("readclock: %ld (%ld)\n", time.tv_sec, base);
 #endif
+#if defined(I586_CPU) || defined(I686_CPU)
+       if (ci->ci_feature_flags & CPUID_TSC) {
+               tsc_time = time;
+               tsc_microset(ci);
+       }
+#endif
 
        if (base < time.tv_sec - 5*SECYR)
                printf("WARNING: file system time much less than clock time\n");



Home | Main Index | Thread Index | Old Index