xref: /titanic_52/usr/src/lib/libc/sparcv9/threads/sparcv9.il (revision 263f549e5da8b32c4922f586afb365b8ae388a6c)
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	atomic_cas_32, 0
56	cas	[%o0], %o1, %o2
57	mov	%o2, %o0
58	.end
59
60	.inline	atomic_swap_32, 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	atomic_inc_32, 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	atomic_dec_32, 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	atomic_and_32, 0
92	ld	[%o0], %o2
931:
94	and	%o2, %o1, %o3
95	cas	[%o0], %o2, %o3
96	cmp	%o2, %o3
97	bne,a,pn %icc, 1b
98	  mov	%o3, %o2
99	.end
100
101	.inline	atomic_or_32, 0
102	ld	[%o0], %o2
1031:
104	or	%o2, %o1, %o3
105	cas	[%o0], %o2, %o3
106	cmp	%o2, %o3
107	bne,a,pn %icc, 1b
108	  mov	%o3, %o2
109	.end
110
111	.inline	caller, 0
112	mov	%i7, %o0
113	.end
114
115	.inline	getfp, 0
116	mov	%fp, %o0
117	.end
118