1 #include <private/bionic_asm.h>
3 #define FUTEX_WAIT 0
4 #define FUTEX_WAKE 1
6 // int __futex_wait(volatile void* ftx, int val, const struct timespec* timeout)
7 ENTRY(__futex_wait)
8 pushl %ebx
9 pushl %esi
10 mov 12(%esp), %ebx /* ftx */
11 movl $FUTEX_WAIT, %ecx
12 mov 16(%esp), %edx /* val */
13 mov 20(%esp), %esi /* timeout */
14 movl $__NR_futex, %eax
15 int $0x80
16 popl %esi
17 popl %ebx
18 ret
19 END(__futex_wait)
21 // int __futex_wake(volatile void* ftx, int count)
22 ENTRY(__futex_wake)
23 pushl %ebx
24 mov 8(%esp), %ebx /* ftx */
25 movl $FUTEX_WAKE, %ecx
26 mov 12(%esp), %edx /* count */
27 movl $__NR_futex, %eax
28 int $0x80
29 popl %ebx
30 ret
31 END(__futex_wake)
33 // int __futex_syscall3(volatile void* ftx, int op, int count)
34 ENTRY(__futex_syscall3)
35 pushl %ebx
36 movl 8(%esp), %ebx /* ftx */
37 movl 12(%esp), %ecx /* op */
38 movl 16(%esp), %edx /* value */
39 movl $__NR_futex, %eax
40 int $0x80
41 popl %ebx
42 ret
43 END(__futex_syscall3)
45 // int __futex_syscall4(volatile void* ftx, int op, int val, const struct timespec* timeout)
46 ENTRY(__futex_syscall4)
47 pushl %ebx
48 pushl %esi
49 movl 12(%esp), %ebx /* ftx */
50 movl 16(%esp), %ecx /* op */
51 movl 20(%esp), %edx /* val */
52 movl 24(%esp), %esi /* timeout */
53 movl $__NR_futex, %eax
54 int $0x80
55 popl %esi
56 popl %ebx
57 ret
58 END(__futex_syscall4)