clarify the purpose of this project
[nyanglibc.git] / malloc / obstack.s
blob249d7f20eb6cc4f7c21cbcfc8df09cd5ef0cc149
1 .text
2 .section .rodata.str1.1,"aMS",@progbits,1
3 .LC0:
4 .string "memory exhausted"
5 .LC1:
6 .string "%s\n"
7 .text
8 .p2align 4,,15
9 .type print_and_abort, @function
10 print_and_abort:
11 leaq .LC0(%rip), %rsi
12 leaq _libc_intl_domainname(%rip), %rdi
13 subq $8, %rsp
14 movl $5, %edx
15 call __dcgettext
16 leaq .LC1(%rip), %rsi
17 movq %rax, %rdx
18 xorl %edi, %edi
19 xorl %eax, %eax
20 call __fxprintf
21 movl obstack_exit_failure(%rip), %edi
22 call exit
23 .size print_and_abort, .-print_and_abort
24 .p2align 4,,15
25 .globl _obstack_begin
26 .type _obstack_begin, @function
27 _obstack_begin:
28 pushq %r13
29 pushq %r12
30 pushq %rbp
31 pushq %rbx
32 movq %rdi, %rbx
33 subq $8, %rsp
34 testl %edx, %edx
35 je .L10
36 leal -1(%rdx), %eax
37 negl %edx
38 movslq %edx, %r12
39 movslq %eax, %r13
40 .L5:
41 testl %esi, %esi
42 movl $4064, %edx
43 movq %rcx, 56(%rbx)
44 cmove %edx, %esi
45 andb $-2, 80(%rbx)
46 movq %r8, 64(%rbx)
47 movslq %esi, %rdi
48 movl %eax, 48(%rbx)
49 movq %rdi, (%rbx)
50 call *%rcx
51 testq %rax, %rax
52 movq %rax, %rbp
53 movq %rax, 8(%rbx)
54 jne .L9
55 call *obstack_alloc_failed_handler(%rip)
56 .L9:
57 movq (%rbx), %rax
58 leaq 16(%rbp,%r13), %rdx
59 andq %rdx, %r12
60 addq %rbp, %rax
61 movq %r12, 16(%rbx)
62 movq %r12, 24(%rbx)
63 movq %rax, 0(%rbp)
64 movq %rax, 32(%rbx)
65 movl $1, %eax
66 movq $0, 8(%rbp)
67 andb $-7, 80(%rbx)
68 addq $8, %rsp
69 popq %rbx
70 popq %rbp
71 popq %r12
72 popq %r13
73 ret
74 .p2align 4,,10
75 .p2align 3
76 .L10:
77 movq $-16, %r12
78 movl $15, %r13d
79 movl $15, %eax
80 jmp .L5
81 .size _obstack_begin, .-_obstack_begin
82 .p2align 4,,15
83 .globl _obstack_begin_1
84 .type _obstack_begin_1, @function
85 _obstack_begin_1:
86 pushq %r13
87 pushq %r12
88 pushq %rbp
89 pushq %rbx
90 movq %rdi, %rbx
91 subq $8, %rsp
92 testl %edx, %edx
93 je .L18
94 leal -1(%rdx), %eax
95 negl %edx
96 movslq %edx, %r12
97 movslq %eax, %r13
98 .L13:
99 testl %esi, %esi
100 movl $4064, %edx
101 movq %rcx, 56(%rbx)
102 cmove %edx, %esi
103 orb $1, 80(%rbx)
104 movq %r8, 64(%rbx)
105 movslq %esi, %rsi
106 movl %eax, 48(%rbx)
107 movq %r9, 72(%rbx)
108 movq %rsi, (%rbx)
109 movq %r9, %rdi
110 call *%rcx
111 testq %rax, %rax
112 movq %rax, %rbp
113 movq %rax, 8(%rbx)
114 jne .L17
115 call *obstack_alloc_failed_handler(%rip)
116 .L17:
117 movq (%rbx), %rax
118 leaq 16(%rbp,%r13), %rdx
119 andq %rdx, %r12
120 addq %rbp, %rax
121 movq %r12, 16(%rbx)
122 movq %r12, 24(%rbx)
123 movq %rax, 0(%rbp)
124 movq %rax, 32(%rbx)
125 movl $1, %eax
126 movq $0, 8(%rbp)
127 andb $-7, 80(%rbx)
128 addq $8, %rsp
129 popq %rbx
130 popq %rbp
131 popq %r12
132 popq %r13
134 .p2align 4,,10
135 .p2align 3
136 .L18:
137 movq $-16, %r12
138 movl $15, %r13d
139 movl $15, %eax
140 jmp .L13
141 .size _obstack_begin_1, .-_obstack_begin_1
142 .p2align 4,,15
143 .globl _obstack_newchunk
144 .hidden _obstack_newchunk
145 .type _obstack_newchunk, @function
146 _obstack_newchunk:
147 pushq %r14
148 pushq %r13
149 movslq %esi, %rax
150 pushq %r12
151 pushq %rbp
152 pushq %rbx
153 movq 24(%rdi), %rbp
154 movq %rdi, %rbx
155 subq 16(%rdi), %rbp
156 movq 8(%rdi), %r13
157 movq %rbp, %rdx
158 addq %rbp, %rax
159 movq %rbp, %r12
160 sarq $3, %rdx
161 addq %rdx, %rax
162 movslq 48(%rdi), %rdx
163 leaq 100(%rax,%rdx), %rbp
164 cmpq %rbp, (%rdi)
165 movq 56(%rdi), %rax
166 cmovge (%rdi), %rbp
167 testb $1, 80(%rdi)
168 je .L21
169 movq 72(%rdi), %rdi
170 movq %rbp, %rsi
171 call *%rax
172 movq %rax, %r14
173 .L22:
174 testq %r14, %r14
175 jne .L23
176 call *obstack_alloc_failed_handler(%rip)
177 .L23:
178 movslq 48(%rbx), %rdx
179 addq %r14, %rbp
180 movq %r14, 8(%rbx)
181 movq %r13, 8(%r14)
182 movq %rbp, 32(%rbx)
183 movq %rbp, (%r14)
184 movq %rdx, %rax
185 leaq 16(%r14,%rdx), %rbp
186 notl %edx
187 movslq %edx, %rdx
188 andq %rdx, %rbp
189 xorl %edx, %edx
190 cmpl $14, %eax
191 jle .L24
192 movq %r12, %rax
193 shrq $2, %rax
194 testq %rax, %rax
195 je .L25
196 movq 16(%rbx), %rcx
197 leaq -4(%rbp,%rax,4), %rdx
198 leaq -4(%rbp), %rsi
199 subq %rbp, %rcx
200 .p2align 4,,10
201 .p2align 3
202 .L26:
203 movl (%rcx,%rdx), %eax
204 subq $4, %rdx
205 movl %eax, 4(%rdx)
206 cmpq %rdx, %rsi
207 jne .L26
208 .L25:
209 movq %r12, %rdx
210 andq $-4, %rdx
211 .L24:
212 cmpq %r12, %rdx
213 jge .L30
214 .p2align 4,,10
215 .p2align 3
216 .L27:
217 movq 16(%rbx), %rcx
218 movzbl (%rcx,%rdx), %ecx
219 movb %cl, 0(%rbp,%rdx)
220 addq $1, %rdx
221 cmpq %rdx, %r12
222 jne .L27
223 .L30:
224 movzbl 80(%rbx), %edx
225 testb $2, %dl
226 jne .L29
227 movslq 48(%rbx), %rcx
228 movq %rcx, %rax
229 leaq 16(%r13,%rcx), %rcx
230 notl %eax
231 cltq
232 andq %rcx, %rax
233 cmpq %rax, 16(%rbx)
234 je .L40
235 .L29:
236 movq %rbp, 16(%rbx)
237 addq %r12, %rbp
238 andb $-3, 80(%rbx)
239 movq %rbp, 24(%rbx)
240 popq %rbx
241 popq %rbp
242 popq %r12
243 popq %r13
244 popq %r14
246 .p2align 4,,10
247 .p2align 3
248 .L21:
249 movq %rbp, %rdi
250 call *%rax
251 movq %rax, %r14
252 jmp .L22
253 .p2align 4,,10
254 .p2align 3
255 .L40:
256 movq 8(%r13), %rax
257 andl $1, %edx
258 movq %rax, 8(%r14)
259 movq 64(%rbx), %rax
260 jne .L41
261 movq %r13, %rdi
262 call *%rax
263 jmp .L29
264 .p2align 4,,10
265 .p2align 3
266 .L41:
267 movq 72(%rbx), %rdi
268 movq %r13, %rsi
269 call *%rax
270 jmp .L29
271 .size _obstack_newchunk, .-_obstack_newchunk
272 .p2align 4,,15
273 .globl _obstack_allocated_p
274 .type _obstack_allocated_p, @function
275 _obstack_allocated_p:
276 movq 8(%rdi), %rax
277 testq %rax, %rax
278 je .L48
279 .p2align 4,,10
280 .p2align 3
281 .L43:
282 cmpq %rax, %rsi
283 jbe .L45
284 cmpq %rsi, (%rax)
285 jnb .L49
286 .L45:
287 movq 8(%rax), %rax
288 testq %rax, %rax
289 jne .L43
290 xorl %eax, %eax
292 .p2align 4,,10
293 .p2align 3
294 .L49:
295 movl $1, %eax
297 .L48:
298 rep ret
299 .size _obstack_allocated_p, .-_obstack_allocated_p
300 .p2align 4,,15
301 .globl obstack_free
302 .type obstack_free, @function
303 obstack_free:
304 pushq %r12
305 movq %rsi, %r12
306 pushq %rbp
307 pushq %rbx
308 movq 8(%rdi), %rsi
309 movq %rdi, %rbx
310 testq %rsi, %rsi
311 jne .L51
312 jmp .L52
313 .p2align 4,,10
314 .p2align 3
315 .L67:
316 movq 72(%rbx), %rdi
317 call *%rax
318 orb $2, 80(%rbx)
319 testq %rbp, %rbp
320 movq %rbp, %rsi
321 je .L52
322 .L51:
323 cmpq %r12, %rsi
324 jnb .L55
325 movq (%rsi), %rax
326 cmpq %r12, %rax
327 jnb .L66
328 .L55:
329 testb $1, 80(%rbx)
330 movq 8(%rsi), %rbp
331 movq 64(%rbx), %rax
332 jne .L67
333 movq %rsi, %rdi
334 call *%rax
335 orb $2, 80(%rbx)
336 testq %rbp, %rbp
337 movq %rbp, %rsi
338 jne .L51
339 .L52:
340 testq %r12, %r12
341 jne .L58
342 popq %rbx
343 popq %rbp
344 popq %r12
346 .p2align 4,,10
347 .p2align 3
348 .L66:
349 movq %r12, 24(%rbx)
350 movq %r12, 16(%rbx)
351 movq %rax, 32(%rbx)
352 movq %rsi, 8(%rbx)
353 popq %rbx
354 popq %rbp
355 popq %r12
357 .L58:
358 call abort
359 .size obstack_free, .-obstack_free
360 .globl _obstack_free
361 .set _obstack_free,obstack_free
362 .p2align 4,,15
363 .globl _obstack_memory_used
364 .type _obstack_memory_used, @function
365 _obstack_memory_used:
366 movq 8(%rdi), %rdx
367 xorl %eax, %eax
368 testq %rdx, %rdx
369 je .L71
370 .p2align 4,,10
371 .p2align 3
372 .L70:
373 addl (%rdx), %eax
374 subl %edx, %eax
375 movq 8(%rdx), %rdx
376 testq %rdx, %rdx
377 jne .L70
378 rep ret
379 .p2align 4,,10
380 .p2align 3
381 .L71:
382 rep ret
383 .size _obstack_memory_used, .-_obstack_memory_used
384 .globl obstack_exit_failure
385 .data
386 .align 4
387 .type obstack_exit_failure, @object
388 .size obstack_exit_failure, 4
389 obstack_exit_failure:
390 .long 1
391 .globl obstack_alloc_failed_handler
392 .section .data.rel.local,"aw",@progbits
393 .align 8
394 .type obstack_alloc_failed_handler, @object
395 .size obstack_alloc_failed_handler, 8
396 obstack_alloc_failed_handler:
397 .quad print_and_abort
398 .hidden abort
399 .hidden exit
400 .hidden __fxprintf
401 .hidden __dcgettext
402 .hidden _libc_intl_domainname