Elliott Hughes | 4cdde5f | 2013-03-21 22:48:18 -0700 | [diff] [blame] | 1 | #include <asm/unistd.h> |
Elliott Hughes | bdff26d | 2013-02-11 17:08:16 -0800 | [diff] [blame] | 2 | #include <machine/asm.h> |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 3 | |
| 4 | #define FUTEX_WAIT 0 |
| 5 | #define FUTEX_WAKE 1 |
| 6 | |
Elliott Hughes | bdff26d | 2013-02-11 17:08:16 -0800 | [diff] [blame] | 7 | // int __futex_wait(volatile void *ftx, int val, const struct timespec *timeout) |
| 8 | ENTRY(__futex_wait) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 9 | 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 Hughes | bdff26d | 2013-02-11 17:08:16 -0800 | [diff] [blame] | 20 | END(__futex_wait) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 21 | |
Elliott Hughes | bdff26d | 2013-02-11 17:08:16 -0800 | [diff] [blame] | 22 | // int __futex_wake(volatile void *ftx, int count) |
| 23 | ENTRY(__futex_wake) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 24 | pushl %ebx |
| 25 | mov 8(%esp), %ebx /* ftx */ |
| 26 | movl $FUTEX_WAKE, %ecx |
| 27 | mov 12(%esp), %edx /* count */ |
| 28 | movl $__NR_futex, %eax |
| 29 | int $0x80 |
| 30 | popl %ebx |
| 31 | ret |
Elliott Hughes | bdff26d | 2013-02-11 17:08:16 -0800 | [diff] [blame] | 32 | END(__futex_wake) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 33 | |
Elliott Hughes | bdff26d | 2013-02-11 17:08:16 -0800 | [diff] [blame] | 34 | // int __futex_syscall3(volatile void *ftx, int op, int count) |
| 35 | ENTRY(__futex_syscall3) |
David 'Digit' Turner | 88f06cd | 2010-03-18 17:13:41 -0700 | [diff] [blame] | 36 | pushl %ebx |
| 37 | movl 8(%esp), %ebx /* ftx */ |
| 38 | movl 12(%esp), %ecx /* op */ |
| 39 | movl 16(%esp), %edx /* value */ |
| 40 | movl $__NR_futex, %eax |
| 41 | int $0x80 |
| 42 | popl %ebx |
| 43 | ret |
Elliott Hughes | bdff26d | 2013-02-11 17:08:16 -0800 | [diff] [blame] | 44 | END(__futex_syscall3) |
David 'Digit' Turner | 88f06cd | 2010-03-18 17:13:41 -0700 | [diff] [blame] | 45 | |
Elliott Hughes | bdff26d | 2013-02-11 17:08:16 -0800 | [diff] [blame] | 46 | // int __futex_syscall4(volatile void *ftx, int op, int val, const struct timespec *timeout) |
| 47 | ENTRY(__futex_syscall4) |
David 'Digit' Turner | 88f06cd | 2010-03-18 17:13:41 -0700 | [diff] [blame] | 48 | pushl %ebx |
| 49 | pushl %esi |
| 50 | movl 12(%esp), %ebx /* ftx */ |
| 51 | movl 16(%esp), %ecx /* op */ |
| 52 | movl 20(%esp), %edx /* val */ |
| 53 | movl 24(%esp), %esi /* timeout */ |
| 54 | movl $__NR_futex, %eax |
| 55 | int $0x80 |
| 56 | popl %esi |
| 57 | popl %ebx |
| 58 | ret |
Elliott Hughes | bdff26d | 2013-02-11 17:08:16 -0800 | [diff] [blame] | 59 | END(__futex_syscall4) |