clarify the purpose of this project
[nyanglibc.git] / elf / dl-sbrk.shared.s
blob86577e0ef2725439c8192fb39ee06377a32a3f1e
1 .text
2 .p2align 4,,15
3 .globl __sbrk
4 .hidden __sbrk
5 .type __sbrk, @function
6 __sbrk:
7 pushq %rbp
8 pushq %rbx
9 movq %rdi, %rbp
10 subq $8, %rsp
11 movq __curbrk(%rip), %rbx
12 testq %rbx, %rbx
13 je .L15
14 .L2:
15 cmpq $0, %rbp
16 je .L1
17 jle .L5
18 movq %rbx, %rax
19 addq %rbp, %rax
20 setc %al
21 testb %al, %al
22 je .L7
23 .L16:
24 movl $12, rtld_errno(%rip)
25 .L13:
26 movq $-1, %rbx
27 .L1:
28 addq $8, %rsp
29 movq %rbx, %rax
30 popq %rbx
31 popq %rbp
32 ret
33 .p2align 4,,10
34 .p2align 3
35 .L5:
36 movq %rbp, %rax
37 negq %rax
38 cmpq %rbx, %rax
39 seta %al
40 testb %al, %al
41 jne .L16
42 .L7:
43 leaq (%rbx,%rbp), %rdi
44 call __brk
45 testl %eax, %eax
46 js .L13
47 addq $8, %rsp
48 movq %rbx, %rax
49 popq %rbx
50 popq %rbp
51 ret
52 .p2align 4,,10
53 .p2align 3
54 .L15:
55 xorl %edi, %edi
56 call __brk
57 testl %eax, %eax
58 movq __curbrk(%rip), %rbx
59 jns .L2
60 jmp .L13
61 .size __sbrk, .-__sbrk
62 .weak sbrk
63 .set sbrk,__sbrk
64 .hidden __brk
65 .hidden rtld_errno
66 .hidden __curbrk