clarify the purpose of this project
[nyanglibc.git] / stdio-common / ftrylockfile.s
blobbbb21ae6750843bb983e2303dd0c5a2e1342dff5
1 .text
2 .p2align 4,,15
3 .globl __ftrylockfile
4 .type __ftrylockfile, @function
5 __ftrylockfile:
6 movq 136(%rdi), %rdx
7 movq %fs:16, %rcx
8 cmpq %rcx, 8(%rdx)
9 je .L2
10 #APP
11 # 28 "../sysdeps/pthread/ftrylockfile.c" 1
12 movl %fs:24,%eax
13 # 0 "" 2
14 #NO_APP
15 testl %eax, %eax
16 jne .L3
17 movl $1, %esi
18 #APP
19 # 47 "../sysdeps/unix/sysv/linux/x86/lowlevellock.h" 1
20 cmpxchgl %esi, (%rdx)
21 # 0 "" 2
22 #NO_APP
23 .L4:
24 testl %eax, %eax
25 jne .L6
26 movq 136(%rdi), %rdx
27 movq %rcx, 8(%rdx)
28 movl $1, 4(%rdx)
29 ret
30 .p2align 4,,10
31 .p2align 3
32 .L6:
33 movl $16, %eax
34 ret
35 .p2align 4,,10
36 .p2align 3
37 .L2:
38 addl $1, 4(%rdx)
39 xorl %eax, %eax
40 ret
41 .p2align 4,,10
42 .p2align 3
43 .L3:
44 xorl %eax, %eax
45 movl $1, %esi
46 lock cmpxchgl %esi, (%rdx)
47 setne %al
48 movzbl %al, %eax
49 jmp .L4
50 .size __ftrylockfile, .-__ftrylockfile
51 .weak ftrylockfile
52 .set ftrylockfile,__ftrylockfile
53 .globl _IO_ftrylockfile
54 .set _IO_ftrylockfile,__ftrylockfile