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.
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.
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]
22 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 .file "tls_get_addr.s"
29 * To make thread-local storage accesses as fast as possible, we
30 * hand-craft the __tls_get_addr() function below, from this C code:
32 * __tls_get_addr(TLS_index *tls_index)
34 * ulwp_t *self = curthread;
35 * tls_t *tlsent = self->ul_tlsent;
39 * if ((moduleid = tls_index->ti_moduleid) < self->ul_ntlsent &&
40 * (base = tlsent[moduleid].tls_data) != NULL)
41 * return (base + tls_index->ti_tlsoffset);
43 * return (slow_tls_get_addr(tls_index));
46 * ___tls_get_addr() is identical to __tls_get_addr() except that it
47 * assumes its argument is passed in %eax rather than on the stack.
53 ENTRY_NP
(__tls_get_addr
)
55 ALTENTRY
(___tls_get_addr
)
56 movl
%gs
:UL_TLSENT
, %edx
57 movl TI_MODULEID
(%eax
), %ecx
58 cmpl %gs
:UL_NTLSENT
, %ecx
60 movl TLS_DATA
(%edx
,%ecx
,SIZEOF_TLS_T
), %edx
63 addl TI_TLSOFFSET
(%eax
), %edx
70 call slow_tls_get_addr
74 SET_SIZE
(___tls_get_addr
)
75 SET_SIZE
(__tls_get_addr
)