blob: 8dd2ad018c00d1186b4c7fcb2159376db411bf57 [file] [log] [blame]
Elliott Hughes5eccb962013-12-20 16:58:06 -08001#include <private/bionic_asm.h>
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08002
3#define FUTEX_WAIT 0
4#define FUTEX_WAKE 1
5
Elliott Hughes5eccb962013-12-20 16:58:06 -08006// int __futex_wait(volatile void* ftx, int val, const struct timespec* timeout)
Elliott Hughesbdff26d2013-02-11 17:08:16 -08007ENTRY(__futex_wait)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08008 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
Elliott Hughesbdff26d2013-02-11 17:08:16 -080019END(__futex_wait)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080020
Elliott Hughes5eccb962013-12-20 16:58:06 -080021// int __futex_wake(volatile void* ftx, int count)
Elliott Hughesbdff26d2013-02-11 17:08:16 -080022ENTRY(__futex_wake)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080023 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
Elliott Hughesbdff26d2013-02-11 17:08:16 -080031END(__futex_wake)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080032
Elliott Hughes5eccb962013-12-20 16:58:06 -080033// int __futex_syscall3(volatile void* ftx, int op, int count)
Elliott Hughesbdff26d2013-02-11 17:08:16 -080034ENTRY(__futex_syscall3)
David 'Digit' Turner88f06cd2010-03-18 17:13:41 -070035 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
Elliott Hughesbdff26d2013-02-11 17:08:16 -080043END(__futex_syscall3)
David 'Digit' Turner88f06cd2010-03-18 17:13:41 -070044
Elliott Hughes5eccb962013-12-20 16:58:06 -080045// int __futex_syscall4(volatile void* ftx, int op, int val, const struct timespec* timeout)
Elliott Hughesbdff26d2013-02-11 17:08:16 -080046ENTRY(__futex_syscall4)
David 'Digit' Turner88f06cd2010-03-18 17:13:41 -070047 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
Elliott Hughesbdff26d2013-02-11 17:08:16 -080058END(__futex_syscall4)