From owner-p4-projects@FreeBSD.ORG Sat Mar 20 22:14:36 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5AEFA16A4D0; Sat, 20 Mar 2004 22:14:36 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 34BB616A4CE for ; Sat, 20 Mar 2004 22:14:36 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2AB7043D49 for ; Sat, 20 Mar 2004 22:14:36 -0800 (PST) (envelope-from jmallett@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.10/8.12.10) with ESMTP id i2L6EaGe083174 for ; Sat, 20 Mar 2004 22:14:36 -0800 (PST) (envelope-from jmallett@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.10/8.12.10/Submit) id i2L6EZdV083171 for perforce@freebsd.org; Sat, 20 Mar 2004 22:14:35 -0800 (PST) (envelope-from jmallett@freebsd.org) Date: Sat, 20 Mar 2004 22:14:35 -0800 (PST) Message-Id: <200403210614.i2L6EZdV083171@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jmallett@freebsd.org using -f From: Juli Mallett To: Perforce Change Reviews Subject: PERFORCE change 49442 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2004 06:14:36 -0000 http://perforce.freebsd.org/chv.cgi?CH=49442 Change 49442 by jmallett@jmallett_oingo on 2004/03/20 22:14:04 Critical section madness. Affected files ... .. //depot/projects/mips/sys/mips/include/critical.h#4 edit .. //depot/projects/mips/sys/mips/include/proc.h#4 edit .. //depot/projects/mips/sys/mips/mips/critical.c#2 edit Differences ... ==== //depot/projects/mips/sys/mips/include/critical.h#4 (text+ko) ==== @@ -1,6 +1,28 @@ /*- - * Copyright (c) 2002 Matthew Dillon. This code is distributed under - * the BSD copyright, /usr/src/COPYRIGHT. + * Copyright (c) 2002 Matthew Dillon. All Rights Reserved. + * 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. + * 4. Neither the name of the University 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 AUTHOR ``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 AUTHOR 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. * * This file contains prototypes and high-level inlines related to * machine-level critical function support: @@ -8,23 +30,23 @@ * cpu_critical_enter() - inlined * cpu_critical_exit() - inlined * cpu_critical_fork_exit() - prototyped - * cpu_thread_link() - prototyped * related support functions residing * in //critical.c - prototyped * - * $FreeBSD$ + * $P4: //depot/projects/mips/sys/mips/include/critical.h#4 $ */ #ifndef _MACHINE_CRITICAL_H_ #define _MACHINE_CRITICAL_H_ +#include + __BEGIN_DECLS /* * Prototypes - see //critical.c */ void cpu_critical_fork_exit(void); -void cpu_thread_link(struct thread *td); #ifdef __GNUC__ @@ -34,11 +56,13 @@ * This routine is called from critical_enter() on the 0->1 transition * of td_critnest, prior to it being incremented to 1. */ - static __inline void cpu_critical_enter(void) { - struct thread *td __unused = curthread; + struct thread *td; + + td = curthread; + td->td_md.md_savecrit = intr_disable(); } /* @@ -51,14 +75,16 @@ static __inline void cpu_critical_exit(void) { - struct thread *td __unused = curthread; + struct thread *td; + + td = curthread; + intr_restore(td->td_md.md_savecrit); } - #else /* !__GNUC__ */ -void cpu_critical_enter(void) -void cpu_critical_exit(void) +void cpu_critical_enter(void); +void cpu_critical_exit(void); #endif /* __GNUC__ */ ==== //depot/projects/mips/sys/mips/include/proc.h#4 (text+ko) ==== @@ -33,6 +33,7 @@ }; struct mdthread { + __register_t md_savecrit; /* critical section saved SR */ void *md_regs; /* registers on current frame */ int md_flags; /* machine-dependent flags */ }; ==== //depot/projects/mips/sys/mips/mips/critical.c#2 (text+ko) ==== @@ -1,23 +1,35 @@ /*- - * Copyright (c) 2001 Matthew Dillon. This code is distributed under - * the BSD copyright, /usr/src/COPYRIGHT. + * Copyright (c) 2004 Juli Mallett + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. * - * $FreeBSD: src/sys/sparc64/sparc64/critical.c,v 1.6 2002/06/23 14:38:41 mux Exp $ + * $P4: //depot/projects/mips/sys/mips/mips/critical.c#2 $ */ #include #include -#include -#include /* XX */ -#include /* XX */ -#include -#include /* XX */ #include #include -#include -#include -#include -#include #include /* @@ -26,12 +38,5 @@ void cpu_critical_fork_exit(void) { -} - -/* - * cpu_thread_link() - thread linkup, initialize machine-dependant fields - */ -void -cpu_thread_link(struct thread *td) -{ + panic("%s", __func__); }