xref: /titanic_41/usr/src/lib/libc/i386/threads/i386.il (revision 6dfee4834394825da35b977ca71cdc965bc7b6a4)
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, Version 1.0 only
6 * (the "License").  You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22/*
23 * Copyright 2005 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	.inline	_curthread, 0
30	movl	%gs:0, %eax
31	.end
32
33	.inline	__curthread, 0
34	xorl	%eax, %eax
35	movw	%gs, %ax
36	andl	%eax, %eax
37	je	1f
38	movl	%gs:0, %eax
391:
40	.end
41
42	.inline	stkptr, 0
43	movl	%esp, %eax
44	.end
45
46	.inline	gethrtime, 0
47	movl	$3, %eax
48	int	$0xd2
49	.end
50
51	.inline	set_lock_byte, 0
52	movl	$1, %eax
53	movl	(%esp), %ecx
54	xchgb	%al, (%ecx)
55	.end
56
57	.inline	cas32, 0
58	movl	0(%esp), %edx
59	movl	4(%esp), %eax
60	movl	8(%esp), %ecx
61	lock
62	cmpxchgl %ecx, (%edx)
63	.end
64
65	.inline	swap32, 0
66	movl	0(%esp), %ecx
67	movl	4(%esp), %eax
68	xchgl	(%ecx), %eax
69	.end
70
71	.inline	incr32, 0
72	movl	0(%esp), %eax
73	lock
74	incl	(%eax)
75	.end
76
77	.inline	decr32, 0
78	movl	0(%esp), %eax
79	lock
80	decl	(%eax)
81	.end
82
83	.inline ht_pause, 0
84	rep			/ "rep nop" is equivalent to "pause"
85	nop
86	.end
87