2 * Copyright (c) 2010 Apple Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
27 // returns address of TLV in
%rax
, all other registers preserved
29 .private_extern _tlv_get_addr
31 movq
8(%rdi
),%rax
// get key from descriptor
32 movq
%gs
:0x0(,%rax
,8),%rax
// get thread value
33 testq
%rax
,%rax
// if NULL
, lazily allocate
35 addq
16(%rdi
),%rax
// add offset from descriptor
50 movq
8(%rdi
),%rdi
// get key from descriptor
51 call _tlv_allocate_and_initialize_for_key
61 addq
16(%rdi
),%rax
// result
= buffer
+ offset
70 // returns address of TLV in
%eax
, all other registers
(except
%ecx
) preserved
72 .private_extern _tlv_get_addr
74 movl
4(%eax
),%ecx
// get key from descriptor
75 movl
%gs
:0x0(,%ecx
,4),%ecx
// get thread value
76 testl
%ecx
,%ecx
// if NULL
, lazily allocate
78 movl
8(%eax
),%eax
// add offset from descriptor
84 pushl
%edx
// save edx
86 movl
%eax
,-8(%ebp
) // save descriptor
87 lea
-528(%ebp
),%ecx
// get
512 byte buffer in frame
88 and $
-16, %ecx
// 16-byte align buffer for fxsave
90 movl
4(%eax
),%ecx
// get key from descriptor
91 movl
%ecx
,(%esp
) // push key parameter
, also leaves stack aligned properly
92 call _tlv_allocate_and_initialize_for_key
93 movl
-8(%ebp
),%ecx
// get descriptor
94 movl
8(%ecx
),%ecx
// get offset from descriptor
95 addl
%ecx
,%eax
// add offset to buffer
97 and $
-16, %ecx
// 16-byte align buffer for fxrstor
100 popl
%edx
// restore edx
108 // returns address of TLV in
r0, all other registers preserved
110 .private_extern _tlv_get_addr
112 push
{r1,r2,r3,r7,lr}
113 mov
r7,r0 // save descriptor in
r7
114 ldr
r0, [r7, #4] // get key from descriptor
115 bl _pthread_getspecific
// get thread value
117 bne L2
// if NULL
, lazily allocate
118 ldr
r0, [r7, #4] // get key from descriptor
119 bl _tlv_allocate_and_initialize_for_key
120 L2
: ldr
r1, [r7, #8] // get offset from descriptor
121 add r0, r1, r0 // add offset into allocation block