xref: /titanic_41/usr/src/lib/libc/common/sys/syslwp.s (revision 59ac0c1669407488b67ae9e273667a340dccc611)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24 * Use is subject to license terms.
25 */
26
27#pragma ident	"%Z%%M%	%I%	%E% SMI"
28
29	.file	"%M%"
30
31#include <sys/asm_linkage.h>
32
33	ANSI_PRAGMA_WEAK(_lwp_continue,function)
34	ANSI_PRAGMA_WEAK(_lwp_kill,function)
35	ANSI_PRAGMA_WEAK(_lwp_self,function)
36	ANSI_PRAGMA_WEAK(_lwp_cond_broadcast,function)
37	ANSI_PRAGMA_WEAK(_lwp_cond_signal,function)
38	ANSI_PRAGMA_WEAK(_lwp_sema_trywait,function)
39	ANSI_PRAGMA_WEAK(_lwp_sema_post,function)
40	ANSI_PRAGMA_WEAK(_lwp_info,function)
41
42#include "SYS.h"
43
44/*
45 * int
46 * __lwp_create(ucontext_t *uc, unsigned long flags, lwpid_t *lwpidp)
47 */
48	ENTRY(__lwp_create)
49	SYSTRAP_RVAL1(lwp_create)
50	SYSLWPERR
51	RET
52	SET_SIZE(__lwp_create)
53
54/*
55 * int
56 * __lwp_continue(lwpid_t lwpid)
57 */
58	ENTRY(__lwp_continue)
59	SYSTRAP_RVAL1(lwp_continue)
60	SYSLWPERR
61	RET
62	SET_SIZE(__lwp_continue)
63
64/*
65 * int
66 * ___lwp_suspend(lwpid_t lwpid)
67 */
68	SYSREENTRY(___lwp_suspend)
69	SYSTRAP_RVAL1(lwp_suspend)
70	SYSINTR_RESTART(.restart____lwp_suspend)
71	RET
72	SET_SIZE(___lwp_suspend)
73
74/*
75 * int
76 * __lwp_kill(lwpid_t lwpid, int sig)
77 */
78	ENTRY(__lwp_kill)
79	SYSTRAP_RVAL1(lwp_kill)
80	SYSLWPERR
81	RET
82	SET_SIZE(__lwp_kill)
83
84/*
85 * lwpid_t
86 * __lwp_self(void)
87 */
88	ENTRY(__lwp_self)
89	SYSTRAP_RVAL1(lwp_self)
90	RET
91	SET_SIZE(__lwp_self)
92
93/*
94 * int
95 * __lwp_wait(lwpid_t lwpid, lwpid_t *departed)
96 */
97	ENTRY(__lwp_wait)
98	SYSTRAP_RVAL1(lwp_wait)
99	SYSLWPERR
100	RET
101	SET_SIZE(__lwp_wait)
102
103/*
104 * int
105 * __lwp_detach(lwpid_t lwpid)
106 */
107	ENTRY(__lwp_detach)
108	SYSTRAP_RVAL1(lwp_detach)
109	SYSLWPERR
110	RET
111	SET_SIZE(__lwp_detach)
112
113/*
114 * The ___lwp_mutex_timedlock() and ___lwp_mutex_wakeup() functions
115 * are called while holding non-preemptive spin locks and we must
116 * not call out of the library while holding such locks in order
117 * to avoid invoking the dynamic linker.  For this reason, these
118 * functions must never become exported symbols from the library.
119 */
120
121/*
122 * int
123 * ___lwp_mutex_timedlock(lwp_mutex_t *, timespec_t *)
124 */
125	SYSREENTRY(___lwp_mutex_timedlock)
126	SYSTRAP_RVAL1(lwp_mutex_timedlock)
127	SYSINTR_RESTART(.restart____lwp_mutex_timedlock)
128	RET
129	SET_SIZE(___lwp_mutex_timedlock)
130
131/*
132 * int
133 * ___lwp_mutex_wakeup(lwp_mutex_t *mp, int)
134 */
135	ENTRY(___lwp_mutex_wakeup)
136	SYSTRAP_RVAL1(lwp_mutex_wakeup)
137	SYSLWPERR
138	RET
139	SET_SIZE(___lwp_mutex_wakeup)
140
141/*
142 * int
143 * __lwp_cond_broadcast(lwp_cond_t *cvp)
144 */
145	ENTRY(__lwp_cond_broadcast)
146	SYSTRAP_RVAL1(lwp_cond_broadcast)
147	SYSLWPERR
148	RET
149	SET_SIZE(__lwp_cond_broadcast)
150
151/*
152 * int
153 * ___lwp_cond_wait(lwp_cond_t *, lwp_mutex_t *, timespec_t *, int)
154 */
155	ENTRY(___lwp_cond_wait)
156	SYSTRAP_RVAL1(lwp_cond_wait)
157	SYSLWPERR
158	RET
159	SET_SIZE(___lwp_cond_wait)
160
161/*
162 * int
163 * __lwp_cond_signal(lwp_cond_t *cvp)
164 */
165	ENTRY(__lwp_cond_signal)
166	SYSTRAP_RVAL1(lwp_cond_signal)
167	SYSLWPERR
168	RET
169	SET_SIZE(__lwp_cond_signal)
170
171/*
172 * int
173 * ___lwp_sema_timedwait(lwp_sema_t *, timespec_t *, int check_park)
174 */
175	ENTRY(___lwp_sema_timedwait)
176	SYSTRAP_RVAL1(lwp_sema_timedwait)
177	SYSLWPERR
178	RET
179	SET_SIZE(___lwp_sema_timedwait)
180
181/*
182 * int
183 * __lwp_sema_trywait(lwp_sema_t *sp)
184 */
185	ENTRY(__lwp_sema_trywait)
186	SYSTRAP_RVAL1(lwp_sema_trywait)
187	SYSLWPERR
188	RET
189	SET_SIZE(__lwp_sema_trywait)
190
191/*
192 * int
193 * __lwp_sema_post(lwp_sema_t *sp)
194 */
195	ENTRY(__lwp_sema_post)
196	SYSTRAP_RVAL1(lwp_sema_post)
197	SYSLWPERR
198	RET
199	SET_SIZE(__lwp_sema_post)
200
201/*
202 * int
203 * __lwp_info(struct lwpinfo *infop)
204 */
205	ENTRY(__lwp_info)
206	SYSTRAP_RVAL1(lwp_info)
207	SYSLWPERR
208	RET
209	SET_SIZE(__lwp_info)
210
211/*
212 * sc_shared_t *
213 * __schedctl(void)
214 */
215	SYSCALL2_RVAL1(__schedctl,schedctl)
216	RET
217	SET_SIZE(__schedctl)
218
219/*
220 * int
221 * ___lwp_mutex_trylock(lwp_mutex_t *mp)
222 */
223	ENTRY(___lwp_mutex_trylock)
224	SYSTRAP_RVAL1(lwp_mutex_trylock)
225	SYSLWPERR
226	RET
227	SET_SIZE(___lwp_mutex_trylock)
228
229/*
230 * int
231 * ___lwp_mutex_unlock(lwp_mutex_t *mp)
232 */
233	ENTRY(___lwp_mutex_unlock)
234	SYSTRAP_RVAL1(lwp_mutex_unlock)
235	SYSLWPERR
236	RET
237	SET_SIZE(___lwp_mutex_unlock)
238
239/*
240 * int
241 * ___lwp_mutex_register(lwp_mutex_t *mp)
242 */
243	ENTRY(___lwp_mutex_register)
244	SYSTRAP_RVAL1(lwp_mutex_register)
245	SYSLWPERR
246	RET
247	SET_SIZE(___lwp_mutex_register)
248