diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index dcacd5c431ef..875b06178da5 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_lock.c,v 1.99 2006/09/07 02:06:47 ad Exp $ */ +/* $NetBSD: kern_lock.c,v 1.100 2006/09/30 11:59:37 yamt Exp $ */ /*- * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. @@ -76,7 +76,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_lock.c,v 1.99 2006/09/07 02:06:47 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_lock.c,v 1.100 2006/09/30 11:59:37 yamt Exp $"); #include "opt_multiprocessor.h" #include "opt_lockdebug.h" @@ -1556,8 +1556,18 @@ _kernel_lock_acquire_count(int hold_count) void _kernel_lock_assert_locked() { + + KDASSERT(curcpu()->ci_data.cpu_biglock_count > 0); simple_lock_assert_locked(&kernel_lock, "kernel_lock"); } + +void +_kernel_lock_assert_unlocked() +{ + + KDASSERT(curcpu()->ci_data.cpu_biglock_count == 0); + simple_lock_assert_unlocked(&kernel_lock, "kernel_lock"); +} #endif int diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 89e9a4a75e10..0f320c76fc61 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -1,4 +1,4 @@ -/* $NetBSD: systm.h,v 1.189 2006/09/24 06:51:39 dogcow Exp $ */ +/* $NetBSD: systm.h,v 1.190 2006/09/30 11:59:37 yamt Exp $ */ /*- * Copyright (c) 1982, 1988, 1991, 1993 @@ -498,9 +498,12 @@ void _kernel_lock_acquire_count(int); #if defined(MULTIPROCESSOR) && defined(DEBUG) #define KERNEL_LOCK_ASSERT_LOCKED() _kernel_lock_assert_locked() +#define KERNEL_LOCK_ASSERT_UNLOCKED() _kernel_lock_assert_unlocked() void _kernel_lock_assert_locked(void); +void _kernel_lock_assert_unlocked(void); #else #define KERNEL_LOCK_ASSERT_LOCKED() /* nothing */ +#define KERNEL_LOCK_ASSERT_UNLOCKED() /* nothing */ #endif #endif /* !_SYS_SYSTM_H_ */