version 1.14, 2007/02/10 16:19:39 |
version 1.14.12.1, 2007/04/18 04:45:13 |
Line 58 extern void __cpu_simple_unlock(__cpu_si |
|
Line 58 extern void __cpu_simple_unlock(__cpu_si |
|
|
|
#else |
#else |
|
|
#include <machine/atomic.h> |
#include <sys/atomic.h> |
|
|
static __inline void __cpu_simple_lock_init(__cpu_simple_lock_t *) |
static __inline void __cpu_simple_lock_init(__cpu_simple_lock_t *) |
__attribute__((__unused__)); |
__attribute__((__unused__)); |
Line 81 static __inline void |
|
Line 81 static __inline void |
|
__cpu_simple_lock(__cpu_simple_lock_t *lockp) |
__cpu_simple_lock(__cpu_simple_lock_t *lockp) |
{ |
{ |
|
|
while (x86_atomic_testset_b(lockp, __SIMPLELOCK_LOCKED) |
while (atomic_swap_8(lockp, __SIMPLELOCK_LOCKED) |
!= __SIMPLELOCK_UNLOCKED) { |
!= __SIMPLELOCK_UNLOCKED) { |
do { |
do { |
x86_pause(); |
x86_pause(); |
Line 93 __cpu_simple_lock(__cpu_simple_lock_t *l |
|
Line 93 __cpu_simple_lock(__cpu_simple_lock_t *l |
|
static __inline int |
static __inline int |
__cpu_simple_lock_try(__cpu_simple_lock_t *lockp) |
__cpu_simple_lock_try(__cpu_simple_lock_t *lockp) |
{ |
{ |
int r = (x86_atomic_testset_b(lockp, __SIMPLELOCK_LOCKED) |
int r = (atomic_swap_8(lockp, __SIMPLELOCK_LOCKED) |
== __SIMPLELOCK_UNLOCKED); |
== __SIMPLELOCK_UNLOCKED); |
|
|
__insn_barrier(); |
__insn_barrier(); |