Source-Changes-HG archive

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

[src/trunk]: src/sys Let each platform typedef the new __cpu_simple_lock_t, w...



details:   https://anonhg.NetBSD.org/src/rev/eb9ebe09130b
branches:  trunk
changeset: 485608:eb9ebe09130b
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue May 02 04:41:04 2000 +0000

description:
Let each platform typedef the new __cpu_simple_lock_t, which should
be the most efficient type used for the atomic operations in the
simplelock structure, and should also be __volatile.

diffstat:

 sys/arch/alpha/include/lock.h   |  20 +++++++++++---------
 sys/arch/arm32/include/lock.h   |   4 +++-
 sys/arch/i386/include/lock.h    |  20 +++++++++++---------
 sys/arch/m68k/include/lock.h    |   4 +++-
 sys/arch/mips/include/lock.h    |   4 +++-
 sys/arch/pc532/include/lock.h   |   4 +++-
 sys/arch/powerpc/include/lock.h |   4 +++-
 sys/arch/sh3/include/lock.h     |   4 +++-
 sys/arch/sparc/include/lock.h   |  21 ++++++++++++---------
 sys/arch/sparc64/include/lock.h |  21 ++++++++++++---------
 sys/arch/vax/include/lock.h     |  13 +++++++------
 sys/sys/lock.h                  |   4 ++--
 12 files changed, 73 insertions(+), 50 deletions(-)

diffs (truncated from 435 to 300 lines):

