clarify the purpose of this project
[nyanglibc.git] / libio / libc_fatal.s
blob84301c693c338f855ab48ba42202bc500ab24b2c
1 .text
2 .p2align 4,,15
3 .globl __libc_message
4 .hidden __libc_message
5 .type __libc_message, @function
6 __libc_message:
7 pushq %rbp
8 movq %rsp, %rbp
9 pushq %r15
10 pushq %r14
11 pushq %r13
12 pushq %r12
13 leaq 16(%rbp), %rax
14 pushq %rbx
15 subq $104, %rsp
16 movq %rdx, -80(%rbp)
17 movq %rcx, -72(%rbp)
18 movq %r8, -64(%rbp)
19 movq %r9, -56(%rbp)
20 movzbl (%rsi), %r13d
21 movq %rax, -112(%rbp)
22 leaq -96(%rbp), %rax
23 movl %edi, -132(%rbp)
24 movl $16, -120(%rbp)
25 movq %rax, -104(%rbp)
26 testb %r13b, %r13b
27 je .L45
28 movq %rsi, %r12
29 xorl %ebx, %ebx
30 xorl %r14d, %r14d
31 movl $48, %r15d
32 .p2align 4,,10
33 .p2align 3
34 .L2:
35 movl %r13d, %edx
36 movq %r12, %rax
37 jmp .L11
38 .p2align 4,,10
39 .p2align 3
40 .L5:
41 leaq 1(%rax), %rdi
42 movl $37, %esi
43 call __strchrnul@PLT
44 movzbl (%rax), %edx
45 testb %dl, %dl
46 je .L4
47 .L11:
48 cmpb $37, %dl
49 jne .L5
50 cmpb $115, 1(%rax)
51 jne .L5
52 .L4:
53 cmpb $37, %r13b
54 je .L46
55 .L6:
56 movq %rax, %r9
57 movq %r12, %rcx
58 subq %r12, %r9
59 movq %rax, %r12
60 .L9:
61 subq %r15, %rsp
62 leal 1(%rbx), %r10d
63 leaq 15(%rsp), %rdx
64 andq $-16, %rdx
65 movq %rcx, (%rdx)
66 movq %r9, 8(%rdx)
67 movq %r14, 16(%rdx)
68 movzbl (%r12), %r13d
69 testb %r13b, %r13b
70 je .L10
71 movslq %r10d, %rbx
72 movq %rdx, %r14
73 jmp .L2
74 .p2align 4,,10
75 .p2align 3
76 .L46:
77 cmpb $115, 1(%r12)
78 jne .L6
79 movl -120(%rbp), %edx
80 cmpl $47, %edx
81 ja .L7
82 movl %edx, %eax
83 addq -104(%rbp), %rax
84 addl $8, %edx
85 movl %edx, -120(%rbp)
86 .L8:
87 movq (%rax), %rcx
88 addq $2, %r12
89 movq %rcx, %rdi
90 movq %rcx, -144(%rbp)
91 call strlen
92 movq -144(%rbp), %rcx
93 movq %rax, %r9
94 jmp .L9
95 .p2align 4,,10
96 .p2align 3
97 .L10:
98 movslq %r10d, %r8
99 salq $4, %rbx
100 movq %r8, %rax
101 salq $4, %rax
102 addq $16, %rax
103 subq %rax, %rsp
104 xorl %eax, %eax
105 leaq 15(%rsp), %r12
106 andq $-16, %r12
107 leaq (%r12,%rbx), %rdx
108 leaq -16(%r12), %rdi
109 movq %r12, %rbx
110 jmp .L13
111 .p2align 4,,10
112 .p2align 3
113 .L47:
114 movq (%r14), %rcx
115 movq 8(%r14), %r9
116 movq 16(%r14), %r14
117 .L13:
118 movq %r9, 8(%rdx)
119 movq %rcx, (%rdx)
120 subq $16, %rdx
121 addq %rax, %r9
122 cmpq %rdi, %rdx
123 movq %r9, %rax
124 jne .L47
125 movl $20, %r13d
126 .p2align 4,,10
127 .p2align 3
128 .L14:
129 movq %r8, %rdx
130 movq %r12, %rsi
131 movl $2, %edi
132 movl %r13d, %eax
133 #APP
134 # 29 "../sysdeps/unix/sysv/linux/libc_fatal.c" 1
135 syscall
137 # 0 "" 2
138 #NO_APP
139 cmpq $-4, %rax
140 je .L14
141 testb $1, -132(%rbp)
142 jne .L48
143 leaq -40(%rbp), %rsp
144 popq %rbx
145 popq %r12
146 popq %r13
147 popq %r14
148 popq %r15
149 popq %rbp
151 .L48:
152 movq _dl_pagesize(%rip), %rax
153 xorl %edi, %edi
154 movl $-1, %r8d
155 movl $34, %ecx
156 movl $3, %edx
157 movl %r10d, -132(%rbp)
158 leaq (%r9,%rax), %r13
159 negq %rax
160 xorl %r9d, %r9d
161 andq %rax, %r13
162 movq %r13, %rsi
163 call __mmap
164 cmpq $-1, %rax
165 movq %rax, %r14
166 je .L19
167 movl -132(%rbp), %r10d
168 movl %r13d, (%rax)
169 leaq 4(%rax), %rax
170 leal -1(%r10), %edx
171 salq $4, %rdx
172 leaq 16(%r12,%rdx), %r12
173 .p2align 4,,10
174 .p2align 3
175 .L17:
176 movq 8(%rbx), %rdx
177 movq (%rbx), %rsi
178 movq %rax, %rdi
179 addq $16, %rbx
180 call __mempcpy
181 cmpq %r12, %rbx
182 jne .L17
183 movb $0, (%rax)
184 #APP
185 # 143 "../sysdeps/posix/libc_fatal.c" 1
186 xchgq %r14, __abort_msg(%rip)
187 # 0 "" 2
188 #NO_APP
189 testq %r14, %r14
190 je .L19
191 movl (%r14), %esi
192 movq %r14, %rdi
193 call __munmap
194 .L19:
195 call abort
196 .p2align 4,,10
197 .p2align 3
198 .L45:
199 testb $1, -132(%rbp)
200 jne .L19
201 leaq -40(%rbp), %rsp
202 popq %rbx
203 popq %r12
204 popq %r13
205 popq %r14
206 popq %r15
207 popq %rbp
209 .L7:
210 movq -112(%rbp), %rax
211 leaq 8(%rax), %rdx
212 movq %rdx, -112(%rbp)
213 jmp .L8
214 .size __libc_message, .-__libc_message
215 .section .rodata.str1.1,"aMS",@progbits,1
216 .LC0:
217 .string "%s"
218 .text
219 .p2align 4,,15
220 .globl __libc_fatal
221 .hidden __libc_fatal
222 .type __libc_fatal, @function
223 __libc_fatal:
224 pushq %rbp
225 pushq %rbx
226 leaq .LC0(%rip), %rbx
227 movq %rdi, %rbp
228 subq $8, %rsp
229 .p2align 4,,10
230 .p2align 3
231 .L50:
232 movq %rbp, %rdx
233 movq %rbx, %rsi
234 movl $1, %edi
235 xorl %eax, %eax
236 call __libc_message
237 jmp .L50
238 .size __libc_fatal, .-__libc_fatal
239 .hidden abort
240 .hidden __munmap
241 .hidden __abort_msg
242 .hidden __mmap
243 .hidden strlen