clarify the purpose of this project
[nyanglibc.git] / io / write.s
blobd5d538efb0a57696b3faa77ab3922e3d2763530d
1 .text
2 .p2align 4,,15
3 .globl __libc_write
4 .hidden __libc_write
5 .type __libc_write, @function
6 __libc_write:
7 #APP
8 # 26 "../sysdeps/unix/sysv/linux/write.c" 1
9 movl %fs:24,%eax
10 # 0 "" 2
11 #NO_APP
12 testl %eax, %eax
13 jne .L2
14 movl $1, %eax
15 #APP
16 # 26 "../sysdeps/unix/sysv/linux/write.c" 1
17 syscall
19 # 0 "" 2
20 #NO_APP
21 cmpq $-4096, %rax
22 ja .L9
23 rep ret
24 .p2align 4,,10
25 .p2align 3
26 .L2:
27 pushq %r12
28 pushq %rbp
29 movq %rdx, %r12
30 pushq %rbx
31 movq %rsi, %rbp
32 movl %edi, %ebx
33 subq $16, %rsp
34 call __libc_enable_asynccancel
35 movq %r12, %rdx
36 movl %eax, %r8d
37 movq %rbp, %rsi
38 movl %ebx, %edi
39 movl $1, %eax
40 #APP
41 # 26 "../sysdeps/unix/sysv/linux/write.c" 1
42 syscall
44 # 0 "" 2
45 #NO_APP
46 cmpq $-4096, %rax
47 ja .L10
48 .L4:
49 movl %r8d, %edi
50 movq %rax, 8(%rsp)
51 call __libc_disable_asynccancel
52 movq 8(%rsp), %rax
53 addq $16, %rsp
54 popq %rbx
55 popq %rbp
56 popq %r12
57 ret
58 .p2align 4,,10
59 .p2align 3
60 .L9:
61 movq __libc_errno@gottpoff(%rip), %rdx
62 negl %eax
63 movl %eax, %fs:(%rdx)
64 movq $-1, %rax
65 ret
66 .L10:
67 movq __libc_errno@gottpoff(%rip), %rdx
68 negl %eax
69 movl %eax, %fs:(%rdx)
70 movq $-1, %rax
71 jmp .L4
72 .size __libc_write, .-__libc_write
73 .weak write
74 .hidden write
75 .set write,__libc_write
76 .weak __write
77 .hidden __write
78 .set __write,__libc_write
79 .hidden __libc_disable_asynccancel
80 .hidden __libc_enable_asynccancel