clarify the purpose of this project
[nyanglibc.git] / dirent / rewinddir.s
blob897dc671ae52f6b49246722a077f1209bd2cae75
1 .text
2 .p2align 4,,15
3 .globl __rewinddir
4 .hidden __rewinddir
5 .type __rewinddir, @function
6 __rewinddir:
7 pushq %rbp
8 pushq %rbx
9 movq %rdi, %rbx
10 subq $8, %rsp
11 #APP
12 # 29 "../sysdeps/unix/sysv/linux/rewinddir.c" 1
13 movl %fs:24,%eax
14 # 0 "" 2
15 #NO_APP
16 testl %eax, %eax
17 leaq 4(%rdi), %rbp
18 jne .L2
19 movl $1, %edx
20 #APP
21 # 47 "../sysdeps/unix/sysv/linux/x86/lowlevellock.h" 1
22 cmpxchgl %edx, 4(%rdi)
23 # 0 "" 2
24 #NO_APP
25 .L3:
26 movl (%rbx), %edi
27 xorl %edx, %edx
28 xorl %esi, %esi
29 call __lseek
30 movq $0, 32(%rbx)
31 movq $0, 24(%rbx)
32 movq $0, 16(%rbx)
33 movl $0, 40(%rbx)
34 #APP
35 # 37 "../sysdeps/unix/sysv/linux/rewinddir.c" 1
36 movl %fs:24,%eax
37 # 0 "" 2
38 #NO_APP
39 testl %eax, %eax
40 jne .L4
41 subl $1, 4(%rbx)
42 .L1:
43 addq $8, %rsp
44 popq %rbx
45 popq %rbp
46 ret
47 .p2align 4,,10
48 .p2align 3
49 .L2:
50 xorl %eax, %eax
51 movl $1, %edx
52 lock cmpxchgl %edx, 0(%rbp)
53 je .L3
54 movq %rbp, %rdi
55 call __lll_lock_wait_private
56 jmp .L3
57 .p2align 4,,10
58 .p2align 3
59 .L4:
60 xorl %eax, %eax
61 #APP
62 # 37 "../sysdeps/unix/sysv/linux/rewinddir.c" 1
63 xchgl %eax, 4(%rbx)
64 # 0 "" 2
65 #NO_APP
66 cmpl $1, %eax
67 jle .L1
68 xorl %r10d, %r10d
69 movl $1, %edx
70 movl $129, %esi
71 movq %rbp, %rdi
72 movl $202, %eax
73 #APP
74 # 37 "../sysdeps/unix/sysv/linux/rewinddir.c" 1
75 syscall
77 # 0 "" 2
78 #NO_APP
79 jmp .L1
80 .size __rewinddir, .-__rewinddir
81 .weak rewinddir
82 .set rewinddir,__rewinddir
83 .hidden __lll_lock_wait_private
84 .hidden __lseek