Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/alpha/alpha As a temporary measure, protect microti...



details:   https://anonhg.NetBSD.org/src/rev/3812848e623b
branches:  trunk
changeset: 499411:3812848e623b
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Nov 19 19:16:44 2000 +0000

description:
As a temporary measure, protect microtime() with a simple lock.
XXX Needs to be rewritten from scratch.

diffstat:

 sys/arch/alpha/alpha/machdep.c |  16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diffs (50 lines):

diff -r cd9612c11d78 -r 3812848e623b sys/arch/alpha/alpha/machdep.c
--- a/sys/arch/alpha/alpha/machdep.c    Sun Nov 19 18:48:44 2000 +0000
+++ b/sys/arch/alpha/alpha/machdep.c    Sun Nov 19 19:16:44 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.221 2000/09/24 12:32:32 jdolecek Exp $ */
+/* $NetBSD: machdep.c,v 1.222 2000/11/19 19:16:44 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.221 2000/09/24 12:32:32 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.222 2000/11/19 19:16:44 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1903,13 +1903,21 @@
  * to which tvp points.  Unfortunately, we can't read the hardware registers.
  * We guarantee that the time will be greater than the value obtained by a
  * previous call.
+ *
+ * XXX PLEASE REWRITE ME TO USE THE CYCLE COUNTER AND DEAL WITH
+ * XXX MULTIPLE CPUs IN A SANE WAY!
  */
 void
 microtime(tvp)
        register struct timeval *tvp;
 {
-       int s = splclock();
        static struct timeval lasttime;
+       static struct simplelock microtime_slock =
+           SIMPLELOCK_INITIALIZER;
+       int s;
+
+       s = splclock();
+       simple_lock(&microtime_slock);
 
        *tvp = time;
 #ifdef notdef
@@ -1926,6 +1934,8 @@
                tvp->tv_usec -= 1000000;
        }
        lasttime = *tvp;
+
+       simple_unlock(&microtime_slock);
        splx(s);
 }
 



Home | Main Index | Thread Index | Old Index