diff options
author | Siddhesh Poyarekar <siddhesh@redhat.com> | 2012-12-27 20:43:02 +0530 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@redhat.com> | 2012-12-27 20:43:02 +0530 |
commit | 8ebac7785b6ac0e412075d832af2ede21153148a (patch) | |
tree | 32e30957aef71861e7e5eb17d9d832da43bf8e52 /nptl | |
parent | 2c8bfe7d6f22c4a599894846bf1715d93b295f53 (diff) | |
download | glibc-8ebac7785b6ac0e412075d832af2ede21153148a.zip glibc-8ebac7785b6ac0e412075d832af2ede21153148a.tar.gz glibc-8ebac7785b6ac0e412075d832af2ede21153148a.tar.bz2 |
[s390] Replace lll_futex_* assembly code with INTERNAL_SYSCALL
Diffstat (limited to 'nptl')
-rw-r--r-- | nptl/ChangeLog | 11 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h | 105 |
2 files changed, 42 insertions, 74 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog index b950687..78ffe2d 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,14 @@ +2012-12-27 Siddhesh Poyarekar <siddhesh@redhat.com> + + * sysdeps/unix/sysv/linux/s390/lowlevellock.h (SYS_futex): + Remove definition. + (lll_futex_timed_wait): Replace assembly code with + INTERNAL_SYSCALL. + (lll_futex_timed_wait_bitset): Likewise. + (lll_futex_wake): Likewise. + (lll_futex_requeue): Likewise. + (lll_futex_wake_unlock): Likewise. + 2012-12-08 Siddhesh Poyarekar <siddhesh@redhat.com> * sysdeps/unix/sysv/linux/s390/jmp-unwind.c (_longjmp_unwind): diff --git a/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h index 0b7110f..78154af 100644 --- a/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h +++ b/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h @@ -76,60 +76,35 @@ #define lll_futex_wait(futex, val, private) \ lll_futex_timed_wait (futex, val, NULL, private) -#define lll_futex_timed_wait(futex, val, timespec, private) \ +#define lll_futex_timed_wait(futexp, val, timespec, private) \ ({ \ - register unsigned long int __r2 asm ("2") = (unsigned long int) (futex); \ - register unsigned long int __r3 asm ("3") \ - = __lll_private_flag (FUTEX_WAIT, private); \ - register unsigned long int __r4 asm ("4") = (unsigned long int) (val); \ - register unsigned long int __r5 asm ("5") = (unsigned long int)(timespec);\ - register unsigned long int __result asm ("2"); \ + INTERNAL_SYSCALL_DECL (__err); \ \ - __asm __volatile ("svc %b1" \ - : "=d" (__result) \ - : "i" (SYS_futex), "0" (__r2), "d" (__r3), \ - "d" (__r4), "d" (__r5) \ - : "cc", "memory" ); \ - __result; \ + INTERNAL_SYSCALL (futex, __err, 4, (futexp), \ + __lll_private_flag (FUTEX_WAIT, private), \ + (val), (timespec)); \ }) #define lll_futex_timed_wait_bitset(futexp, val, timespec, clockbit, private) \ ({ \ - register unsigned long int __r2 asm ("2") = (unsigned long int) (futexp); \ - register unsigned long int __r3 asm ("3") \ - = __lll_private_flag ((FUTEX_WAIT_BITSET | clockbit), private); \ - register unsigned long int __r4 asm ("4") = (long int) (val); \ - register unsigned long int __r5 asm ("5") = (long int) (timespec); \ - register unsigned long int __r6 asm ("6") = (unsigned long int) (NULL); \ - register unsigned long int __r7 asm ("7") \ - = (unsigned int) (FUTEX_BITSET_MATCH_ANY); \ - register unsigned long __result asm ("2"); \ + INTERNAL_SYSCALL_DECL (__err); \ + int __op = FUTEX_WAIT_BITSET | clockbit; \ \ - __asm __volatile ("svc %b1" \ - : "=d" (__result) \ - : "i" (SYS_futex), "0" (__r2), "d" (__r3), \ - "d" (__r4), "d" (__r5), "d" (__r6), "d" (__r7) \ - : "cc", "memory" ); \ - __result; \ + INTERNAL_SYSCALL (futex, __err, 6, (futexp), \ + __lll_private_flag (__op, private), \ + (val), (timespec), NULL /* Unused. */, \ + FUTEX_BITSET_MATCH_ANY); \ }) - -#define lll_futex_wake(futex, nr, private) \ +#define lll_futex_wake(futexp, nr, private) \ ({ \ - register unsigned long int __r2 asm ("2") = (unsigned long int) (futex); \ - register unsigned long int __r3 asm ("3") \ - = __lll_private_flag (FUTEX_WAKE, private); \ - register unsigned long int __r4 asm ("4") = (unsigned long int) (nr); \ - register unsigned long int __result asm ("2"); \ + INTERNAL_SYSCALL_DECL (__err); \ \ - __asm __volatile ("svc %b1" \ - : "=d" (__result) \ - : "i" (SYS_futex), "0" (__r2), "d" (__r3), "d" (__r4) \ - : "cc", "memory" ); \ - __result; \ + INTERNAL_SYSCALL (futex, __err, 4, (futexp), \ + __lll_private_flag (FUTEX_WAKE, private), \ + (nr), 0); \ }) - #define lll_robust_dead(futexv, private) \ do \ { \ @@ -142,48 +117,30 @@ /* Returns non-zero if error happened, zero if success. */ -#define lll_futex_requeue(futex, nr_wake, nr_move, mutex, val, private) \ +#define lll_futex_requeue(futexp, nr_wake, nr_move, mutex, val, private) \ ({ \ - register unsigned long int __r2 asm ("2") = (unsigned long int) (futex); \ - register unsigned long int __r3 asm ("3") \ - = __lll_private_flag (FUTEX_CMP_REQUEUE, private); \ - register unsigned long int __r4 asm ("4") = (long int) (nr_wake); \ - register unsigned long int __r5 asm ("5") = (long int) (nr_move); \ - register unsigned long int __r6 asm ("6") = (unsigned long int) (mutex); \ - register unsigned long int __r7 asm ("7") = (int) (val); \ - register unsigned long __result asm ("2"); \ + INTERNAL_SYSCALL_DECL (__err); \ + long int __ret; \ \ - __asm __volatile ("svc %b1" \ - : "=d" (__result) \ - : "i" (SYS_futex), "0" (__r2), "d" (__r3), \ - "d" (__r4), "d" (__r5), "d" (__r6), "d" (__r7) \ - : "cc", "memory" ); \ - __result > -4096UL; \ + __ret = INTERNAL_SYSCALL (futex, __err, 6, (futexp), \ + __lll_private_flag (FUTEX_CMP_REQUEUE, private),\ + (nr_wake), (nr_move), (mutex), (val)); \ + INTERNAL_SYSCALL_ERROR_P (__ret, __err); \ }) - /* Returns non-zero if error happened, zero if success. */ -#define lll_futex_wake_unlock(futex, nr_wake, nr_wake2, futex2, private) \ +#define lll_futex_wake_unlock(futexp, nr_wake, nr_wake2, futexp2, private) \ ({ \ - register unsigned long int __r2 asm ("2") = (unsigned long int) (futex); \ - register unsigned long int __r3 asm ("3") \ - = __lll_private_flag (FUTEX_WAKE_OP, private); \ - register unsigned long int __r4 asm ("4") = (long int) (nr_wake); \ - register unsigned long int __r5 asm ("5") = (long int) (nr_wake2); \ - register unsigned long int __r6 asm ("6") = (unsigned long int) (futex2); \ - register unsigned long int __r7 asm ("7") \ - = (int) FUTEX_OP_CLEAR_WAKE_IF_GT_ONE; \ - register unsigned long __result asm ("2"); \ + INTERNAL_SYSCALL_DECL (__err); \ + long int __ret; \ \ - __asm __volatile ("svc %b1" \ - : "=d" (__result) \ - : "i" (SYS_futex), "0" (__r2), "d" (__r3), \ - "d" (__r4), "d" (__r5), "d" (__r6), "d" (__r7) \ - : "cc", "memory" ); \ - __result > -4096UL; \ + __ret = INTERNAL_SYSCALL (futex, __err, 6, (futexp), \ + __lll_private_flag (FUTEX_WAKE_OP, private), \ + (nr_wake), (nr_wake2), (futexp2), \ + FUTEX_OP_CLEAR_WAKE_IF_GT_ONE); \ + INTERNAL_SYSCALL_ERROR_P (__ret, __err); \ }) - #define lll_compare_and_swap(futex, oldval, newval, operation) \ do { \ __typeof (futex) __futex = (futex); \ |