diff -r 48ce511e045e -r eb9ebe09130b sys/arch/alpha/include/lock.h
--- a/sys/arch/alpha/include/lock.h     Tue May 02 04:32:33 2000 +0000
+++ b/sys/arch/alpha/include/lock.h     Tue May 02 04:41:04 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lock.h,v 1.5 2000/04/29 03:31:46 thorpej Exp $ */
+/* $NetBSD: lock.h,v 1.6 2000/05/02 04:41:06 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -44,20 +44,22 @@
 #ifndef _ALPHA_LOCK_H_
 #define        _ALPHA_LOCK_H_
 
+typedef        __volatile int          __cpu_simple_lock_t;
+
 #define        __SIMPLELOCK_LOCKED     1
 #define        __SIMPLELOCK_UNLOCKED   0
 
-static __inline void __cpu_simple_lock_init __P((__volatile int *))
+static __inline void __cpu_simple_lock_init __P((__cpu_simple_lock_t *))
        __attribute__((__unused__));
-static __inline void __cpu_simple_lock __P((__volatile int *))
+static __inline void __cpu_simple_lock __P((__cpu_simple_lock_t *))
        __attribute__((__unused__));
-static __inline int __cpu_simple_lock_try __P((__volatile int *))
+static __inline int __cpu_simple_lock_try __P((__cpu_simple_lock_t *))
        __attribute__((__unused__));
-static __inline void __cpu_simple_unlock __P((__volatile int *))
+static __inline void __cpu_simple_unlock __P((__cpu_simple_lock_t *))
        __attribute__((__unused__));
 
 static __inline void
-__cpu_simple_lock_init(__volatile int *alp)
+__cpu_simple_lock_init(__cpu_simple_lock_t *alp)
 {
 
        __asm __volatile(
@@ -69,7 +71,7 @@
 }
 
 static __inline void
-__cpu_simple_lock(__volatile int *alp)
+__cpu_simple_lock(__cpu_simple_lock_t *alp)
 {
        unsigned long t0;
 
@@ -100,7 +102,7 @@
 }
 
 static __inline int
-__cpu_simple_lock_try(__volatile int *alp)
+__cpu_simple_lock_try(__cpu_simple_lock_t *alp)
 {
        unsigned long t0, v0;
 
@@ -126,7 +128,7 @@
 }
 
 static __inline void
-__cpu_simple_unlock(__volatile int *alp)
+__cpu_simple_unlock(__cpu_simple_lock_t *alp)
 {
 
        __asm __volatile(
diff -r 48ce511e045e -r eb9ebe09130b sys/arch/arm32/include/lock.h
--- a/sys/arch/arm32/include/lock.h     Tue May 02 04:32:33 2000 +0000
+++ b/sys/arch/arm32/include/lock.h     Tue May 02 04:41:04 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lock.h,v 1.1 2000/04/29 03:31:47 thorpej Exp $ */
+/*     $NetBSD: lock.h,v 1.2 2000/05/02 04:41:06 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -43,6 +43,8 @@
 #ifndef _ARM32_LOCK_H_
 #define        _ARM32_LOCK_H_
 
+typedef        int             __cpu_simple_lock_t;
+
 #define        __SIMPLELOCK_LOCKED     1
 #define        __SIMPLELOCK_UNLOCKED   0
 
diff -r 48ce511e045e -r eb9ebe09130b sys/arch/i386/include/lock.h
--- a/sys/arch/i386/include/lock.h      Tue May 02 04:32:33 2000 +0000
+++ b/sys/arch/i386/include/lock.h      Tue May 02 04:41:04 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lock.h,v 1.3 2000/04/29 19:39:51 thorpej Exp $ */
+/*     $NetBSD: lock.h,v 1.4 2000/05/02 04:41:06 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -43,27 +43,29 @@
 #ifndef _I386_LOCK_H_
 #define        _I386_LOCK_H_
 
+typedef        __volatile int          __cpu_simple_lock_t;
+
 #define        __SIMPLELOCK_LOCKED     1
 #define        __SIMPLELOCK_UNLOCKED   0
 
-static __inline void __cpu_simple_lock_init __P((__volatile int *))
+static __inline void __cpu_simple_lock_init __P((__cpu_simple_lock_t *))
        __attribute__((__unused__));
-static __inline void __cpu_simple_lock __P((__volatile int *))
+static __inline void __cpu_simple_lock __P((__cpu_simple_lock_t *))
        __attribute__((__unused__));
-static __inline int __cpu_simple_lock_try __P((__volatile int *))
+static __inline int __cpu_simple_lock_try __P((__cpu_simple_lock_t *))
        __attribute__((__unused__));
-static __inline void __cpu_simple_unlock __P((__volatile int *)) 
+static __inline void __cpu_simple_unlock __P((__cpu_simple_lock_t *)) 
        __attribute__((__unused__));
 
 static __inline void
-__cpu_simple_lock_init(__volatile int *alp)
+__cpu_simple_lock_init(__cpu_simple_lock_t *alp)
 {
 
        *alp = __SIMPLELOCK_UNLOCKED;
 }
 
 static __inline void
-__cpu_simple_lock(__volatile int *alp)
+__cpu_simple_lock(__cpu_simple_lock_t *alp)
 {
        int __val = __SIMPLELOCK_LOCKED;
 
@@ -75,7 +77,7 @@
 }
 
 static __inline int
-__cpu_simple_lock_try(__volatile int *alp)
+__cpu_simple_lock_try(__cpu_simple_lock_t *alp)
 {
        int __val = __SIMPLELOCK_LOCKED;
 
@@ -87,7 +89,7 @@
 }
 
 void
-__cpu_simple_unlock(__volatile int *alp)
+__cpu_simple_unlock(__cpu_simple_lock_t *alp)
 {
 
        *alp = __SIMPLELOCK_UNLOCKED;
diff -r 48ce511e045e -r eb9ebe09130b sys/arch/m68k/include/lock.h
--- a/sys/arch/m68k/include/lock.h      Tue May 02 04:32:33 2000 +0000
+++ b/sys/arch/m68k/include/lock.h      Tue May 02 04:41:04 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lock.h,v 1.1 2000/04/29 03:31:50 thorpej Exp $ */
+/*     $NetBSD: lock.h,v 1.2 2000/05/02 04:41:07 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -43,6 +43,8 @@
 #ifndef _M68K_LOCK_H_
 #define        _M68K_LOCK_H_
 
+typedef        __volatile int          __cpu_simple_lock_t;
+
 #define        __SIMPLELOCK_LOCKED     1
 #define        __SIMPLELOCK_UNLOCKED   0
 
diff -r 48ce511e045e -r eb9ebe09130b sys/arch/mips/include/lock.h
--- a/sys/arch/mips/include/lock.h      Tue May 02 04:32:33 2000 +0000
+++ b/sys/arch/mips/include/lock.h      Tue May 02 04:41:04 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lock.h,v 1.1 2000/04/29 03:31:51 thorpej Exp $ */
+/*     $NetBSD: lock.h,v 1.2 2000/05/02 04:41:07 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -43,6 +43,8 @@
 #ifndef _MIPS_LOCK_H_
 #define        _MIPS_LOCK_H_
 
+typedef        __volatile int          __cpu_simple_lock_t;
+
 #define        __SIMPLELOCK_LOCKED     1
 #define        __SIMPLELOCK_UNLOCKED   0
 
diff -r 48ce511e045e -r eb9ebe09130b sys/arch/pc532/include/lock.h
--- a/sys/arch/pc532/include/lock.h     Tue May 02 04:32:33 2000 +0000
+++ b/sys/arch/pc532/include/lock.h     Tue May 02 04:41:04 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lock.h,v 1.1 2000/04/29 03:31:53 thorpej Exp $ */
+/*     $NetBSD: lock.h,v 1.2 2000/05/02 04:41:08 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -43,6 +43,8 @@
 #ifndef _PC532_LOCK_H_
 #define        _PC532_LOCK_H_
 
+typedef        __volatile int          __cpu_simple_lock_t;
+
 #define        __SIMPLELOCK_LOCKED     1
 #define        __SIMPLELOCK_UNLOCKED   0
 
diff -r 48ce511e045e -r eb9ebe09130b sys/arch/powerpc/include/lock.h
--- a/sys/arch/powerpc/include/lock.h   Tue May 02 04:32:33 2000 +0000
+++ b/sys/arch/powerpc/include/lock.h   Tue May 02 04:41:04 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lock.h,v 1.1 2000/04/29 03:31:54 thorpej Exp $ */
+/*     $NetBSD: lock.h,v 1.2 2000/05/02 04:41:10 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -43,6 +43,8 @@
 #ifndef _POWERPC_LOCK_H_
 #define        _POWERPC_LOCK_H_
 
+typedef        __volatile int          __cpu_simple_lock_t;
+
 #define        __SIMPLELOCK_LOCKED     1
 #define        __SIMPLELOCK_UNLOCKED   0
 
diff -r 48ce511e045e -r eb9ebe09130b sys/arch/sh3/include/lock.h
--- a/sys/arch/sh3/include/lock.h       Tue May 02 04:32:33 2000 +0000
+++ b/sys/arch/sh3/include/lock.h       Tue May 02 04:41:04 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lock.h,v 1.1 2000/04/29 03:31:54 thorpej Exp $ */
+/*     $NetBSD: lock.h,v 1.2 2000/05/02 04:41:10 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -43,6 +43,8 @@
 #ifndef _SH3_LOCK_H_
 #define        _SH3_LOCK_H_
 
+typedef        __volatile int          __cpu_simple_lock_t;
+
 #define        __SIMPLELOCK_LOCKED     1
 #define        __SIMPLELOCK_UNLOCKED   0
 
diff -r 48ce511e045e -r eb9ebe09130b sys/arch/sparc/include/lock.h
--- a/sys/arch/sparc/include/lock.h     Tue May 02 04:32:33 2000 +0000
+++ b/sys/arch/sparc/include/lock.h     Tue May 02 04:41:04 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lock.h,v 1.8 2000/04/30 22:15:30 pk Exp $ */
+/*     $NetBSD: lock.h,v 1.9 2000/05/02 04:41:11 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -47,6 +47,9 @@
  * The value for __SIMPLELOCK_LOCKED is what ldstub() naturally stores
  * `lock_data' given its address (and the fact that SPARC is big-endian).
  */
