diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2007-08-25 18:36:48 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2007-08-25 18:36:48 +0000 |
commit | 15f834f1cf4d40e15512b242a685b765f5c0c202 (patch) | |
tree | fc61caa28ce536da14cf4350e96016e5eed8796d /sys/arch/sparc64/include | |
parent | 95bdcb16c30875be0b3c9b6c943e581c4630a585 (diff) |
Real mutexes for sparc64. Some comments from henric@ and claudio@.
Tested by fkr@, claudio@, nick@.
Diffstat (limited to 'sys/arch/sparc64/include')
-rw-r--r-- | sys/arch/sparc64/include/mutex.h | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/sys/arch/sparc64/include/mutex.h b/sys/arch/sparc64/include/mutex.h index 158c43c56bd..8b8654ee554 100644 --- a/sys/arch/sparc64/include/mutex.h +++ b/sys/arch/sparc64/include/mutex.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mutex.h,v 1.1 2007/02/03 20:08:50 miod Exp $ */ +/* $OpenBSD: mutex.h,v 1.2 2007/08/25 18:36:47 kettenis Exp $ */ /* * Copyright (c) 2004 Artur Grabowski <art@openbsd.org> @@ -28,27 +28,22 @@ #ifndef _MACHINE_MUTEX_H_ #define _MACHINE_MUTEX_H_ -/* - * Simple non-mp implementation. - */ struct mutex { - int mtx_lock; + __volatile void *mtx_owner; /* mutex.S relies upon this being first */ int mtx_wantipl; int mtx_oldipl; }; -void mtx_init(struct mutex *, int); - -#define MUTEX_INITIALIZER(ipl) { 0, ipl, 0 } +#define MUTEX_INITIALIZER(ipl) { NULL, ipl, 0 } #ifdef DIAGNOSTIC #define MUTEX_ASSERT_LOCKED(mtx) do { \ - if ((mtx)->mtx_lock == 0) \ + if ((mtx)->mtx_owner != curcpu()) \ panic("mutex %p not held in %s", (mtx), __func__); \ } while (0) #define MUTEX_ASSERT_UNLOCKED(mtx) do { \ - if ((mtx)->mtx_lock != 0) \ + if ((mtx)->mtx_owner == curcpu()) \ panic("mutex %p held in %s", (mtx), __func__); \ } while (0) #else |