Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc convert fpulock into fpu_mtx.



details:   https://anonhg.NetBSD.org/src/rev/ffe394570a9e
branches:  trunk
changeset: 751143:ffe394570a9e
user:      mrg <mrg%NetBSD.org@localhost>
date:      Tue Jan 26 03:06:01 2010 +0000

description:
convert fpulock into fpu_mtx.

diffstat:

 sys/arch/sparc/include/proc.h  |  12 ++++++------
 sys/arch/sparc/sparc/machdep.c |   9 ++++++---
 2 files changed, 12 insertions(+), 9 deletions(-)

diffs (76 lines):

diff -r d07053b9724e -r ffe394570a9e sys/arch/sparc/include/proc.h
--- a/sys/arch/sparc/include/proc.h     Tue Jan 26 01:06:23 2010 +0000
+++ b/sys/arch/sparc/include/proc.h     Tue Jan 26 03:06:01 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: proc.h,v 1.16 2009/11/21 04:04:07 rmind Exp $ */
+/*     $NetBSD: proc.h,v 1.17 2010/01/26 03:06:01 mrg Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -66,17 +66,17 @@
 /*
  * FPU context switch lock
  * Prevent interrupts that grab the kernel lock
+ * XXX mrg: remove (s) argument
  */
-extern struct simplelock       fpulock;
+extern kmutex_t fpu_mtx;
 
 #define FPU_LOCK(s)            do {    \
-       s = splclock();                 \
-       simple_lock(&fpulock);          \
+       (void)&(s);                     \
+       mutex_enter(&fpu_mtx);          \
 } while (/* CONSTCOND */ 0)
 
 #define FPU_UNLOCK(s)          do {    \
-       simple_unlock(&fpulock);        \
-       splx(s);                        \
+       mutex_exit(&fpu_mtx);           \
 } while (/* CONSTCOND */ 0)
 
 #endif /* _SPARC_PROC_H_ */
diff -r d07053b9724e -r ffe394570a9e sys/arch/sparc/sparc/machdep.c
--- a/sys/arch/sparc/sparc/machdep.c    Tue Jan 26 01:06:23 2010 +0000
+++ b/sys/arch/sparc/sparc/machdep.c    Tue Jan 26 03:06:01 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.300 2010/01/03 23:03:21 mrg Exp $ */
+/*     $NetBSD: machdep.c,v 1.301 2010/01/26 03:06:01 mrg Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.300 2010/01/03 23:03:21 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.301 2010/01/26 03:06:01 mrg Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_compat_sunos.h"
@@ -102,6 +102,7 @@
 #include <sys/ucontext.h>
 #include <sys/simplelock.h>
 #include <sys/module.h>
+#include <sys/mutex.h>
 
 #include <uvm/uvm.h>           /* we use uvm.kernel_object */
 
@@ -139,7 +140,7 @@
 
 int    physmem;
 
-struct simplelock fpulock = SIMPLELOCK_INITIALIZER;
+kmutex_t fpu_mtx;
 
 /*
  * safepri is a safe priority for sleep to set for a spin-wait
@@ -338,6 +339,8 @@
        printf("avail memory = %s\n", pbuf);
 
        pmap_redzone();
+
+       mutex_init(&fpu_mtx, MUTEX_DEFAULT, IPL_SCHED);
 }
 
 /*



Home | Main Index | Thread Index | Old Index