Minor fix for preemption safety.

This commit is contained in:
ad 2008-04-27 14:29:09 +00:00
parent 12e587a1a3
commit 02691198b8
1 changed files with 5 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_mutex.c,v 1.35 2008/04/22 14:46:35 ad Exp $ */ /* $NetBSD: kern_mutex.c,v 1.36 2008/04/27 14:29:09 ad Exp $ */
/*- /*-
* Copyright (c) 2002, 2006, 2007, 2008 The NetBSD Foundation, Inc. * Copyright (c) 2002, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@ -47,7 +47,7 @@
#define __MUTEX_PRIVATE #define __MUTEX_PRIVATE
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.35 2008/04/22 14:46:35 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.36 2008/04/27 14:29:09 ad Exp $");
#include "opt_multiprocessor.h" #include "opt_multiprocessor.h"
@ -130,10 +130,11 @@ do { \
#define MUTEX_SPIN_SPLRAISE(mtx) \ #define MUTEX_SPIN_SPLRAISE(mtx) \
do { \ do { \
struct cpu_info *x__ci = curcpu(); \ struct cpu_info *x__ci; \
int x__cnt, s; \ int x__cnt, s; \
x__cnt = x__ci->ci_mtx_count--; \
s = splraiseipl(mtx->mtx_ipl); \ s = splraiseipl(mtx->mtx_ipl); \
x__ci = curcpu(); \
x__cnt = x__ci->ci_mtx_count--; \
if (x__cnt == MUTEX_COUNT_BIAS) \ if (x__cnt == MUTEX_COUNT_BIAS) \
x__ci->ci_mtx_oldspl = (s); \ x__ci->ci_mtx_oldspl = (s); \
} while (/* CONSTCOND */ 0) } while (/* CONSTCOND */ 0)