adjust the spinlock macros in the non-MULTIPROCESSOR, non-LOCKDEBUG case

so that gcc will think that static spinlock are used.
this allows us to remove the ugly conditionalization of
static spinlock declarations.
This commit is contained in:
chs 2000-11-24 03:59:07 +00:00
parent f9ed4a5d70
commit fa19fe52db
6 changed files with 32 additions and 50 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.226 2000/11/24 02:21:56 simonb Exp $ */
/* $NetBSD: machdep.c,v 1.227 2000/11/24 03:59:07 chs Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@ -73,7 +73,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.226 2000/11/24 02:21:56 simonb Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.227 2000/11/24 03:59:07 chs Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1932,10 +1932,7 @@ microtime(tvp)
register struct timeval *tvp;
{
static struct timeval lasttime;
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
static struct simplelock microtime_slock =
SIMPLELOCK_INITIALIZER;
#endif
static struct simplelock microtime_slock = SIMPLELOCK_INITIALIZER;
int s;
s = splclock();

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.110 2000/11/14 22:55:06 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.111 2000/11/24 03:59:08 chs Exp $ */
/*
*
@ -61,8 +61,6 @@
#include "opt_cputype.h"
#include "opt_user_ldt.h"
#include "opt_lockdebug.h"
#include "opt_multiprocessor.h"
#include "opt_largepages.h"
#include <sys/param.h>
@ -253,33 +251,22 @@
* locking data structures
*/
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
struct lock pmap_main_lock;
simple_lock_data_t pvalloc_lock;
simple_lock_data_t pmaps_lock;
simple_lock_data_t pmap_copy_page_lock;
simple_lock_data_t pmap_zero_page_lock;
simple_lock_data_t pmap_tmpptp_lock;
static struct lock pmap_main_lock;
static simple_lock_data_t pvalloc_lock;
static simple_lock_data_t pmaps_lock;
static simple_lock_data_t pmap_copy_page_lock;
static simple_lock_data_t pmap_zero_page_lock;
static simple_lock_data_t pmap_tmpptp_lock;
#define PMAP_MAP_TO_HEAD_LOCK() \
spinlockmgr(&pmap_main_lock, LK_SHARED, (void *) 0)
(void) spinlockmgr(&pmap_main_lock, LK_SHARED, NULL)
#define PMAP_MAP_TO_HEAD_UNLOCK() \
spinlockmgr(&pmap_main_lock, LK_RELEASE, (void *) 0)
(void) spinlockmgr(&pmap_main_lock, LK_RELEASE, NULL)
#define PMAP_HEAD_TO_MAP_LOCK() \
spinlockmgr(&pmap_main_lock, LK_EXCLUSIVE, (void *) 0)
(void) spinlockmgr(&pmap_main_lock, LK_EXCLUSIVE, NULL)
#define PMAP_HEAD_TO_MAP_UNLOCK() \
spinlockmgr(&pmap_main_lock, LK_RELEASE, (void *) 0)
#else
#define PMAP_MAP_TO_HEAD_LOCK() /* null */
#define PMAP_MAP_TO_HEAD_UNLOCK() /* null */
#define PMAP_HEAD_TO_MAP_LOCK() /* null */
#define PMAP_HEAD_TO_MAP_UNLOCK() /* null */
#endif
(void) spinlockmgr(&pmap_main_lock, LK_RELEASE, NULL)
/*
* global data structures
@ -914,14 +901,12 @@ pmap_bootstrap(kva_start)
* init the static-global locks and global lists.
*/
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
spinlockinit(&pmap_main_lock, "pmaplk", 0);
simple_lock_init(&pvalloc_lock);
simple_lock_init(&pmaps_lock);
simple_lock_init(&pmap_copy_page_lock);
simple_lock_init(&pmap_zero_page_lock);
simple_lock_init(&pmap_tmpptp_lock);
#endif
LIST_INIT(&pmaps);
TAILQ_INIT(&pv_freepages);
TAILQ_INIT(&pv_unusedpgs);
@ -2616,6 +2601,9 @@ pmap_page_remove(pg)
ptes = pmap_map_ptes(pve->pv_pmap); /* locks pmap */
#ifdef DIAGNOSTIC
if (pve->pv_va >= uvm.pager_sva && pve->pv_va < uvm.pager_eva) {
printf("pmap_page_remove: found pager VA on pv_list\n");
}
if (pve->pv_ptp && (pve->pv_pmap->pm_pdir[pdei(pve->pv_va)] &
PG_FRAME)
!= VM_PAGE_TO_PHYS(pve->pv_ptp)) {
@ -2989,7 +2977,7 @@ pmap_unwire(pmap, va)
#ifdef DIAGNOSTIC
if (!pmap_valid_entry(ptes[i386_btop(va)]))
panic("pmap_unwire: invalid (unmapped) va");
panic("pmap_unwire: invalid (unmapped) va 0x%lx", va);
#endif
if ((ptes[i386_btop(va)] & PG_W) != 0) {
ptes[i386_btop(va)] &= ~PG_W;

View File

@ -1,4 +1,4 @@
/* $NetBSD: cy82c693.c,v 1.1 2000/06/06 03:07:39 thorpej Exp $ */
/* $NetBSD: cy82c693.c,v 1.2 2000/11/24 03:59:08 chs Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -43,7 +43,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: cy82c693.c,v 1.1 2000/06/06 03:07:39 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: cy82c693.c,v 1.2 2000/11/24 03:59:08 chs Exp $");
#include "opt_multiprocessor.h"
#include "opt_lockdebug.h"
@ -64,9 +64,7 @@ __KERNEL_RCSID(0, "$NetBSD: cy82c693.c,v 1.1 2000/06/06 03:07:39 thorpej Exp $")
static struct cy82c693_handle cyhc_handle;
static int cyhc_initialized;
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
static struct simplelock cyhc_slock = SIMPLELOCK_INITIALIZER;
#endif
#define CYHC_LOCK(s) \
do { \

View File

@ -1,4 +1,4 @@
/* $NetBSD: tty_pty.c,v 1.54 2000/11/21 03:53:27 enami Exp $ */
/* $NetBSD: tty_pty.c,v 1.55 2000/11/24 03:59:08 chs Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@ -82,10 +82,7 @@ struct pt_softc {
static struct pt_softc **pt_softc = NULL; /* pty array */
static int npty = 0; /* for pstat -t */
static int maxptys = DEFAULT_MAXPTYS; /* maximum number of ptys (sysctable) */
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
static struct simplelock pt_softc_mutex = SIMPLELOCK_INITIALIZER;
#endif
#define PF_PKT 0x08 /* packet mode */
#define PF_STOPPED 0x10 /* user told stopped */

View File

@ -1,4 +1,4 @@
/* $NetBSD: vfs_subr.c,v 1.140 2000/09/19 22:00:58 fvdl Exp $ */
/* $NetBSD: vfs_subr.c,v 1.141 2000/11/24 03:59:09 chs Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -148,9 +148,7 @@ struct vfs_list_head vfs_list = /* vfs list */
struct nfs_public nfs_pub; /* publicly exported FS */
struct simplelock mountlist_slock = SIMPLELOCK_INITIALIZER;
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
static struct simplelock mntid_slock = SIMPLELOCK_INITIALIZER;
#endif
struct simplelock mntvnode_slock = SIMPLELOCK_INITIALIZER;
struct simplelock vnode_free_list_slock = SIMPLELOCK_INITIALIZER;
struct simplelock spechash_slock = SIMPLELOCK_INITIALIZER;

View File

@ -1,4 +1,4 @@
/* $NetBSD: lock.h,v 1.40 2000/11/22 06:31:22 thorpej Exp $ */
/* $NetBSD: lock.h,v 1.41 2000/11/24 03:59:09 chs Exp $ */
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@ -296,11 +296,15 @@ void lockmgr_printinfo(__volatile struct lock *);
void spinlock_switchcheck(void);
#endif
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
#define spinlockinit(lkp, name, flags) \
lockinit((lkp), 0, (name), 0, (flags) | LK_SPIN)
#define spinlockmgr(lkp, flags, intrlk) \
lockmgr((lkp), (flags) | LK_SPIN, (intrlk))
#else
#define spinlockinit(lkp, name, flags) (void)(lkp)
#define spinlockmgr(lkp, flags, intrlk) (0)
#endif
#if defined(LOCKDEBUG)
int _spinlock_release_all(__volatile struct lock *, const char *, int);
@ -340,10 +344,10 @@ void simple_lock_switchcheck(void);
#define LOCK_ASSERT(x) /* nothing */
#else
#define simple_lock_init(alp) (alp)->lock_data = __SIMPLELOCK_UNLOCKED
#define simple_lock(alp) /* nothing */
#define simple_lock_try(alp) (1) /* always succeeds */
#define simple_unlock(alp) /* nothing */
#define LOCK_ASSERT(x) /* nothing */
#define simple_lock(alp) (void)(alp)
#define simple_lock_try(alp) (1)
#define simple_unlock(alp) (void)(alp)
#define LOCK_ASSERT(x) /* nothing */
#endif
#endif /* _KERNEL */