clarify the purpose of this project
[nyanglibc.git] / posix / fork.shared.s
blobc41de79a016fd9ad67d9360d64bf50ae18bc2b19
1 .text
2 #APP
3 memmove = __GI_memmove
4 memset = __GI_memset
5 memcpy = __GI_memcpy
6 #NO_APP
7 .p2align 4,,15
8 .globl __libc_fork
9 .type __libc_fork, @function
10 __libc_fork:
11 pushq %r12
12 pushq %rbp
13 pushq %rbx
14 subq $176, %rsp
15 #APP
16 # 57 "../sysdeps/nptl/fork.c" 1
17 movl %fs:24,%ebx
18 # 0 "" 2
19 #NO_APP
20 xorl %ebp, %ebp
21 testl %ebx, %ebx
22 setne %bpl
23 xorl %edi, %edi
24 movl %ebp, %esi
25 call __run_fork_handlers
26 testl %ebx, %ebx
27 jne .L27
28 .L2:
29 movq %fs:16, %rax
30 xorl %r8d, %r8d
31 xorl %edx, %edx
32 xorl %esi, %esi
33 movl $18874385, %edi
34 leaq 720(%rax), %r10
35 movl $56, %eax
36 #APP
37 # 49 "../sysdeps/unix/sysv/linux/arch-fork.h" 1
38 syscall
40 # 0 "" 2
41 #NO_APP
42 cmpq $-4096, %rax
43 ja .L28
44 testl %eax, %eax
45 movl %eax, %r12d
46 jne .L4
47 movq __fork_generation_pointer(%rip), %rax
48 movq %fs:16, %rdi
49 testq %rax, %rax
50 je .L5
51 addq $4, (%rax)
52 .L5:
53 leaq 736(%rdi), %rax
54 movq %rax, 728(%rdi)
55 movq %rax, 736(%rdi)
56 movl __libc_pthread_functions_init(%rip), %eax
57 testl %eax, %eax
58 jne .L29
59 .L6:
60 testl %ebx, %ebx
61 jne .L30
62 .L7:
63 movq _rtld_global@GOTPCREL(%rip), %rax
64 pxor %xmm0, %xmm0
65 movl %ebp, %esi
66 movl $1, %edi
67 movups %xmm0, 2456(%rax)
68 movq $0, 2472(%rax)
69 movl $1, 2456(%rax)
70 movups %xmm0, 2440(%rax)
71 call __run_fork_handlers
72 addq $176, %rsp
73 movl %r12d, %eax
74 popq %rbx
75 popq %rbp
76 popq %r12
77 ret
78 .p2align 4,,10
79 .p2align 3
80 .L28:
81 movq __libc_errno@gottpoff(%rip), %rdx
82 negl %eax
83 movl $-1, %r12d
84 movl %eax, %fs:(%rdx)
85 .L4:
86 testl %ebx, %ebx
87 jne .L31
88 movl %ebp, %esi
89 movl $2, %edi
90 call __run_fork_handlers
91 .L33:
92 addq $176, %rsp
93 movl %r12d, %eax
94 popq %rbx
95 popq %rbp
96 popq %r12
97 ret
98 .p2align 4,,10
99 .p2align 3
100 .L27:
101 movq %rsp, %rdi
102 call __nss_database_fork_prepare_parent
103 call __GI__IO_list_lock
104 call __malloc_fork_lock_parent
105 jmp .L2
106 .p2align 4,,10
107 .p2align 3
108 .L30:
109 call __malloc_fork_unlock_child
110 call __GI__IO_iter_begin
111 movq %rax, %rbx
112 jmp .L8
113 .p2align 4,,10
114 .p2align 3
115 .L9:
116 movq %rbx, %rdi
117 call __GI__IO_iter_next
118 movq %rax, %rbx
119 .L8:
120 call __GI__IO_iter_end
121 cmpq %rax, %rbx
122 je .L32
123 movq %rbx, %rdi
124 call __GI__IO_iter_file
125 movl (%rax), %eax
126 testb $-128, %ah
127 jne .L9
128 movq %rbx, %rdi
129 call __GI__IO_iter_file
130 movq 136(%rax), %rax
131 movq $0, (%rax)
132 movq $0, 8(%rax)
133 jmp .L9
134 .p2align 4,,10
135 .p2align 3
136 .L31:
137 call __malloc_fork_unlock_parent
138 call __GI__IO_list_unlock
139 movl %ebp, %esi
140 movl $2, %edi
141 call __run_fork_handlers
142 jmp .L33
143 .p2align 4,,10
144 .p2align 3
145 .L29:
146 movq 232+__libc_pthread_functions(%rip), %rax
147 #APP
148 # 108 "../sysdeps/nptl/fork.c" 1
149 ror $2*8+1, %rax
150 xor %fs:48, %rax
151 # 0 "" 2
152 #NO_APP
153 call *%rax
154 jmp .L6
155 .p2align 4,,10
156 .p2align 3
157 .L32:
158 call __GI__IO_list_resetlock
159 movq %rsp, %rdi
160 call __nss_database_fork_subprocess
161 jmp .L7
162 .size __libc_fork, .-__libc_fork
163 .weak fork
164 .set fork,__libc_fork
165 .weak __GI___fork
166 .hidden __GI___fork
167 .set __GI___fork,__libc_fork
168 .globl __fork
169 .set __fork,__GI___fork
170 .hidden __nss_database_fork_subprocess
171 .hidden __libc_pthread_functions
172 .hidden __malloc_fork_unlock_parent
173 .hidden __malloc_fork_unlock_child
174 .hidden __malloc_fork_lock_parent
175 .hidden __nss_database_fork_prepare_parent
176 .hidden __libc_pthread_functions_init
177 .hidden __fork_generation_pointer
178 .hidden __run_fork_handlers