2 * Copyright (c) 2002 Matthew Dillon. All Rights Reserved.
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions
6 * 1. Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer.
8 * 2. Redistributions in binary form must reproduce the above copyright
9 * notice, this list of conditions and the following disclaimer in the
10 * documentation and/or other materials provided with the distribution.
11 * 4. Neither the name of the University nor the names of its contributors
12 * may be used to endorse or promote products derived from this software
13 * without specific prior written permission.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
21 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 * This file contains prototypes and high-level inlines related to
28 * machine-level critical function support:
30 * cpu_critical_enter() - inlined
31 * cpu_critical_exit() - inlined
32 * cpu_critical_fork_exit() - prototyped
33 * related support functions residing
34 * in <arch>/<arch>/critical.c - prototyped
39 #ifndef _MACHINE_CRITICAL_H_
40 #define _MACHINE_CRITICAL_H_
45 * Prototypes - see <arch>/<arch>/critical.c
47 void cpu_critical_fork_exit(void);
54 * This routine is called from critical_enter() on the 0->1 transition
55 * of td_critnest, prior to it being incremented to 1.
58 cpu_critical_enter(void)
60 curthread->td_md.md_savecrit = intr_disable();
66 * This routine is called from critical_exit() on a 1->0 transition
67 * of td_critnest, after it has been decremented to 0. We are
68 * exiting the last critical section.
71 cpu_critical_exit(void)
73 intr_restore(curthread->td_md.md_savecrit);
78 void cpu_critical_enter(void);
79 void cpu_critical_exit(void);
85 #endif /* !_MACHINE_CRITICAL_H_ */