1#include <sys/linux-syscalls.h> 2 3#define FUTEX_WAIT 0 4#define FUTEX_WAKE 1 5 6 7/* 8 * int __futex_wait(volatile void *ftx, int val, const struct timespec *timeout) 9 */ 10.text 11.globl __futex_wait 12.type __futex_wait, @function 13.align 4 14__futex_wait: 15 pushl %ebx 16 pushl %esi 17 mov 12(%esp), %ebx /* ftx */ 18 movl $FUTEX_WAIT, %ecx 19 mov 16(%esp), %edx /* val */ 20 mov 20(%esp), %esi /* timeout */ 21 movl $__NR_futex, %eax 22 int $0x80 23 popl %esi 24 popl %ebx 25 ret 26 27 28/* int __futex_wake(volatile void *ftx, int count) */ 29 30.text 31.globl __futex_wake 32.type __futex_wake, @function 33.align 4 34__futex_wake: 35 pushl %ebx 36 mov 8(%esp), %ebx /* ftx */ 37 movl $FUTEX_WAKE, %ecx 38 mov 12(%esp), %edx /* count */ 39 movl $__NR_futex, %eax 40 int $0x80 41 popl %ebx 42 ret 43 44/* int __futex_syscall3(volatile void *ftx, int op, int count) */ 45.text 46.globl __futex_syscall3 47.type __futex_syscall3, @function 48.align 4 49__futex_syscall3: 50 pushl %ebx 51 movl 8(%esp), %ebx /* ftx */ 52 movl 12(%esp), %ecx /* op */ 53 movl 16(%esp), %edx /* value */ 54 movl $__NR_futex, %eax 55 int $0x80 56 popl %ebx 57 ret 58 59/* int __futex_syscall4(volatile void *ftx, int op, int val, const struct timespec *timeout) */ 60.text 61.globl __futex_syscall4 62.type __futex_syscall4, @function 63.align 4 64__futex_syscall4: 65 pushl %ebx 66 pushl %esi 67 movl 12(%esp), %ebx /* ftx */ 68 movl 16(%esp), %ecx /* op */ 69 movl 20(%esp), %edx /* val */ 70 movl 24(%esp), %esi /* timeout */ 71 movl $__NR_futex, %eax 72 int $0x80 73 popl %esi 74 popl %ebx 75 ret 76