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