blob: 096f72c7f691e820cfda2caa9846ada407fb22ff [file] [log] [blame]
Elliott Hughesbdff26d2013-02-11 17:08:16 -08001#include <machine/asm.h>
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08002#include <sys/linux-syscalls.h>
3
4#define FUTEX_WAIT 0
5#define FUTEX_WAKE 1
6
Elliott Hughesbdff26d2013-02-11 17:08:16 -08007// int __futex_wait(volatile void *ftx, int val, const struct timespec *timeout)
8ENTRY(__futex_wait)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08009 pushl %ebx
10 pushl %esi
11 mov 12(%esp), %ebx /* ftx */
12 movl $FUTEX_WAIT, %ecx
13 mov 16(%esp), %edx /* val */
14 mov 20(%esp), %esi /* timeout */
15 movl $__NR_futex, %eax
16 int $0x80
17 popl %esi
18 popl %ebx
19 ret
Elliott Hughesbdff26d2013-02-11 17:08:16 -080020END(__futex_wait)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080021
22
Elliott Hughesbdff26d2013-02-11 17:08:16 -080023// int __futex_wake(volatile void *ftx, int count)
24ENTRY(__futex_wake)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080025 pushl %ebx
26 mov 8(%esp), %ebx /* ftx */
27 movl $FUTEX_WAKE, %ecx
28 mov 12(%esp), %edx /* count */
29 movl $__NR_futex, %eax
30 int $0x80
31 popl %ebx
32 ret
Elliott Hughesbdff26d2013-02-11 17:08:16 -080033END(__futex_wake)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080034
Elliott Hughesbdff26d2013-02-11 17:08:16 -080035// int __futex_syscall3(volatile void *ftx, int op, int count)
36ENTRY(__futex_syscall3)
David 'Digit' Turner88f06cd2010-03-18 17:13:41 -070037 pushl %ebx
38 movl 8(%esp), %ebx /* ftx */
39 movl 12(%esp), %ecx /* op */
40 movl 16(%esp), %edx /* value */
41 movl $__NR_futex, %eax
42 int $0x80
43 popl %ebx
44 ret
Elliott Hughesbdff26d2013-02-11 17:08:16 -080045END(__futex_syscall3)
David 'Digit' Turner88f06cd2010-03-18 17:13:41 -070046
Elliott Hughesbdff26d2013-02-11 17:08:16 -080047// int __futex_syscall4(volatile void *ftx, int op, int val, const struct timespec *timeout)
48ENTRY(__futex_syscall4)
David 'Digit' Turner88f06cd2010-03-18 17:13:41 -070049 pushl %ebx
50 pushl %esi
51 movl 12(%esp), %ebx /* ftx */
52 movl 16(%esp), %ecx /* op */
53 movl 20(%esp), %edx /* val */
54 movl 24(%esp), %esi /* timeout */
55 movl $__NR_futex, %eax
56 int $0x80
57 popl %esi
58 popl %ebx
59 ret
Elliott Hughesbdff26d2013-02-11 17:08:16 -080060END(__futex_syscall4)