PERFORCE change 49442 for review
Juli Mallett
jmallett at FreeBSD.org
Sat Mar 20 22:14:36 PST 2004
http://perforce.freebsd.org/chv.cgi?CH=49442
Change 49442 by jmallett at 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 <arch>/<arch>/critical.c - prototyped
*
- * $FreeBSD$
+ * $P4: //depot/projects/mips/sys/mips/include/critical.h#4 $
*/
#ifndef _MACHINE_CRITICAL_H_
#define _MACHINE_CRITICAL_H_
+#include <machine/cpufunc.h>
+
__BEGIN_DECLS
/*
* Prototypes - see <arch>/<arch>/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 <jmallett at FreeBSD.org>
+ * 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 <sys/param.h>
#include <sys/systm.h>
-#include <sys/pcpu.h>
-#include <sys/eventhandler.h> /* XX */
-#include <sys/ktr.h> /* XX */
-#include <sys/signalvar.h>
-#include <sys/sysproto.h> /* XX */
#include <sys/kernel.h>
#include <sys/proc.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
-#include <sys/sysctl.h>
-#include <sys/ucontext.h>
#include <machine/critical.h>
/*
@@ -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__);
}
More information about the p4-projects
mailing list