clarify the purpose of this project
[nyanglibc.git] / libio / ferror.s
blob186dcc837776d47a668d8968ae5fa85f636e7182
1 .text
2 .p2align 4,,15
3 .globl _IO_ferror
4 .type _IO_ferror, @function
5 _IO_ferror:
6 testb $-128, 116(%rdi)
7 movl (%rdi), %eax
8 je .L4
9 movl %eax, %edx
10 andl $32768, %edx
11 jne .L4
12 pushq %rbp
13 pushq %rbx
14 subq $8, %rsp
15 movq 136(%rdi), %rcx
16 movq %fs:16, %rbp
17 cmpq 8(%rcx), %rbp
18 je .L5
19 movq %rdi, %rbx
20 #APP
21 # 37 "ferror.c" 1
22 movl %fs:24,%eax
23 # 0 "" 2
24 #NO_APP
25 testl %eax, %eax
26 jne .L6
27 movl $1, %edx
28 #APP
29 # 47 "../sysdeps/unix/sysv/linux/x86/lowlevellock.h" 1
30 cmpxchgl %edx, (%rcx)
31 # 0 "" 2
32 #NO_APP
33 .L7:
34 movl (%rbx), %esi
35 movq 136(%rbx), %rcx
36 movl %esi, %r8d
37 movq %rbp, 8(%rcx)
38 movl 4(%rcx), %edx
39 shrl $5, %r8d
40 andl $1, %r8d
41 andl $32768, %esi
42 jne .L18
43 .L8:
44 testl %edx, %edx
45 jne .L1
46 movq $0, 8(%rcx)
47 #APP
48 # 39 "ferror.c" 1
49 movl %fs:24,%eax
50 # 0 "" 2
51 #NO_APP
52 testl %eax, %eax
53 jne .L9
54 subl $1, (%rcx)
55 .L1:
56 addq $8, %rsp
57 movl %r8d, %eax
58 popq %rbx
59 popq %rbp
60 ret
61 .p2align 4,,10
62 .p2align 3
63 .L4:
64 shrl $5, %eax
65 andl $1, %eax
66 ret
67 .p2align 4,,10
68 .p2align 3
69 .L5:
70 shrl $5, %eax
71 movl 4(%rcx), %edx
72 andl $1, %eax
73 movl %eax, %r8d
74 jmp .L8
75 .p2align 4,,10
76 .p2align 3
77 .L6:
78 movl $1, %esi
79 movl %edx, %eax
80 lock cmpxchgl %esi, (%rcx)
81 je .L7
82 movq %rcx, %rdi
83 call __lll_lock_wait_private
84 jmp .L7
85 .p2align 4,,10
86 .p2align 3
87 .L9:
88 #APP
89 # 39 "ferror.c" 1
90 xchgl %edx, (%rcx)
91 # 0 "" 2
92 #NO_APP
93 cmpl $1, %edx
94 jle .L1
95 xorl %r10d, %r10d
96 movl $1, %edx
97 movl $129, %esi
98 movq %rcx, %rdi
99 movl $202, %eax
100 #APP
101 # 39 "ferror.c" 1
102 syscall
104 # 0 "" 2
105 #NO_APP
106 jmp .L1
107 .L18:
108 addl $1, %edx
109 movl %edx, 4(%rcx)
110 jmp .L1
111 .size _IO_ferror, .-_IO_ferror
112 .weak ferror
113 .set ferror,_IO_ferror
114 .hidden __lll_lock_wait_private