xref: /titanic_50/usr/src/lib/libc/sparcv9/threads/sparcv9.il (revision bb121940c2fe627557326e0143391ace6e6b7372)
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	.register %g7, #scratch
30	mov	%g7, %o0
31	.end
32
33	.inline	__curthread, 0
34	.register %g7, #scratch
35	ldx	[%g7 + 80], %o0		! ul_self
36	.end
37
38	.inline	stkptr, 0
39	mov	%sp, %o0
40	.end
41
42	.inline	gethrtime, 0
43	.volatile
44	ta	0x24
45	sllx	%o0, 32, %o0
46	or	%o1, %o0, %o0
47	.nonvolatile
48	.end
49
50	.inline	set_lock_byte, 0
51	ldstub	[%o0], %o0
52	membar	#LoadLoad
53	.end
54
55	.inline	cas32, 0
56	cas	[%o0], %o1, %o2
57	mov	%o2, %o0
58	.end
59
60	.inline	swap32, 0
61	ld	[%o0], %o2
621:
63	mov	%o1, %o3
64	cas	[%o0], %o2, %o3
65	cmp	%o2, %o3
66	bne,a,pn %icc, 1b
67	  mov	%o3, %o2
68	mov	%o3, %o0
69	.end
70
71	.inline	incr32, 0
72	ld	[%o0], %o2
731:
74	add	%o2, 1, %o3
75	cas	[%o0], %o2, %o3
76	cmp	%o2, %o3
77	bne,a,pn %icc, 1b
78	  mov	%o3, %o2
79	.end
80
81	.inline	decr32, 0
82	ld	[%o0], %o2
831:
84	sub	%o2, 1, %o3
85	cas	[%o0], %o2, %o3
86	cmp	%o2, %o3
87	bne,a,pn %icc, 1b
88	  mov	%o3, %o2
89	.end
90
91	.inline	caller, 0
92	mov	%i7, %o0
93	.end
94
95	.inline	getfp, 0
96	mov	%fp, %o0
97	.end
98