clarify the purpose of this project
[nyanglibc.git] / nptl / elision-lock.shared.s
blob28883049f003882d8882319ceb35d4395444b16a
1 .text
2 .p2align 4,,15
3 .globl _dl_tunable_set_elision_skip_lock_busy
4 .type _dl_tunable_set_elision_skip_lock_busy, @function
5 _dl_tunable_set_elision_skip_lock_busy:
6 movq (%rdi), %rax
7 movl %eax, __elision_aconf(%rip)
8 ret
9 .size _dl_tunable_set_elision_skip_lock_busy, .-_dl_tunable_set_elision_skip_lock_busy
10 .p2align 4,,15
11 .globl _dl_tunable_set_elision_skip_lock_internal_abort
12 .type _dl_tunable_set_elision_skip_lock_internal_abort, @function
13 _dl_tunable_set_elision_skip_lock_internal_abort:
14 movq (%rdi), %rax
15 movl %eax, 4+__elision_aconf(%rip)
16 ret
17 .size _dl_tunable_set_elision_skip_lock_internal_abort, .-_dl_tunable_set_elision_skip_lock_internal_abort
18 .p2align 4,,15
19 .globl _dl_tunable_set_elision_retry_try_xbegin
20 .type _dl_tunable_set_elision_retry_try_xbegin, @function
21 _dl_tunable_set_elision_retry_try_xbegin:
22 movq (%rdi), %rax
23 movl %eax, 8+__elision_aconf(%rip)
24 ret
25 .size _dl_tunable_set_elision_retry_try_xbegin, .-_dl_tunable_set_elision_retry_try_xbegin
26 .p2align 4,,15
27 .globl _dl_tunable_set_elision_skip_trylock_internal_abort
28 .type _dl_tunable_set_elision_skip_trylock_internal_abort, @function
29 _dl_tunable_set_elision_skip_trylock_internal_abort:
30 movq (%rdi), %rax
31 movl %eax, 12+__elision_aconf(%rip)
32 ret
33 .size _dl_tunable_set_elision_skip_trylock_internal_abort, .-_dl_tunable_set_elision_skip_trylock_internal_abort
34 .p2align 4,,15
35 .type elision_init, @function
36 elision_init:
37 pushq %rbx
38 movl $7, %edi
39 subq $16, %rsp
40 movq _dl_tunable_set_elision_enable@GOTPCREL(%rip), %rdx
41 leaq 12(%rsp), %rbx
42 movq %rbx, %rsi
43 call __tunable_get_val@PLT
44 movq _dl_tunable_set_elision_skip_lock_busy@GOTPCREL(%rip), %rdx
45 movq %rbx, %rsi
46 movl $10, %edi
47 call __tunable_get_val@PLT
48 movq _dl_tunable_set_elision_skip_lock_internal_abort@GOTPCREL(%rip), %rdx
49 movq %rbx, %rsi
50 movl $21, %edi
51 call __tunable_get_val@PLT
52 movq _dl_tunable_set_elision_retry_try_xbegin@GOTPCREL(%rip), %rdx
53 movq %rbx, %rsi
54 movl $6, %edi
55 call __tunable_get_val@PLT
56 movq _dl_tunable_set_elision_skip_trylock_internal_abort@GOTPCREL(%rip), %rdx
57 movq %rbx, %rsi
58 movl $17, %edi
59 call __tunable_get_val@PLT
60 movl __pthread_force_elision(%rip), %eax
61 testl %eax, %eax
62 jne .L6
63 movl $0, 8+__elision_aconf(%rip)
64 .L6:
65 addq $16, %rsp
66 popq %rbx
67 ret
68 .size elision_init, .-elision_init
69 .p2align 4,,15
70 .globl _dl_tunable_set_elision_enable
71 .type _dl_tunable_set_elision_enable, @function
72 _dl_tunable_set_elision_enable:
73 cmpl $1, (%rdi)
74 je .L11
75 rep ret
76 .p2align 4,,10
77 .p2align 3
78 .L11:
79 movq _rtld_global_ro@GOTPCREL(%rip), %rax
80 movl 176(%rax), %eax
81 shrl $11, %eax
82 andl $1, %eax
83 movl %eax, __pthread_force_elision(%rip)
84 ret
85 .size _dl_tunable_set_elision_enable, .-_dl_tunable_set_elision_enable
86 .p2align 4,,15
87 .globl __lll_lock_elision
88 .hidden __lll_lock_elision
89 .type __lll_lock_elision, @function
90 __lll_lock_elision:
91 movzwl (%rsi), %eax
92 testw %ax, %ax
93 jg .L13
94 movl 8+__elision_aconf(%rip), %ecx
95 testl %ecx, %ecx
96 jle .L21
97 movl $-1, %r8d
98 jmp .L22
99 .p2align 4,,10
100 .p2align 3
101 .L16:
102 testb $2, %al
103 je .L35
104 subl $1, %ecx
105 je .L21
106 .L22:
107 movl %r8d, %eax
108 xbegin .L15
109 .L15:
110 cmpl $-1, %eax
111 jne .L16
112 movl (%rdi), %eax
113 testl %eax, %eax
114 je .L32
115 xabort $255
116 subl $1, %ecx
117 jne .L22
118 .p2align 4,,10
119 .p2align 3
120 .L21:
121 xorl %eax, %eax
122 movl $1, %ecx
123 lock cmpxchgl %ecx, (%rdi)
124 jne .L30
125 .L32:
126 xorl %eax, %eax
128 .p2align 4,,10
129 .p2align 3
130 .L13:
131 movzwl (%rsi), %eax
132 subl $1, %eax
133 movw %ax, (%rsi)
134 jmp .L21
135 .p2align 4,,10
136 .p2align 3
137 .L35:
138 testb $1, %al
139 je .L20
140 shrl $24, %eax
141 cmpl $255, %eax
142 je .L36
143 .L20:
144 movswl (%rsi), %eax
145 movl 4+__elision_aconf(%rip), %ecx
146 cmpl %ecx, %eax
147 je .L21
148 .L34:
149 movw %cx, (%rsi)
150 jmp .L21
151 .L30:
152 subq $8, %rsp
153 movl %edx, %esi
154 call __lll_lock_wait
155 xorl %eax, %eax
156 addq $8, %rsp
158 .L36:
159 movswl (%rsi), %eax
160 movl __elision_aconf(%rip), %ecx
161 cmpl %ecx, %eax
162 je .L21
163 jmp .L34
164 .size __lll_lock_elision, .-__lll_lock_elision
165 .globl __pthread_init_array
166 .section .init_array,"aw"
167 .align 8
168 .type __pthread_init_array, @object
169 .size __pthread_init_array, 8
170 __pthread_init_array:
171 .quad elision_init
172 .hidden __pthread_force_elision
173 .globl __pthread_force_elision
174 .bss
175 .align 4
176 .type __pthread_force_elision, @object
177 .size __pthread_force_elision, 4
178 __pthread_force_elision:
179 .zero 4
180 .hidden __elision_aconf
181 .globl __elision_aconf
182 .data
183 .align 16
184 .type __elision_aconf, @object
185 .size __elision_aconf, 16
186 __elision_aconf:
187 .long 3
188 .long 3
189 .long 3
190 .long 3
191 .hidden __lll_lock_wait