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