diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2013-05-21 20:05:31 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2013-05-21 20:05:31 +0000 |
commit | 1223d06696f7e28ea88bca80018594fdcd57b172 (patch) | |
tree | e341da38c545b15b66d9e7a68c2b72d4935f1a68 /sys/arch/i386 | |
parent | 1fb7bca1316e90db7b342fe0821eadb80b983d9f (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/i386')
-rw-r--r-- | sys/arch/i386/i386/lock_machdep.c | 56 | ||||
-rw-r--r-- | sys/arch/i386/include/lock.h | 61 |
2 files changed, 2 insertions, 115 deletions
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 |