clarify the purpose of this project
[nyanglibc.git] / rt / mq_notify.shared.s
blobe2230d7bba0834609777f7976e61491226128574
1 .text
2 .p2align 4,,15
3 .type reset_once, @function
4 reset_once:
5 movl $0, once(%rip)
6 ret
7 .size reset_once, .-reset_once
8 .p2align 4,,15
9 .type helper_thread, @function
10 helper_thread:
11 pushq %r12
12 pushq %rbp
13 leaq notification_function(%rip), %rbp
14 pushq %rbx
15 subq $48, %rsp
16 leaq 16(%rsp), %rbx
17 leaq 8(%rsp), %r12
18 .p2align 4,,10
19 .p2align 3
20 .L5:
21 movl netlink_socket(%rip), %edi
22 movl $16640, %ecx
23 movl $32, %edx
24 movq %rbx, %rsi
25 call __recv@PLT
26 cmpq $31, %rax
27 jle .L5
28 movzbl 47(%rsp), %eax
29 cmpb $1, %al
30 je .L10
31 cmpb $2, %al
32 jne .L5
33 movq 32(%rsp), %rdi
34 call free@PLT
35 jmp .L5
36 .p2align 4,,10
37 .p2align 3
38 .L10:
39 movq 32(%rsp), %rsi
40 movq %rbx, %rcx
41 movq %rbp, %rdx
42 movq %r12, %rdi
43 call pthread_create@PLT
44 testl %eax, %eax
45 jne .L5
46 leaq notify_barrier(%rip), %rdi
47 call __pthread_barrier_wait@PLT
48 jmp .L5
49 .size helper_thread, .-helper_thread
50 .p2align 4,,15
51 .type change_sigmask, @function
52 change_sigmask:
53 pushq %r12
54 pushq %rbp
55 movq %rsi, %r12
56 pushq %rbx
57 movl %edi, %ebp
58 addq $-128, %rsp
59 movq %rsp, %rbx
60 movq %rbx, %rdi
61 call sigfillset@PLT
62 movq %r12, %rdx
63 movq %rbx, %rsi
64 movl %ebp, %edi
65 call pthread_sigmask@PLT
66 subq $-128, %rsp
67 popq %rbx
68 popq %rbp
69 popq %r12
70 ret
71 .size change_sigmask, .-change_sigmask
72 .p2align 4,,15
73 .type notification_function, @function
74 notification_function:
75 pushq %rbp
76 pushq %rbx
77 subq $8, %rsp
78 movq (%rdi), %rbx
79 movq 8(%rdi), %rbp
80 leaq notify_barrier(%rip), %rdi
81 call __pthread_barrier_wait@PLT
82 call pthread_self@PLT
83 movq %rax, %rdi
84 call pthread_detach@PLT
85 xorl %esi, %esi
86 movl $1, %edi
87 call change_sigmask
88 movq %rbp, %rdi
89 call *%rbx
90 addq $8, %rsp
91 xorl %eax, %eax
92 popq %rbx
93 popq %rbp
94 ret
95 .size notification_function, .-notification_function
96 .p2align 4,,15
97 .type init_mq_netlink, @function
98 init_mq_netlink:
99 pushq %r13
100 pushq %r12
101 pushq %rbp
102 pushq %rbx
103 subq $216, %rsp
104 cmpl $-1, netlink_socket(%rip)
105 je .L16
106 .L20:
107 leaq notify_barrier(%rip), %rdi
108 xorl %esi, %esi
109 movl $2, %edx
110 call __pthread_barrier_init@PLT
111 testl %eax, %eax
112 je .L31
113 .L18:
114 movl netlink_socket(%rip), %edi
115 call __close_nocancel@PLT
116 movl $-1, netlink_socket(%rip)
117 .L15:
118 addq $216, %rsp
119 popq %rbx
120 popq %rbp
121 popq %r12
122 popq %r13
124 .p2align 4,,10
125 .p2align 3
126 .L16:
127 xorl %edx, %edx
128 movl $524291, %esi
129 movl $16, %edi
130 call __socket@PLT
131 cmpl $-1, %eax
132 movl %eax, netlink_socket(%rip)
133 jne .L20
134 addq $216, %rsp
135 popq %rbx
136 popq %rbp
137 popq %r12
138 popq %r13
140 .p2align 4,,10
141 .p2align 3
142 .L31:
143 leaq 16(%rsp), %rbx
144 leaq 80(%rsp), %rbp
145 movq %rbx, %rdi
146 call pthread_attr_init@PLT
147 movl $1, %esi
148 movq %rbx, %rdi
149 call pthread_attr_setdetachstate@PLT
150 movq %rbx, %rdi
151 call __pthread_get_minstack@PLT
152 movq %rbx, %rdi
153 movq %rax, %rsi
154 call pthread_attr_setstacksize@PLT
155 xorl %edi, %edi
156 movq %rbp, %rsi
157 call change_sigmask
158 leaq 8(%rsp), %rdi
159 leaq helper_thread(%rip), %rdx
160 movl %eax, %r13d
161 xorl %ecx, %ecx
162 movq %rbx, %rsi
163 call pthread_create@PLT
164 testl %r13d, %r13d
165 movl %eax, %r12d
166 je .L32
167 .L21:
168 movq %rbx, %rdi
169 call pthread_attr_destroy@PLT
170 testl %r12d, %r12d
171 jne .L18
172 movl added_atfork.9066(%rip), %eax
173 testl %eax, %eax
174 je .L33
175 .L23:
176 movl $1, added_atfork.9066(%rip)
177 jmp .L15
178 .p2align 4,,10
179 .p2align 3
180 .L32:
181 xorl %edx, %edx
182 movq %rbp, %rsi
183 movl $2, %edi
184 call pthread_sigmask@PLT
185 jmp .L21
186 .p2align 4,,10
187 .p2align 3
188 .L33:
189 leaq reset_once(%rip), %rdx
190 xorl %esi, %esi
191 xorl %edi, %edi
192 call pthread_atfork@PLT
193 testl %eax, %eax
194 je .L23
195 movq 8(%rsp), %rdi
196 call pthread_cancel@PLT
197 jmp .L18
198 .size init_mq_netlink, .-init_mq_netlink
199 .p2align 4,,15
200 .globl mq_notify
201 .type mq_notify, @function
202 mq_notify:
203 pushq %r12
204 pushq %rbp
205 pushq %rbx
206 subq $96, %rsp
207 testq %rsi, %rsi
208 je .L35
209 cmpl $2, 12(%rsi)
210 je .L36
211 .L35:
212 movl $244, %eax
213 #APP
214 # 226 "../sysdeps/unix/sysv/linux/mq_notify.c" 1
215 syscall
217 # 0 "" 2
218 #NO_APP
219 cmpq $-4096, %rax
220 ja .L37
221 movl %eax, %ebx
222 .L34:
223 addq $96, %rsp
224 movl %ebx, %eax
225 popq %rbx
226 popq %rbp
227 popq %r12
229 .p2align 4,,10
230 .p2align 3
231 .L36:
232 movq %rsi, %rbp
233 movl %edi, %r12d
234 leaq init_mq_netlink(%rip), %rsi
235 leaq once(%rip), %rdi
236 call pthread_once@PLT
237 movl netlink_socket(%rip), %ebx
238 cmpl $-1, %ebx
239 je .L52
240 movq 16(%rbp), %rax
241 pxor %xmm0, %xmm0
242 movq %rax, (%rsp)
243 movq 0(%rbp), %rax
244 movq 24(%rbp), %rbp
245 movaps %xmm0, 16(%rsp)
246 movq %rax, 8(%rsp)
247 testq %rbp, %rbp
248 je .L41
249 movl $56, %edi
250 call malloc@PLT
251 testq %rax, %rax
252 movq %rax, 16(%rsp)
253 je .L44
254 movdqu 0(%rbp), %xmm0
255 movups %xmm0, (%rax)
256 movdqu 16(%rbp), %xmm0
257 movups %xmm0, 16(%rax)
258 movdqu 32(%rbp), %xmm0
259 movups %xmm0, 32(%rax)
260 movq 48(%rbp), %rdx
261 movq %rdx, 48(%rax)
262 .L41:
263 movq %rsp, %rax
264 movl $2, 44(%rsp)
265 movl %ebx, 40(%rsp)
266 movq %rax, 32(%rsp)
267 leaq 32(%rsp), %rsi
268 movl %r12d, %edi
269 movl $244, %eax
270 #APP
271 # 269 "../sysdeps/unix/sysv/linux/mq_notify.c" 1
272 syscall
274 # 0 "" 2
275 #NO_APP
276 cmpq $-4096, %rax
277 ja .L53
278 testl %eax, %eax
279 movl %eax, %ebx
280 je .L34
281 .p2align 4,,10
282 .p2align 3
283 .L43:
284 movq 16(%rsp), %rdi
285 call free@PLT
286 jmp .L34
287 .p2align 4,,10
288 .p2align 3
289 .L37:
290 movq errno@gottpoff(%rip), %rdx
291 negl %eax
292 movl $-1, %ebx
293 movl %eax, %fs:(%rdx)
294 jmp .L34
295 .p2align 4,,10
296 .p2align 3
297 .L52:
298 movq errno@gottpoff(%rip), %rax
299 movl $38, %fs:(%rax)
300 jmp .L34
301 .p2align 4,,10
302 .p2align 3
303 .L53:
304 movq errno@gottpoff(%rip), %rdx
305 negl %eax
306 movl $-1, %ebx
307 movl %eax, %fs:(%rdx)
308 jmp .L43
309 .L44:
310 movl $-1, %ebx
311 jmp .L34
312 .size mq_notify, .-mq_notify
313 .local added_atfork.9066
314 .comm added_atfork.9066,4,4
315 .local notify_barrier
316 .comm notify_barrier,32,32
317 .data
318 .align 4
319 .type netlink_socket, @object
320 .size netlink_socket, 4
321 netlink_socket:
322 .long -1
323 .local once
324 .comm once,4,4