+
+typedef        __volatile int          __cpu_simple_lock_t;
+
 #define        __SIMPLELOCK_LOCKED     0xff000000
 #define        __SIMPLELOCK_UNLOCKED   0
 
@@ -63,24 +66,24 @@
        __v;                                                            \
 })
 
-static __inline void __cpu_simple_lock_init __P((__volatile int *))
+static __inline void __cpu_simple_lock_init __P((__cpu_simple_lock_t *))
        __attribute__((__unused__));
-static __inline void __cpu_simple_lock __P((__volatile int *))
+static __inline void __cpu_simple_lock __P((__cpu_simple_lock_t *))
        __attribute__((__unused__));
-static __inline int __cpu_simple_lock_try __P((__volatile int *))
+static __inline int __cpu_simple_lock_try __P((__cpu_simple_lock_t *))
        __attribute__((__unused__));
-static __inline void __cpu_simple_unlock __P((__volatile int *))
+static __inline void __cpu_simple_unlock __P((__cpu_simple_lock_t *))
        __attribute__((__unused__));
 
 static __inline void
-__cpu_simple_lock_init(__volatile int *alp)
+__cpu_simple_lock_init(__cpu_simple_lock_t *alp)
 {
 
        *alp = __SIMPLELOCK_UNLOCKED;
 }
 
 static __inline void
-__cpu_simple_lock(__volatile int *alp)
+__cpu_simple_lock(__cpu_simple_lock_t *alp)
 {
 
        /*
@@ -97,14 +100,14 @@
 }
 
 static __inline int
-__cpu_simple_lock_try(__volatile int *alp)
+__cpu_simple_lock_try(__cpu_simple_lock_t *alp)
 {
 
        return (__ldstub(alp) == __SIMPLELOCK_UNLOCKED);
 }
 
 static __inline void
-__cpu_simple_unlock(__volatile int *alp)
+__cpu_simple_unlock(__cpu_simple_lock_t *alp)
 {



Home | Main Index | Thread Index | Old Index