#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
-/*
- * Syscall interface for fast userspace locks
- *
- * int __futex_wait(volatile void *ftx, int val, const struct timespec *timeout);
- * int __futex_wake(volatile void *ftx, int count);
- * int __futex_syscall3(volatile void *ftx, int op, int val);
- * int __futex_syscall4(volatile void *ftx, int op, int val, const struct timespec *timeout);
- */
-
+// int __futex_syscall4(volatile void* ftx, int op, int val, const struct timespec* timeout)
ENTRY(__futex_syscall4)
- /* create AArch64 PCS frame pointer */
- stp x29, x30, [sp, #-16]!
- mov x29, sp
-
- /* store x8 */
- str x8, [sp, #-16]!
-
- /* syscall No. in x8 */
- mov x8, __NR_futex
- svc #0
-
- /* restore x8 */
- ldr x8, [sp], #16
- ldp x29, x30, [sp], #16
+ stp x29, x30, [sp, #-16]!
+ mov x29, sp
- /* check if syscall returned successfully */
- cmn x0, #(MAX_ERRNO + 1)
- cneg x0, x0, hi
- b.hi __set_errno
+ str x8, [sp, #-16]!
+ mov x8, __NR_futex
+ svc #0
+ ldr x8, [sp], #16
- ret
+ ldp x29, x30, [sp], #16
+ ret
END(__futex_syscall4)
+// int __futex_syscall3(volatile void* ftx, int op, int count)
ENTRY(__futex_syscall3)
- /* __futex_syscall4 but with fewer arguments */
- b __futex_syscall4
+ b __futex_syscall4
END(__futex_syscall3)
+// int __futex_wait(volatile void* ftx, int val, const struct timespec* timeout)
ENTRY(__futex_wait)
- /* create AArch64 PCS frame pointer */
- stp x29, x30, [sp, #-16]!
- mov x29, sp
+ stp x29, x30, [sp, #-16]!
+ mov x29, sp
- /* store x8 */
- str x8, [sp, #-16]!
+ mov x3, x2
+ mov x2, x1
+ mov x1, #FUTEX_WAIT
- /* arange arguments as expected in the kernel side */
- mov x3, x2
- mov w2, w1
- mov w1, #FUTEX_WAIT
+ str x8, [sp, #-16]!
+ mov x8, __NR_futex
+ svc #0
+ ldr x8, [sp], #16
- /* syscall No. in X8 */
- mov x8, __NR_futex
- svc #0
-
- /* restore x8 */
- ldr x8, [sp], #16
- ldp x29, x30, [sp], #16
-
- /* check if syscall returned successfully */
- cmn x0, #(MAX_ERRNO + 1)
- cneg x0, x0, hi
- b.hi __set_errno
-
- ret
+ ldp x29, x30, [sp], #16
+ ret
END(__futex_wait)
+// int __futex_wake(volatile void* ftx, int count)
ENTRY(__futex_wake)
- /* create AArch64 PCS frame pointer */
- stp x29, x30, [sp, #-16]!
- mov x29, sp
-
- /* store x8 */
- str x8, [sp, #-16]!
-
- /* arange arguments as expected in the kernel side */
- mov w2, w1
- mov w1, #FUTEX_WAIT
-
- /* syscall No. in X8 */
- mov x8, __NR_futex
- svc #0
+ stp x29, x30, [sp, #-16]!
+ mov x29, sp
- /* restore x8 */
- ldr x8, [sp], #16
- ldp x29, x30, [sp], #16
+ mov x2, x1
+ mov x1, #FUTEX_WAKE
- /* check if syscall returned successfully */
- cmn x0, #(MAX_ERRNO + 1)
- cneg x0, x0, hi
- b.hi __set_errno
+ str x8, [sp, #-16]!
+ mov x8, __NR_futex
+ svc #0
+ ldr x8, [sp], #16
- ret
+ ldp x29, x30, [sp], #16
+ ret
END(__futex_wake)
* SUCH DAMAGE.
*/
-#include <asm/unistd.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
-// __futex_syscall3(*ftx, op, val)
+// int __futex_syscall3(volatile void* ftx, int op, int count)
ENTRY(__futex_syscall3)
mov ip, r7
ldr r7, =__NR_futex
bx lr
END(__futex_syscall3)
-// __futex_syscall4(*ftx, op, val, *timespec)
+// int __futex_syscall4(volatile void* ftx, int op, int val, const struct timespec* timeout)
ENTRY(__futex_syscall4)
b __futex_syscall3
END(__futex_syscall4)
-// __futex_wait(*ftx, val, *timespec)
+// int __futex_wait(volatile void* ftx, int val, const struct timespec* timeout)
ENTRY(__futex_wait)
mov ip, r7
mov r3, r2
bx lr
END(__futex_wait)
-// __futex_wake(*ftx, counter)
+// int __futex_wake(volatile void* ftx, int count)
ENTRY(__futex_wake)
mov ip, r7
mov r2, r1
* SUCH DAMAGE.
*/
-#include <asm/unistd.h>
+#include <private/bionic_asm.h>
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
-/*
- * __futex_wait(*ftx, val, *timespec)
- * futex_syscall(*ftx, op, val, *timespec, *addr2, val3)
- */
+// int __futex_wait(volatile void* ftx, int val, const struct timespec* timeout)
.type __futex_wait, @function
.global __futex_wait
.align 4
j $ra
.end __futex_wait
-/*
- * int __futex_wake(volatile void *ftx, int count)
- * int futex_syscall(*ftx, op, val, *timespec, *addr2, val3)
- */
+// int __futex_wake(volatile void* ftx, int count)
.type __futex_wake, @function
.globl __futex_wake
.align 4
j $ra
.end __futex_wake
-/* __futex_syscall3(*ftx, op, val)
- * futex_syscall(*ftx, op, val, *timespec, *addr2, val3)
- */
+// int __futex_syscall3(volatile void* ftx, int op, int count)
.type __futex_syscall3, @function
.global __futex_syscall3
.align 4
j $ra
.end __futex_syscall3
-/* __futex_syscall4(*ftx, op, val)
- * futex_syscall(*ftx, op, val, *timespec, *addr2, val3)
- */
+// int __futex_syscall4(volatile void* ftx, int op, int val, const struct timespec* timeout)
.type __futex_syscall4, @function
.global __futex_syscall4
.align 4
-#include <asm/unistd.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
-// int __futex_wait(volatile void *ftx, int val, const struct timespec *timeout)
+// int __futex_wait(volatile void* ftx, int val, const struct timespec* timeout)
ENTRY(__futex_wait)
pushl %ebx
pushl %esi
ret
END(__futex_wait)
-// int __futex_wake(volatile void *ftx, int count)
+// int __futex_wake(volatile void* ftx, int count)
ENTRY(__futex_wake)
pushl %ebx
mov 8(%esp), %ebx /* ftx */
ret
END(__futex_wake)
-// int __futex_syscall3(volatile void *ftx, int op, int count)
+// int __futex_syscall3(volatile void* ftx, int op, int count)
ENTRY(__futex_syscall3)
pushl %ebx
movl 8(%esp), %ebx /* ftx */
ret
END(__futex_syscall3)
-// int __futex_syscall4(volatile void *ftx, int op, int val, const struct timespec *timeout)
+// int __futex_syscall4(volatile void* ftx, int op, int val, const struct timespec* timeout)
ENTRY(__futex_syscall4)
pushl %ebx
pushl %esi
* SUCH DAMAGE.
*/
-#include <asm/unistd.h>
-#include <machine/asm.h>
+#include <private/bionic_asm.h>
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
-/*
- * int __futex_wait(volatile void *ftx, int val, const struct timespec *timeout)
- */
+// int __futex_wait(volatile void* ftx, int val, const struct timespec* timeout)
ENTRY(__futex_wait)
mov %rdx, %r10 /* timeout */
mov %esi, %edx /* val */
ret
END(__futex_wait)
-/* int __futex_wake(volatile void *ftx, int count) */
-
+// int __futex_wake(volatile void* ftx, int count)
ENTRY(__futex_wake)
mov %esi, %edx
mov $FUTEX_WAKE, %esi
ret
END(__futex_wake)
-/* int __futex_syscall3(volatile void *ftx, int op, int count) */
+// int __futex_syscall3(volatile void* ftx, int op, int count)
ENTRY(__futex_syscall3)
mov $__NR_futex, %eax
syscall
ret
END(__futex_syscall3)
-/* int __futex_syscall4(volatile void *ftx, int op, int val, const struct timespec *timeout) */
+// int __futex_syscall4(volatile void* ftx, int op, int val, const struct timespec* timeout)
ENTRY(__futex_syscall4)
mov %rcx, %r10 /* timeout */
mov $__NR_futex, %eax
for(;;) {
serial = pi->serial;
while(SERIAL_DIRTY(serial)) {
- __futex_wait((volatile void *)&pi->serial, serial, 0);
+ __futex_wait((volatile void *)&pi->serial, serial, NULL);
serial = pi->serial;
}
len = SERIAL_VALUE_LEN(serial);
prop_area *pa = __system_property_area__;
n = pa->serial;
do {
- __futex_wait(&pa->serial, n, 0);
+ __futex_wait(&pa->serial, n, NULL);
} while(n == pa->serial);
} else {
n = pi->serial;
do {
- __futex_wait((volatile void *)&pi->serial, n, 0);
+ __futex_wait((volatile void *)&pi->serial, n, NULL);
} while(n == pi->serial);
}
return 0;
prop_area *pa = __system_property_area__;
do {
- __futex_wait(&pa->serial, serial, 0);
+ __futex_wait(&pa->serial, serial, NULL);
} while(pa->serial == serial);
return pa->serial;
for(;;) {
serial = pi->serial;
while(SERIAL_DIRTY(serial)) {
- __futex_wait((volatile void *)&pi->serial, serial, 0);
+ __futex_wait((volatile void *)&pi->serial, serial, NULL);
serial = pi->serial;
}
len = SERIAL_VALUE_LEN(serial);
#ifndef _BIONIC_FUTEX_H
#define _BIONIC_FUTEX_H
-#include <linux/compiler.h> /* needed for __user in non-uapi futex.h */
#include <linux/futex.h>
#include <sys/cdefs.h>