diff options
Diffstat (limited to 'sys/arch/hppa/include/mutex.h')
-rw-r--r-- | sys/arch/hppa/include/mutex.h | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/sys/arch/hppa/include/mutex.h b/sys/arch/hppa/include/mutex.h index e5d16258166..6bea7b9b110 100644 --- a/sys/arch/hppa/include/mutex.h +++ b/sys/arch/hppa/include/mutex.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mutex.h,v 1.2 2007/05/05 12:06:17 miod Exp $ */ +/* $OpenBSD: mutex.h,v 1.3 2009/12/29 15:01:59 jsing Exp $ */ /* * Copyright (c) 2004 Artur Grabowski <art@openbsd.org> @@ -28,27 +28,29 @@ #ifndef _MACHINE_MUTEX_H_ #define _MACHINE_MUTEX_H_ -/* - * Simple non-mp implementation. - */ +#define MUTEX_LOCKED 0 +#define MUTEX_UNLOCKED 1 + +/* Note: mtx_lock must be 16-byte aligned. */ struct mutex { - int mtx_lock; + volatile int mtx_lock; int mtx_wantipl; int mtx_oldipl; -}; + void *mtx_owner; +} __attribute__ ((__aligned__(16))); void mtx_init(struct mutex *, int); -#define MUTEX_INITIALIZER(ipl) { 0, (ipl), 0 } +#define MUTEX_INITIALIZER(ipl) { MUTEX_UNLOCKED, (ipl), 0, NULL } #ifdef DIAGNOSTIC #define MUTEX_ASSERT_LOCKED(mtx) do { \ - if ((mtx)->mtx_lock == 0) \ + if ((mtx)->mtx_lock != MUTEX_LOCKED) \ 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_lock != MUTEX_UNLOCKED) \ panic("mutex %p held in %s", (mtx), __func__); \ } while (0) #else |