summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2013-05-21 20:05:31 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2013-05-21 20:05:31 +0000
commit1223d06696f7e28ea88bca80018594fdcd57b172 (patch)
treee341da38c545b15b66d9e7a68c2b72d4935f1a68 /sys/arch
parent1fb7bca1316e90db7b342fe0821eadb80b983d9f (diff)
remove unused cpu_lock code (where it is truly unused). it is not
part of the future we have planned. middling ok from a few
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/alpha/include/lock.h90
-rw-r--r--sys/arch/amd64/include/lock.h62
-rw-r--r--sys/arch/hppa64/include/lock.h41
-rw-r--r--sys/arch/i386/i386/lock_machdep.c56
-rw-r--r--sys/arch/i386/include/lock.h61
-rw-r--r--sys/arch/m68k/include/lock.h42
-rw-r--r--sys/arch/mips64/include/lock.h48
-rw-r--r--sys/arch/powerpc/include/lock.h67
-rw-r--r--sys/arch/sh/include/lock.h42
-rw-r--r--sys/arch/sparc/include/lock.h45
-rw-r--r--sys/arch/sparc64/include/lock.h48
-rw-r--r--sys/arch/vax/include/lock.h48
12 files changed, 12 insertions, 638 deletions
diff --git a/sys/arch/alpha/include/lock.h b/sys/arch/alpha/include/lock.h
index 709ecd7c6cd..cec638a8adb 100644
--- a/sys/arch/alpha/include/lock.h
+++ b/sys/arch/alpha/include/lock.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: lock.h,v 1.3 2011/03/23 16:54:34 pirofti Exp $ */
+/* $OpenBSD: lock.h,v 1.4 2013/05/21 20:05:30 tedu Exp $ */
/* $NetBSD: lock.h,v 1.16 2001/12/17 23:34:57 thorpej Exp $ */
/*-
@@ -38,94 +38,6 @@
#ifndef _MACHINE_LOCK_H_
#define _MACHINE_LOCK_H_
-typedef __volatile int __cpu_simple_lock_t;
-
-#define __SIMPLELOCK_LOCKED 1
-#define __SIMPLELOCK_UNLOCKED 0
-
-static __inline void
-__cpu_simple_lock_init(__cpu_simple_lock_t *alp)
-{
-
- __asm __volatile(
- "# BEGIN __cpu_simple_lock_init\n"
- " stl $31, %0 \n"
- " mb \n"
- " # END __cpu_simple_lock_init"
- : "=m" (*alp));
-}
-
-static __inline void
-__cpu_simple_lock(__cpu_simple_lock_t *alp)
-{
- unsigned long t0;
-
- /*
- * Note, if we detect that the lock is held when
- * we do the initial load-locked, we spin using
- * a non-locked load to save the coherency logic
- * some work.
- */
-
- __asm __volatile(
- "# BEGIN __cpu_simple_lock\n"
- "1: ldl_l %0, %3 \n"
- " bne %0, 2f \n"
- " bis $31, %2, %0 \n"
- " stl_c %0, %1 \n"
- " beq %0, 3f \n"
- " mb \n"
- " br 4f \n"
- "2: ldl %0, %3 \n"
- " beq %0, 1b \n"
- " br 2b \n"
- "3: br 1b \n"
- "4: \n"
- " # END __cpu_simple_lock\n"
- : "=&r" (t0), "=m" (*alp)
- : "i" (__SIMPLELOCK_LOCKED), "m" (*alp)
- : "memory");
-}
-
-static __inline int
-__cpu_simple_lock_try(__cpu_simple_lock_t *alp)
-{
- unsigned long t0, v0;
-
- __asm __volatile(
- "# BEGIN __cpu_simple_lock_try\n"
- "1: ldl_l %0, %4 \n"
- " bne %0, 2f \n"
- " bis $31, %3, %0 \n"
- " stl_c %0, %2 \n"
- " beq %0, 3f \n"
- " mb \n"
- " bis $31, 1, %1 \n"
- " br 4f \n"
- "2: bis $31, $31, %1 \n"
- " br 4f \n"
- "3: br 1b \n"
- "4: \n"
- " # END __cpu_simple_lock_try"
- : "=&r" (t0), "=r" (v0), "=m" (*alp)
- : "i" (__SIMPLELOCK_LOCKED), "m" (*alp)
- : "memory");
-
- return (v0 != 0);
-}
-
-static __inline void
-__cpu_simple_unlock(__cpu_simple_lock_t *alp)
-{
-
- __asm __volatile(
- "# BEGIN __cpu_simple_unlock\n"
- " mb \n"
- " stl $31, %0 \n"
- " # END __cpu_simple_unlock"
- : "=m" (*alp));
-}
-
#if defined(MULTIPROCESSOR)
/*
* On the Alpha, interprocessor interrupts come in at device priority
diff --git a/sys/arch/amd64/include/lock.h b/sys/arch/amd64/include/lock.h
index 4cff0e75ebe..ec38788f12c 100644
--- a/sys/arch/amd64/include/lock.h
+++ b/sys/arch/amd64/include/lock.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: lock.h,v 1.6 2011/03/23 16:54:34 pirofti Exp $ */
+/* $OpenBSD: lock.h,v 1.7 2013/05/21 20:05:30 tedu Exp $ */
/* $NetBSD: lock.h,v 1.1.2.2 2000/05/03 14:40:55 sommerfeld Exp $ */
/*-
@@ -37,11 +37,6 @@
#ifndef _MACHINE_LOCK_H_
#define _MACHINE_LOCK_H_
-typedef __volatile int __cpu_simple_lock_t;
-
-#define __SIMPLELOCK_LOCKED 1
-#define __SIMPLELOCK_UNLOCKED 0
-
/*
* compiler barrier: prevent reordering of instructions.
* XXX something similar will move to <sys/cdefs.h>
@@ -55,61 +50,6 @@ typedef __volatile int __cpu_simple_lock_t;
#include <machine/atomic.h>
-#ifdef LOCKDEBUG
-
-extern void __cpu_simple_lock_init(__cpu_simple_lock_t *);
-extern void __cpu_simple_lock(__cpu_simple_lock_t *);
-extern int __cpu_simple_lock_try(__cpu_simple_lock_t *);
-extern void __cpu_simple_unlock(__cpu_simple_lock_t *);
-
-#else
-
-static __inline void __cpu_simple_lock_init(__cpu_simple_lock_t *)
- __attribute__((__unused__));
-static __inline void __cpu_simple_lock(__cpu_simple_lock_t *)
- __attribute__((__unused__));
-static __inline int __cpu_simple_lock_try(__cpu_simple_lock_t *)
- __attribute__((__unused__));
-static __inline void __cpu_simple_unlock(__cpu_simple_lock_t *)
- __attribute__((__unused__));
-
-static __inline void
-__cpu_simple_lock_init(__cpu_simple_lock_t *lockp)
-{
- *lockp = __SIMPLELOCK_UNLOCKED;
- __lockbarrier();
-}
-
-static __inline void
-__cpu_simple_lock(__cpu_simple_lock_t *lockp)
-{
- while (x86_atomic_testset_i(lockp, __SIMPLELOCK_LOCKED)
- == __SIMPLELOCK_LOCKED) {
- continue; /* spin */
- }
- __lockbarrier();
-}
-
-static __inline int
-__cpu_simple_lock_try(__cpu_simple_lock_t *lockp)
-{
- int r = (x86_atomic_testset_i(lockp, __SIMPLELOCK_LOCKED)
- == __SIMPLELOCK_UNLOCKED);
-
- __lockbarrier();
-
- return (r);
-}
-
-static __inline void
-__cpu_simple_unlock(__cpu_simple_lock_t *lockp)
-{
- __lockbarrier();
- *lockp = __SIMPLELOCK_UNLOCKED;
-}
-
-#endif /* !LOCKDEBUG */
-
#define rw_cas(p, o, n) (x86_atomic_cas_ul(p, o, n) != o)
#endif /* _MACHINE_LOCK_H_ */
diff --git a/sys/arch/hppa64/include/lock.h b/sys/arch/hppa64/include/lock.h
index 784909894d0..dd4a03257c3 100644
--- a/sys/arch/hppa64/include/lock.h
+++ b/sys/arch/hppa64/include/lock.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: lock.h,v 1.5 2012/06/05 15:06:10 jsing Exp $ */
+/* $OpenBSD: lock.h,v 1.6 2013/05/21 20:05:30 tedu Exp $ */
/* public domain */
@@ -7,43 +7,4 @@
#include <machine/atomic.h>
-typedef volatile u_int __cpu_simple_lock_t;
-
-#define __SIMPLELOCK_LOCKED 0
-#define __SIMPLELOCK_UNLOCKED 1
-
-static __inline__ void
-__cpu_simple_lock_init(__cpu_simple_lock_t *l)
-{
- *l = __SIMPLELOCK_UNLOCKED;
-}
-
-static __inline__ void
-__cpu_simple_lock(__cpu_simple_lock_t *l)
-{
- volatile u_int old;
-
- do {
- __asm__ __volatile__
- ("ldcw,co %1, %0" : "=r" (old), "=m" (l) : "m" (l));
- } while (old != __SIMPLELOCK_UNLOCKED);
-}
-
-static __inline__ int
-__cpu_simple_lock_try(__cpu_simple_lock_t *l)
-{
- volatile u_int old;
-
- __asm__ __volatile__
- ("ldcw,co %1, %0" : "=r" (old), "=m" (l) : "m" (l));
-
- return (old == __SIMPLELOCK_UNLOCKED);
-}
-
-static __inline__ void
-__cpu_simple_unlock(__cpu_simple_lock_t *l)
-{
- *l = __SIMPLELOCK_UNLOCKED;
-}
-
#endif /* _MACHINE_LOCK_H_ */
diff --git a/sys/arch/i386/i386/lock_machdep.c b/sys/arch/i386/i386/lock_machdep.c
index 40b994b1d56..6335461cc64 100644
--- a/sys/arch/i386/i386/lock_machdep.c
+++ b/sys/arch/i386/i386/lock_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lock_machdep.c,v 1.11 2012/12/05 23:20:12 deraadt Exp $ */
+/* $OpenBSD: lock_machdep.c,v 1.12 2013/05/21 20:05:30 tedu Exp $ */
/* $NetBSD: lock_machdep.c,v 1.1.2.3 2000/05/03 14:40:30 sommerfeld Exp $ */
/*-
@@ -45,60 +45,6 @@
#include <ddb/db_output.h>
-#ifdef LOCKDEBUG
-
-void
-__cpu_simple_lock_init(__cpu_simple_lock_t *lockp)
-{
- *lockp = __SIMPLELOCK_UNLOCKED;
-}
-
-#if defined (DEBUG) && defined(DDB)
-int spin_limit = 10000000;
-#endif
-
-void
-__cpu_simple_lock(__cpu_simple_lock_t *lockp)
-{
-#if defined (DEBUG) && defined(DDB)
- int spincount = 0;
-#endif
-
- while (i386_atomic_testset_i(lockp, __SIMPLELOCK_LOCKED)
- == __SIMPLELOCK_LOCKED) {
-#if defined(DEBUG) && defined(DDB)
- spincount++;
- if (spincount == spin_limit) {
- extern int db_active;
- db_printf("spundry\n");
- if (db_active) {
- db_printf("but already in debugger\n");
- } else {
- Debugger();
- }
- }
-#endif
- }
-}
-
-int
-__cpu_simple_lock_try(__cpu_simple_lock_t *lockp)
-{
-
- if (i386_atomic_testset_i(lockp, __SIMPLELOCK_LOCKED)
- == __SIMPLELOCK_UNLOCKED)
- return (1);
- return (0);
-}
-
-void
-__cpu_simple_unlock(__cpu_simple_lock_t *lockp)
-{
- *lockp = __SIMPLELOCK_UNLOCKED;
-}
-
-#endif
-
int
rw_cas_486(volatile unsigned long *p, unsigned long o, unsigned long n)
{
diff --git a/sys/arch/i386/include/lock.h b/sys/arch/i386/include/lock.h
index fce789cf241..7a3a8ffe482 100644
--- a/sys/arch/i386/include/lock.h
+++ b/sys/arch/i386/include/lock.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: lock.h,v 1.7 2011/03/23 16:54:35 pirofti Exp $ */
+/* $OpenBSD: lock.h,v 1.8 2013/05/21 20:05:30 tedu Exp $ */
/* $NetBSD: lock.h,v 1.1.2.2 2000/05/03 14:40:55 sommerfeld Exp $ */
/*-
@@ -37,11 +37,6 @@
#ifndef _MACHINE_LOCK_H_
#define _MACHINE_LOCK_H_
-typedef __volatile int __cpu_simple_lock_t;
-
-#define __SIMPLELOCK_LOCKED 1
-#define __SIMPLELOCK_UNLOCKED 0
-
/*
* compiler barrier: prevent reordering of instructions.
* XXX something similar will move to <sys/cdefs.h>
@@ -54,62 +49,8 @@ typedef __volatile int __cpu_simple_lock_t;
#define SPINLOCK_SPIN_HOOK __asm __volatile("pause": : :"memory")
-#ifdef LOCKDEBUG
-
-extern void __cpu_simple_lock_init(__cpu_simple_lock_t *);
-extern void __cpu_simple_lock(__cpu_simple_lock_t *);
-extern int __cpu_simple_lock_try(__cpu_simple_lock_t *);
-extern void __cpu_simple_unlock(__cpu_simple_lock_t *);
-
-#else
-
#include <machine/atomic.h>
-static __inline void __cpu_simple_lock_init(__cpu_simple_lock_t *)
- __attribute__((__unused__));
-static __inline void __cpu_simple_lock(__cpu_simple_lock_t *)
- __attribute__((__unused__));
-static __inline int __cpu_simple_lock_try(__cpu_simple_lock_t *)
- __attribute__((__unused__));
-static __inline void __cpu_simple_unlock(__cpu_simple_lock_t *)
- __attribute__((__unused__));
-
-static __inline void
-__cpu_simple_lock_init(__cpu_simple_lock_t *lockp)
-{
- *lockp = __SIMPLELOCK_UNLOCKED;
- __lockbarrier();
-}
-
-static __inline void
-__cpu_simple_lock(__cpu_simple_lock_t *lockp)
-{
- while (i386_atomic_testset_i(lockp, __SIMPLELOCK_LOCKED)
- == __SIMPLELOCK_LOCKED)
- SPINLOCK_SPIN_HOOK;
- __lockbarrier();
-}
-
-static __inline int
-__cpu_simple_lock_try(__cpu_simple_lock_t *lockp)
-{
- int r = (i386_atomic_testset_i(lockp, __SIMPLELOCK_LOCKED)
- == __SIMPLELOCK_UNLOCKED);
-
- __lockbarrier();
-
- return (r);
-}
-
-static __inline void
-__cpu_simple_unlock(__cpu_simple_lock_t *lockp)
-{
- __lockbarrier();
- *lockp = __SIMPLELOCK_UNLOCKED;
-}
-
-#endif /* !LOCKDEBUG */
-
#ifdef _KERNEL
extern int rw_cas_486(volatile unsigned long *, unsigned long, unsigned long);
#define rw_cas rw_cas_486
diff --git a/sys/arch/m68k/include/lock.h b/sys/arch/m68k/include/lock.h
index 2e7e04dce73..93c49df117a 100644
--- a/sys/arch/m68k/include/lock.h
+++ b/sys/arch/m68k/include/lock.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: lock.h,v 1.2 2010/04/26 05:48:19 deraadt Exp $ */
+/* $OpenBSD: lock.h,v 1.3 2013/05/21 20:05:30 tedu Exp $ */
/* public domain */
@@ -7,44 +7,4 @@
#include <machine/atomic.h>
-typedef volatile u_int __cpu_simple_lock_t;
-
-#define __SIMPLELOCK_LOCKED 1
-#define __SIMPLELOCK_UNLOCKED 0
-
-static __inline__ void
-__cpu_simple_lock_init(__cpu_simple_lock_t *l)
-{
- *l = __SIMPLELOCK_UNLOCKED;
-}
-
-static __inline__ void
-__cpu_simple_lock(__cpu_simple_lock_t *l)
-{
- __cpu_simple_lock_t old;
-
- do {
- old = __SIMPLELOCK_LOCKED;
- __asm__ __volatile__
- ("casl %0, %2, %1" : "+d" (old), "=m" (*l) : "d" (*l));
- } while (old != __SIMPLELOCK_UNLOCKED);
-}
-
-static __inline__ int
-__cpu_simple_lock_try(__cpu_simple_lock_t *l)
-{
- __cpu_simple_lock_t old = __SIMPLELOCK_LOCKED;
-
- __asm__ __volatile__
- ("casl %0, %2, %1" : "+d" (old), "=m" (*l) : "d" (*l));
-
- return (old == __SIMPLELOCK_UNLOCKED);
-}
-
-static __inline__ void
-__cpu_simple_unlock(__cpu_simple_lock_t *l)
-{
- *l = __SIMPLELOCK_UNLOCKED;
-}
-
#endif /* _M68K_LOCK_H_ */
diff --git a/sys/arch/mips64/include/lock.h b/sys/arch/mips64/include/lock.h
index 1d28d83757a..805128e802d 100644
--- a/sys/arch/mips64/include/lock.h
+++ b/sys/arch/mips64/include/lock.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: lock.h,v 1.4 2010/04/21 03:03:26 deraadt Exp $ */
+/* $OpenBSD: lock.h,v 1.5 2013/05/21 20:05:30 tedu Exp $ */
/* public domain */
@@ -7,52 +7,6 @@
#include <mips64/atomic.h>
-typedef volatile u_int __cpu_simple_lock_t;
-
-#define __SIMPLELOCK_LOCKED 1
-#define __SIMPLELOCK_UNLOCKED 0
-
-static __inline__ void
-__cpu_simple_lock_init(__cpu_simple_lock_t *l)
-{
- *l = __SIMPLELOCK_UNLOCKED;
-}
-
-static __inline__ void
-__cpu_simple_lock(__cpu_simple_lock_t *l)
-{
- __cpu_simple_lock_t old, new;
-
- do {
- new = __SIMPLELOCK_LOCKED;
- __asm__ __volatile__
- ("1:\tll\t%0, %1\n"
- "\tsc\t%2, %1\n"
- "\tbeqz\t%2, 1b\n"
- "\t nop" : "=&r" (old) : "m" (*l), "r" (new));
- } while (old != __SIMPLELOCK_UNLOCKED);
-}
-
-static __inline__ int
-__cpu_simple_lock_try(__cpu_simple_lock_t *l)
-{
- __cpu_simple_lock_t old, new = __SIMPLELOCK_LOCKED;
-
- __asm__ __volatile__
- ("1:\tll\t%0, %1\n"
- "\tsc\t%2, %1\n"
- "\tbeqz\t%2, 1b\n"
- "\t nop" : "=&r" (old) : "m" (*l), "r" (new));
-
- return (old == __SIMPLELOCK_UNLOCKED);
-}
-
-static __inline__ void
-__cpu_simple_unlock(__cpu_simple_lock_t *l)
-{
- *l = __SIMPLELOCK_UNLOCKED;
-}
-
#define rw_cas __cpu_cas
static __inline int
__cpu_cas(volatile unsigned long *addr, unsigned long old, unsigned long new)
diff --git a/sys/arch/powerpc/include/lock.h b/sys/arch/powerpc/include/lock.h
index a9cf2f8500c..18f9bf6d88b 100644
--- a/sys/arch/powerpc/include/lock.h
+++ b/sys/arch/powerpc/include/lock.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: lock.h,v 1.3 2008/06/26 05:42:12 ray Exp $ */
+/* $OpenBSD: lock.h,v 1.4 2013/05/21 20:05:30 tedu Exp $ */
/* $NetBSD: lock.h,v 1.8 2005/12/28 19:09:29 perry Exp $ */
/*-
@@ -37,71 +37,6 @@
#ifndef _POWERPC_LOCK_H_
#define _POWERPC_LOCK_H_
-typedef __volatile int __cpu_simple_lock_t;
-
-#define __SIMPLELOCK_LOCKED 1
-#define __SIMPLELOCK_UNLOCKED 0
-
-static __inline void
-__cpu_simple_lock_init(__cpu_simple_lock_t *alp)
-{
- *alp = __SIMPLELOCK_UNLOCKED;
- __asm volatile ("sync");
-}
-
-static __inline void
-__cpu_simple_lock(__cpu_simple_lock_t *alp)
-{
- int old;
-
- __asm volatile (" \
- \n\
-1: lwarx %0,0,%1 \n\
- cmpwi %0,%2 \n\
- beq+ 3f \n\
-2: lwzx %0,0,%1 \n\
- cmpwi %0,%2 \n\
- beq+ 1b \n\
- b 2b \n\
-3: stwcx. %3,0,%1 \n\
- bne- 1b \n\
- isync \n\
- \n"
- : "=&r"(old)
- : "r"(alp), "I"(__SIMPLELOCK_UNLOCKED), "r"(__SIMPLELOCK_LOCKED)
- : "memory");
-}
-
-static __inline int
-__cpu_simple_lock_try(__cpu_simple_lock_t *alp)
-{
- int old, dummy;
-
- __asm volatile (" \
- \n\
-1: lwarx %0,0,%1 \n\
- cmpwi %0,%2 \n\
- bne 2f \n\
- stwcx. %3,0,%1 \n\
- bne- 1b \n\
-2: stwcx. %3,0,%4 \n\
- isync \n\
- \n"
- : "=&r"(old)
- : "r"(alp), "I"(__SIMPLELOCK_UNLOCKED), "r"(__SIMPLELOCK_LOCKED),
- "r"(&dummy)
- : "memory");
-
- return (old == __SIMPLELOCK_UNLOCKED);
-}
-
-static __inline void
-__cpu_simple_unlock(__cpu_simple_lock_t *alp)
-{
- __asm volatile ("sync");
- *alp = __SIMPLELOCK_UNLOCKED;
-}
-
#define rw_cas __cpu_cas
static __inline int
__cpu_cas(volatile unsigned long *addr, unsigned long old, unsigned long new)
diff --git a/sys/arch/sh/include/lock.h b/sys/arch/sh/include/lock.h
index e228fabc292..97254b0d75e 100644
--- a/sys/arch/sh/include/lock.h
+++ b/sys/arch/sh/include/lock.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: lock.h,v 1.3 2010/04/26 05:48:19 deraadt Exp $ */
+/* $OpenBSD: lock.h,v 1.4 2013/05/21 20:05:30 tedu Exp $ */
/* $NetBSD: lock.h,v 1.10 2006/01/03 01:29:46 uwe Exp $ */
/*-
@@ -39,44 +39,4 @@
#include <sh/atomic.h>
-typedef volatile u_int8_t __cpu_simple_lock_t;
-
-#define __SIMPLELOCK_LOCKED 0x80
-#define __SIMPLELOCK_UNLOCKED 0x00
-
-static __inline void
-__cpu_simple_lock_init(__cpu_simple_lock_t *alp)
-{
- *alp = __SIMPLELOCK_UNLOCKED;
-}
-
-static __inline void
-__cpu_simple_lock(__cpu_simple_lock_t *alp)
-{
- __asm volatile(
- "1: tas.b %0 \n"
- " bf 1b \n"
- : "=m" (*alp));
-}
-
-static __inline int
-__cpu_simple_lock_try(__cpu_simple_lock_t *alp)
-{
- int __rv;
-
- __asm volatile(
- " tas.b %0 \n"
- " mov #0, %1 \n"
- " rotcl %1 \n"
- : "=m" (*alp), "=r" (__rv));
-
- return (__rv);
-}
-
-static __inline void
-__cpu_simple_unlock(__cpu_simple_lock_t *alp)
-{
- *alp = __SIMPLELOCK_UNLOCKED;
-}
-
#endif /* !_SH_LOCK_H_ */
diff --git a/sys/arch/sparc/include/lock.h b/sys/arch/sparc/include/lock.h
index 136d9914278..dd4a03257c3 100644
--- a/sys/arch/sparc/include/lock.h
+++ b/sys/arch/sparc/include/lock.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: lock.h,v 1.5 2011/07/02 22:19:16 guenther Exp $ */
+/* $OpenBSD: lock.h,v 1.6 2013/05/21 20:05:30 tedu Exp $ */
/* public domain */
@@ -7,47 +7,4 @@
#include <machine/atomic.h>
-typedef volatile u_int8_t __cpu_simple_lock_t;
-
-#define __SIMPLELOCK_LOCKED 0xff
-#define __SIMPLELOCK_UNLOCKED 0x00
-
-static __inline__ void
-__cpu_simple_lock_init(__cpu_simple_lock_t *l)
-{
- *l = __SIMPLELOCK_UNLOCKED;
-}
-
-static __inline__ u_int8_t
-__cpu_ldstub(__cpu_simple_lock_t *l)
-{
- u_int8_t old;
-
- __asm__ __volatile__
- ("ldstub [%1], %0" : "=&r" (old) : "r" (l) : "memory");
- return old;
-}
-
-static __inline__ void
-__cpu_simple_lock(__cpu_simple_lock_t *l)
-{
- while (__cpu_ldstub(l) != __SIMPLELOCK_UNLOCKED)
- while (*l != __SIMPLELOCK_UNLOCKED)
- ;
-}
-
-static __inline__ int
-__cpu_simple_lock_try(__cpu_simple_lock_t *l)
-{
- if (__cpu_ldstub(l) != __SIMPLELOCK_UNLOCKED)
- return (0);
- return (1);
-}
-
-static __inline__ void
-__cpu_simple_unlock(__cpu_simple_lock_t *l)
-{
- *l = __SIMPLELOCK_UNLOCKED;
-}
-
#endif /* _MACHINE_LOCK_H_ */
diff --git a/sys/arch/sparc64/include/lock.h b/sys/arch/sparc64/include/lock.h
index 80ceee1008f..ba41eb7a946 100644
--- a/sys/arch/sparc64/include/lock.h
+++ b/sys/arch/sparc64/include/lock.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: lock.h,v 1.7 2011/07/02 22:19:16 guenther Exp $ */
+/* $OpenBSD: lock.h,v 1.8 2013/05/21 20:05:30 tedu Exp $ */
/* public domain */
@@ -8,52 +8,6 @@
#include <machine/atomic.h>
#include <machine/ctlreg.h>
-typedef volatile u_int8_t __cpu_simple_lock_t;
-
-#define __SIMPLELOCK_LOCKED 0xff
-#define __SIMPLELOCK_UNLOCKED 0x00
-
-static __inline__ void
-__cpu_simple_lock_init(__cpu_simple_lock_t *l)
-{
- *l = __SIMPLELOCK_UNLOCKED;
-}
-
-static __inline__ u_int8_t
-__cpu_ldstub(__cpu_simple_lock_t *l)
-{
- u_int8_t old;
-
- __asm__ __volatile__
- ("ldstub [%1], %0" : "=&r" (old) : "r" (l) : "memory");
- return old;
-}
-
-static __inline__ void
-__cpu_simple_lock(__cpu_simple_lock_t *l)
-{
- while (__cpu_ldstub(l) != __SIMPLELOCK_UNLOCKED)
- while (*l != __SIMPLELOCK_UNLOCKED)
- ;
- membar(LoadLoad | LoadStore); /* only needed for PSO and RMO */
-}
-
-static __inline__ int
-__cpu_simple_lock_try(__cpu_simple_lock_t *l)
-{
- if (__cpu_ldstub(l) != __SIMPLELOCK_UNLOCKED)
- return (0);
- membar(LoadLoad | LoadStore); /* only needed for PSO and RMO */
- return (1);
-}
-
-static __inline__ void
-__cpu_simple_unlock(__cpu_simple_lock_t *l)
-{
- membar(StoreStore | LoadStore); /* only needed for PSO and RMO */
- *l = __SIMPLELOCK_UNLOCKED;
-}
-
#define rw_cas(p, o, n) (sparc64_casx(p, o, n) != o)
#endif /* _MACHINE_LOCK_H_ */
diff --git a/sys/arch/vax/include/lock.h b/sys/arch/vax/include/lock.h
index 37deaf4b399..a11daa14855 100644
--- a/sys/arch/vax/include/lock.h
+++ b/sys/arch/vax/include/lock.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: lock.h,v 1.3 2011/03/23 16:54:37 pirofti Exp $ */
+/* $OpenBSD: lock.h,v 1.4 2013/05/21 20:05:30 tedu Exp $ */
/* public domain */
@@ -7,50 +7,4 @@
#include <machine/atomic.h>
-typedef volatile u_int __cpu_simple_lock_t;
-
-#define __SIMPLELOCK_LOCKED 1
-#define __SIMPLELOCK_UNLOCKED 0
-
-static __inline__ void
-__cpu_simple_lock_init(__cpu_simple_lock_t *l)
-{
- *l = __SIMPLELOCK_UNLOCKED;
-}
-
-static __inline__ void
-__cpu_simple_lock(__cpu_simple_lock_t *l)
-{
- __cpu_simple_lock_t old;
-
- do {
- old = __SIMPLELOCK_LOCKED;
- __asm__ __volatile__
- ("\tmovl\t$1, %1\n" /* _SPLINLOCK_LOCKED */
- "\tbbssi\t$0, %0, 1f\n"
- "\tmovl\t$0, %1\n" /* _SPLINLOCK_UNLOCKED */
- "1:\n" : "=m" (*l), "=r" (old) : "0" (*l));
- } while (old != __SIMPLELOCK_UNLOCKED);
-}
-
-static __inline__ int
-__cpu_simple_lock_try(__cpu_simple_lock_t *l)
-{
- __cpu_simple_lock_t old = __SIMPLELOCK_LOCKED;
-
- __asm__ __volatile__
- ("\tmovl\t$1, %1\n" /* _SPLINLOCK_LOCKED */
- "\tbbssi\t$0, %0, 1f\n"
- "\tmovl\t$0, %1\n" /* _SPLINLOCK_UNLOCKED */
- "1:\n" : "=m" (*l), "=r" (old) : "0" (*l));
-
- return (old == __SIMPLELOCK_UNLOCKED);
-}
-
-static __inline__ void
-__cpu_simple_unlock(__cpu_simple_lock_t *l)
-{
- *l = __SIMPLELOCK_UNLOCKED;
-}
-
#endif /* _MACHINE_LOCK_H_ */