From f555536d9b95780fbc3b9ae1aaed55ecca434532 Mon Sep 17 00:00:00 2001 From: fvdl Date: Sat, 1 Mar 2003 22:53:39 +0000 Subject: [PATCH] Move lock_machdep.c to arch/x86/x86. --- sys/arch/i386/conf/files.i386 | 3 +- sys/arch/i386/i386/lock_machdep.c | 143 ------------------------------ 2 files changed, 1 insertion(+), 145 deletions(-) delete mode 100644 sys/arch/i386/i386/lock_machdep.c diff --git a/sys/arch/i386/conf/files.i386 b/sys/arch/i386/conf/files.i386 index 24d02b9bbd94..7c72fa94b3df 100644 --- a/sys/arch/i386/conf/files.i386 +++ b/sys/arch/i386/conf/files.i386 @@ -1,4 +1,4 @@ -# $NetBSD: files.i386,v 1.233 2003/03/01 16:37:51 fvdl Exp $ +# $NetBSD: files.i386,v 1.234 2003/03/01 22:53:39 fvdl Exp $ # # new style config file for i386 architecture # @@ -90,7 +90,6 @@ file arch/i386/i386/vm_machdep.c file dev/cons.c file arch/i386/i386/mptramp.S multiprocessor -file arch/i386/i386/lock_machdep.c lockdebug file arch/i386/i386/ipifuncs.c multiprocessor file arch/i386/i386/pmc.c perfctrs diff --git a/sys/arch/i386/i386/lock_machdep.c b/sys/arch/i386/i386/lock_machdep.c deleted file mode 100644 index 6dd9b3b641a4..000000000000 --- a/sys/arch/i386/i386/lock_machdep.c +++ /dev/null @@ -1,143 +0,0 @@ -/* $NetBSD: lock_machdep.c,v 1.4 2003/02/26 21:28:22 fvdl Exp $ */ - -/*- - * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, - * NASA Ames Research Center. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include /* RCS ID & Copyright macro defns */ - -/* - * Machine-dependent spin lock operations. - */ - -#include "opt_ddb.h" - -#include -#include -#include - -#include -#include - -#include - -void -__cpu_simple_lock_init(lockp) - __cpu_simple_lock_t *lockp; -{ - - *lockp = __SIMPLELOCK_UNLOCKED; -} - -#if defined (DEBUG) && defined(DDB) -int spin_limit = 10000000; -__cpu_simple_lock_t *wantlock[X86_MAXPROCS], *gotlock[X86_MAXPROCS]; -#endif - -void -__cpu_simple_lock(lockp) - __cpu_simple_lock_t *lockp; -{ -#if defined (DEBUG) -#if defined(DDB) - int spincount = 0; - int cpu = cpu_number(); - int limit = spin_limit * (cpu + 1); -#endif - __cpu_simple_lock_t v = *lockp; - - KDASSERT((v == __SIMPLELOCK_LOCKED) || (v == __SIMPLELOCK_UNLOCKED)); -#if defined(DDB) - wantlock[cpu] = lockp; -#endif -#endif - - while (x86_atomic_testset_i(lockp, __SIMPLELOCK_LOCKED) == - __SIMPLELOCK_LOCKED) { -#if defined(DEBUG) && defined(DDB) - spincount++; - if (spincount == limit) { - extern int db_active; - spincount = 0; - - if (db_active) { - db_printf("cpu%d: spinout while in debugger\n", - cpu); - while (db_active) - ; - } - db_printf("cpu%d: spinout\n", cpu); - Debugger(); - } -#endif - } -#if defined(DEBUG) && defined(DDB) - wantlock[cpu] = 0; - gotlock[cpu] = lockp; -#endif - __lockbarrier(); -} - -int -__cpu_simple_lock_try(lockp) - __cpu_simple_lock_t *lockp; -{ - int r; -#ifdef DEBUG - __cpu_simple_lock_t v = *lockp; - - KDASSERT((v == __SIMPLELOCK_LOCKED) || (v == __SIMPLELOCK_UNLOCKED)); -#endif - r = (x86_atomic_testset_i(lockp, __SIMPLELOCK_LOCKED) - == __SIMPLELOCK_UNLOCKED); - - __lockbarrier(); - - return (r); -} - -void -__cpu_simple_unlock(lockp) - __cpu_simple_lock_t *lockp; -{ -#ifdef DEBUG - __cpu_simple_lock_t v = *lockp; - - KDASSERT((v == __SIMPLELOCK_LOCKED) || (v == __SIMPLELOCK_UNLOCKED)); -#endif - __lockbarrier(); - *lockp = __SIMPLELOCK_UNLOCKED; -}