xref: /titanic_41/usr/src/lib/libc/i386/threads/i386.il (revision 7c2fbfb345896881c631598ee3852ce9ce33fb07)
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 * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23 * Use is subject to license terms.
24 */
25
26#pragma ident	"%Z%%M%	%I%	%E% SMI"
27
28	.inline	_curthread, 0
29	movl	%gs:0, %eax
30	.end
31
32	.inline	__curthread, 0
33	movl	%gs:0, %eax
34	.end
35
36	.inline	stkptr, 0
37	movl	%esp, %eax
38	.end
39
40	.inline	gethrtime, 0
41	movl	$3, %eax
42	int	$0xd2
43	.end
44
45	.inline	set_lock_byte, 0
46	movl	$1, %eax
47	movl	(%esp), %ecx
48	xchgb	%al, (%ecx)
49	.end
50
51	.inline	atomic_cas_32, 0
52	movl	0(%esp), %edx
53	movl	4(%esp), %eax
54	movl	8(%esp), %ecx
55	lock
56	cmpxchgl %ecx, (%edx)
57	.end
58
59	.inline	atomic_swap_32, 0
60	movl	0(%esp), %ecx
61	movl	4(%esp), %eax
62	xchgl	(%ecx), %eax
63	.end
64
65	.inline	atomic_inc_32, 0
66	movl	0(%esp), %eax
67	lock
68	incl	(%eax)
69	.end
70
71	.inline	atomic_dec_32, 0
72	movl	0(%esp), %eax
73	lock
74	decl	(%eax)
75	.end
76
77	.inline	atomic_and_32, 0
78	movl	0(%esp), %ecx
79	movl	4(%esp), %eax
80	lock
81	andl	%eax, (%ecx)
82	.end
83
84	.inline	atomic_or_32, 0
85	movl	0(%esp), %ecx
86	movl	4(%esp), %eax
87	lock
88	orl	%eax, (%ecx)
89	.end
90
91	.inline ht_pause, 0
92	rep			/ "rep nop" is equivalent to "pause"
93	nop
94	.end
95