kernel tree reorganization stage 1: Major cvs repository work (not logged as
[dragonfly.git] / sys / i386 / i386 / spinlock.s
CommitLineData
8a8d5d85
MD
1/*-
2 * Copyright (c) 2003, by Matthew dillon <dillon@backplane.com> All Rights Reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. The name of the developer may NOT be used to endorse or promote products
10 * derived from this software without specific prior written permission.
11 *
12 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
13 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
16 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
18 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
22 * SUCH DAMAGE.
23 *
24 * $FreeBSD: src/sys/i386/i386/simplelock.s,v 1.11.2.2 2003/02/04 20:55:28 jhb Exp $
25 * $DragonFly: src/sys/i386/i386/Attic/spinlock.s,v 1.1 2003/07/06 21:23:48 dillon Exp $
26 */
27
28#include <machine/asmacros.h> /* miscellaneous macros */
29#include <machine/lock.h>
30
31/*
32 * The spinlock routines may only be used for low level debugging, like
33 * kernel printfs, and when no other option is available such as situations
34 * relating to hardware interrupt masks. Spinlock routines should not be
35 * used in interrupt service routines or in any other situation.
36 *
37 * NOTE: for UP the spinlock routines still disable/restore interrupts
38 */
39ENTRY(spin_lock)
40 movl 4(%esp),%edx
41 SPIN_LOCK((%edx)) /* note: %eax, %ecx tromped */
42 ret
43
44ENTRY(spin_unlock)
45 movl 4(%esp),%edx
46 SPIN_UNLOCK((%edx)) /* note: %eax, %ecx tromped */
47 ret
48
49NON_GPROF_ENTRY(spin_lock_np)
50 movl 4(%esp),%edx
51 SPIN_LOCK((%edx)) /* note: %eax, %ecx tromped */
52 NON_GPROF_RET
53
54NON_GPROF_ENTRY(spin_unlock_np)
55 movl 4(%esp), %edx /* get the address of the lock */
56 SPIN_UNLOCK((%edx))
57 NON_GPROF_RET
58
59/*
60 * Auxillary convenience routines. Note that these functions disable and
61 * restore interrupts as well, on SMP, as performing spin locking functions.
62 */
63NON_GPROF_ENTRY(imen_lock)
64 SPIN_LOCK(imen_spinlock)
65 NON_GPROF_RET
66
67NON_GPROF_ENTRY(imen_unlock)
68 SPIN_UNLOCK(imen_spinlock)
69 NON_GPROF_RET
70
71NON_GPROF_ENTRY(intr_lock)
72 SPIN_LOCK(intr_spinlock)
73 NON_GPROF_RET
74
75NON_GPROF_ENTRY(intr_unlock)
76 SPIN_UNLOCK(intr_spinlock)
77 NON_GPROF_RET
78
79NON_GPROF_ENTRY(mpintr_lock)
80 SPIN_LOCK(mpintr_spinlock)
81 NON_GPROF_RET
82
83NON_GPROF_ENTRY(mpintr_unlock)
84 SPIN_UNLOCK(mpintr_spinlock)
85 NON_GPROF_RET
86
87NON_GPROF_ENTRY(clock_lock)
88 SPIN_LOCK(clock_spinlock)
89 NON_GPROF_RET
90
91NON_GPROF_ENTRY(clock_unlock)
92 SPIN_UNLOCK(clock_spinlock)
93 NON_GPROF_RET
94
95NON_GPROF_ENTRY(com_lock)
96 SPIN_LOCK(com_spinlock)
97 NON_GPROF_RET
98
99NON_GPROF_ENTRY(com_unlock)
100 SPIN_UNLOCK(com_spinlock)
101 NON_GPROF_RET
102
103NON_GPROF_ENTRY(cons_lock)
104 SPIN_LOCK(cons_spinlock)
105 NON_GPROF_RET
106
107NON_GPROF_ENTRY(cons_unlock)
108 SPIN_UNLOCK(cons_spinlock)
109 NON_GPROF_RET
110