xref: /titanic_50/usr/src/lib/libc/amd64/threads/amd64.il (revision c77a61a72b5ecdc507d6cf104142edd371a16c84)
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	.inline	_curthread, 0
29	movq	%fs:0, %rax
30	.end
31
32	.inline	__curthread, 0
33	xorq	%rax, %rax
34	movw	%fs, %ax
35	andq	%rax, %rax
36	je	1f
37	movq	%fs:0, %rax
381:
39	.end
40
41	.inline	stkptr, 0
42	movq	%rsp, %rax
43	.end
44
45	.inline	gethrtime, 0
46	movl	$3, %eax
47	int	$0xd2
48	.end
49
50	.inline	set_lock_byte, 0
51	movl	$1, %eax
52	xchgb	%al, (%rdi)
53	.end
54
55	.inline	cas32, 0
56	movl	%esi, %eax
57	lock
58	cmpxchgl %edx, (%rdi)
59	.end
60
61	.inline	swap32, 0
62	movl	%esi, %eax
63	xchgl	(%rdi), %eax
64	.end
65
66	.inline	incr32, 0
67	lock
68	incl	(%rdi)
69	.end
70
71	.inline	decr32, 0
72	lock
73	decl	(%rdi)
74	.end
75
76	.inline ht_pause, 0
77	rep			/ "rep nop" is equivalent to "pause"
78	nop
79	.end
80