clarify the purpose of this project
[nyanglibc.git] / io / posix_fallocate.s
blobf5083ece0714683278d402bc056e6fdd20c4bfef
1 .text
2 .section .rodata.str1.1,"aMS",@progbits,1
3 .LC0:
4 .string ""
5 .text
6 .p2align 4,,15
7 .type internal_fallocate, @function
8 internal_fallocate:
9 pushq %r15
10 pushq %r14
11 pushq %r13
12 pushq %r12
13 pushq %rbp
14 pushq %rbx
15 subq $296, %rsp
16 testq %rsi, %rsi
17 js .L15
18 testq %rdx, %rdx
19 movq %rdx, %rbx
20 js .L15
21 movq %rsi, %rax
22 movq %rsi, %r15
23 movl $27, %ebp
24 addq %rdx, %rax
25 js .L1
26 xorl %edx, %edx
27 xorl %eax, %eax
28 movl $3, %esi
29 movl %edi, %r13d
30 call __fcntl
31 testl %eax, %eax
32 js .L4
33 testb $4, %ah
34 jne .L4
35 leaq 144(%rsp), %rsi
36 movl %r13d, %edi
37 call __fstat64
38 testl %eax, %eax
39 movl %eax, %ebp
40 jne .L4
41 movl 168(%rsp), %eax
42 andl $61440, %eax
43 cmpl $4096, %eax
44 je .L17
45 cmpl $32768, %eax
46 jne .L18
47 testq %rbx, %rbx
48 jne .L5
49 cmpq %r15, 192(%rsp)
50 jge .L1
51 movq %r15, %rsi
52 movl %r13d, %edi
53 call __ftruncate
54 testl %eax, %eax
55 je .L1
56 .L32:
57 movq __libc_errno@gottpoff(%rip), %rax
58 movl %fs:(%rax), %ebp
59 .L1:
60 addq $296, %rsp
61 movl %ebp, %eax
62 popq %rbx
63 popq %rbp
64 popq %r12
65 popq %r13
66 popq %r14
67 popq %r15
68 ret
69 .p2align 4,,10
70 .p2align 3
71 .L4:
72 movl $9, %ebp
73 jmp .L1
74 .p2align 4,,10
75 .p2align 3
76 .L15:
77 movl $22, %ebp
78 jmp .L1
79 .p2align 4,,10
80 .p2align 3
81 .L5:
82 leaq 16(%rsp), %rsi
83 movl %r13d, %edi
84 movq %rsi, 8(%rsp)
85 call __fstatfs64
86 testl %eax, %eax
87 jne .L32
88 movq 24(%rsp), %rax
89 movl $512, %r14d
90 testq %rax, %rax
91 je .L9
92 movl %eax, %r14d
93 cmpq $4096, %rax
94 movl $4096, %eax
95 cmovge %rax, %r14
96 .L9:
97 leaq -1(%rbx), %rax
98 leaq .LC0(%rip), %r12
99 cqto
100 idivq %r14
101 addq %rdx, %r15
102 jmp .L14
103 .p2align 4,,10
104 .p2align 3
105 .L10:
106 movq %r15, %rcx
107 movl $1, %edx
108 movq %r12, %rsi
109 movl %r13d, %edi
110 call __pwrite
111 cmpq $1, %rax
112 jne .L32
113 .L13:
114 addq %r14, %r15
115 testq %rbx, %rbx
116 jle .L1
117 .L14:
118 subq %r14, %rbx
119 cmpq %r15, 192(%rsp)
120 jle .L10
121 movq 8(%rsp), %rsi
122 movq %r15, %rcx
123 movl $1, %edx
124 movl %r13d, %edi
125 call __pread
126 testq %rax, %rax
127 js .L32
128 cmpq $1, %rax
129 jne .L10
130 cmpb $0, 16(%rsp)
131 je .L10
132 jmp .L13
133 .p2align 4,,10
134 .p2align 3
135 .L18:
136 movl $19, %ebp
137 jmp .L1
138 .p2align 4,,10
139 .p2align 3
140 .L17:
141 movl $29, %ebp
142 jmp .L1
143 .size internal_fallocate, .-internal_fallocate
144 .p2align 4,,15
145 .globl posix_fallocate
146 .type posix_fallocate, @function
147 posix_fallocate:
148 pushq %rbx
149 movq %rsi, %r9
150 movq %rdx, %rbx
151 movq %rdx, %r10
152 movl $285, %eax
153 movq %rsi, %rdx
154 xorl %esi, %esi
155 #APP
156 # 29 "../sysdeps/unix/sysv/linux/posix_fallocate.c" 1
157 syscall
159 # 0 "" 2
160 #NO_APP
161 cmpl $-4096, %eax
162 jbe .L37
163 cmpl $-95, %eax
164 je .L36
165 negl %eax
166 popq %rbx
168 .p2align 4,,10
169 .p2align 3
170 .L37:
171 xorl %eax, %eax
172 popq %rbx
174 .p2align 4,,10
175 .p2align 3
176 .L36:
177 movq %rbx, %rdx
178 movq %r9, %rsi
179 popq %rbx
180 jmp internal_fallocate
181 .size posix_fallocate, .-posix_fallocate
182 .hidden __pread
183 .hidden __pwrite
184 .hidden __fstatfs64
185 .hidden __ftruncate
186 .hidden __fstat64
187 .hidden __fcntl