clarify the purpose of this project
[nyanglibc.git] / dirent / seekdir.s
blobc6b3589926c7eb36d52931ed481f9ad2f39c99c0
1 .text
2 .p2align 4,,15
3 .globl seekdir
4 .type seekdir, @function
5 seekdir:
6 pushq %r12
7 pushq %rbp
8 movq %rsi, %rbp
9 pushq %rbx
10 movq %rdi, %rbx
11 #APP
12 # 29 "../sysdeps/unix/sysv/linux/seekdir.c" 1
13 movl %fs:24,%eax
14 # 0 "" 2
15 #NO_APP
16 testl %eax, %eax
17 leaq 4(%rdi), %r12
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 movq %rbp, %rsi
29 call __lseek
30 movq $0, 16(%rbx)
31 movq $0, 24(%rbx)
32 movq %rbp, 32(%rbx)
33 #APP
34 # 34 "../sysdeps/unix/sysv/linux/seekdir.c" 1
35 movl %fs:24,%eax
36 # 0 "" 2
37 #NO_APP
38 testl %eax, %eax
39 jne .L4
40 subl $1, 4(%rbx)
41 .L1:
42 popq %rbx
43 popq %rbp
44 popq %r12
45 ret
46 .p2align 4,,10
47 .p2align 3
48 .L2:
49 xorl %eax, %eax
50 movl $1, %edx
51 lock cmpxchgl %edx, (%r12)
52 je .L3
53 movq %r12, %rdi
54 call __lll_lock_wait_private
55 jmp .L3
56 .p2align 4,,10
57 .p2align 3
58 .L4:
59 xorl %eax, %eax
60 #APP
61 # 34 "../sysdeps/unix/sysv/linux/seekdir.c" 1
62 xchgl %eax, 4(%rbx)
63 # 0 "" 2
64 #NO_APP
65 cmpl $1, %eax
66 jle .L1
67 xorl %r10d, %r10d
68 movl $1, %edx
69 movl $129, %esi
70 movq %r12, %rdi
71 movl $202, %eax
72 #APP
73 # 34 "../sysdeps/unix/sysv/linux/seekdir.c" 1
74 syscall
76 # 0 "" 2
77 #NO_APP
78 jmp .L1
79 .size seekdir, .-seekdir
80 .hidden __lll_lock_wait_private
81 .hidden __lseek