clarify the purpose of this project
[nyanglibc.git] / nptl / sem_close.s
blobd389392449bd628c8497383ccbbb212f723f04eb
1 .text
2 .p2align 4,,15
3 .type walker, @function
4 walker:
5 movq (%rdi), %rax
6 movq (%rdx), %rcx
7 cmpq %rcx, 24(%rax)
8 je .L4
9 rep ret
10 .p2align 4,,10
11 .p2align 3
12 .L4:
13 movq %rax, 8(%rdx)
14 ret
15 .size walker, .-walker
16 .p2align 4,,15
17 .globl sem_close
18 .type sem_close, @function
19 sem_close:
20 pushq %rbp
21 pushq %rbx
22 xorl %eax, %eax
23 movq %rdi, %rbx
24 movl $1, %edx
25 subq $24, %rsp
26 lock cmpxchgl %edx, __sem_mappings_lock(%rip)
27 jne .L12
28 .L6:
29 movq __sem_mappings(%rip), %rdi
30 leaq walker(%rip), %rsi
31 movq %rsp, %rdx
32 movq %rbx, (%rsp)
33 movq $0, 8(%rsp)
34 call __twalk_r@PLT
35 movq 8(%rsp), %rbx
36 testq %rbx, %rbx
37 je .L7
38 movl 16(%rbx), %eax
39 xorl %ebp, %ebp
40 subl $1, %eax
41 testl %eax, %eax
42 movl %eax, 16(%rbx)
43 je .L13
44 .L8:
45 xorl %eax, %eax
46 #APP
47 # 78 "../sysdeps/pthread/sem_close.c" 1
48 xchgl %eax, __sem_mappings_lock(%rip)
49 # 0 "" 2
50 #NO_APP
51 cmpl $1, %eax
52 jg .L14
53 addq $24, %rsp
54 movl %ebp, %eax
55 popq %rbx
56 popq %rbp
57 ret
58 .p2align 4,,10
59 .p2align 3
60 .L13:
61 movq __sem_search@GOTPCREL(%rip), %rdx
62 leaq __sem_mappings(%rip), %rsi
63 movq %rbx, %rdi
64 call __tdelete@PLT
65 movq 24(%rbx), %rdi
66 movl $32, %esi
67 call munmap@PLT
68 movq %rbx, %rdi
69 movl %eax, %ebp
70 call free@PLT
71 jmp .L8
72 .p2align 4,,10
73 .p2align 3
74 .L12:
75 leaq __sem_mappings_lock(%rip), %rdi
76 call __lll_lock_wait_private@PLT
77 jmp .L6
78 .p2align 4,,10
79 .p2align 3
80 .L14:
81 xorl %r10d, %r10d
82 movl $1, %edx
83 movl $129, %esi
84 leaq __sem_mappings_lock(%rip), %rdi
85 movl $202, %eax
86 #APP
87 # 78 "../sysdeps/pthread/sem_close.c" 1
88 syscall
90 # 0 "" 2
91 #NO_APP
92 addq $24, %rsp
93 movl %ebp, %eax
94 popq %rbx
95 popq %rbp
96 ret
97 .L7:
98 movq errno@gottpoff(%rip), %rax
99 movl $-1, %ebp
100 movl $22, %fs:(%rax)
101 jmp .L8
102 .size sem_close, .-sem_close