Use userspace version unless _HARDKERNEL. Otherwise we use atomic

cas to implement spinlocks and spinlocks to implement atomic cas....
which might suck.

Since the userspace version uses ll/sc, which doesn't exist on
R2000/R3000, rump will not work on those platforms.  *snif* (well,
pthread in general AFAICT).
This commit is contained in:
pooka 2009-01-12 03:05:10 +00:00
parent 654753c2e1
commit 367deb8e0a
1 changed files with 6 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: lock.h,v 1.16 2008/04/28 20:23:28 martin Exp $ */
/* $NetBSD: lock.h,v 1.17 2009/01/12 03:05:10 pooka Exp $ */
/*-
* Copyright (c) 2001, 2007 The NetBSD Foundation, Inc.
@ -39,6 +39,8 @@
#ifndef _MIPS_LOCK_H_
#define _MIPS_LOCK_H_
#include <sys/param.h>
static __inline int
__SIMPLELOCK_LOCKED_P(__cpu_simple_lock_t *__ptr)
{
@ -63,7 +65,7 @@ __cpu_simple_lock_set(__cpu_simple_lock_t *__ptr)
*__ptr = __SIMPLELOCK_LOCKED;
}
#ifndef _KERNEL
#ifndef _HARDKERNEL
static __inline int
__cpu_simple_lock_try(__cpu_simple_lock_t *lp)
@ -140,7 +142,7 @@ mb_memory(void)
}
#endif /* MIPS1 */
#else /* !_KERNEL */
#else /* !_HARDKERNEL */
unsigned _atomic_cas_uint(volatile unsigned *, unsigned, unsigned);
void mb_read(void);
@ -156,7 +158,7 @@ __cpu_simple_lock_try(__cpu_simple_lock_t *lp)
__SIMPLELOCK_UNLOCKED;
}
#endif /* _KERNEL */
#endif /* _HARDKERNEL */
static __inline void
__cpu_simple_lock_init(__cpu_simple_lock_t *lp)