[s390] Replace lll_futex_* assembly code with INTERNAL_SYSCALL

This commit is contained in:
Siddhesh Poyarekar 2012-12-27 20:43:02 +05:30
parent 2c8bfe7d6f
commit 8ebac7785b
2 changed files with 42 additions and 74 deletions

View File

@ -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> 2012-12-08 Siddhesh Poyarekar <siddhesh@redhat.com>
* sysdeps/unix/sysv/linux/s390/jmp-unwind.c (_longjmp_unwind): * sysdeps/unix/sysv/linux/s390/jmp-unwind.c (_longjmp_unwind):

View File

@ -76,60 +76,35 @@
#define lll_futex_wait(futex, val, private) \ #define lll_futex_wait(futex, val, private) \
lll_futex_timed_wait (futex, val, NULL, 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); \ INTERNAL_SYSCALL_DECL (__err); \
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"); \
\ \
__asm __volatile ("svc %b1" \ INTERNAL_SYSCALL (futex, __err, 4, (futexp), \
: "=d" (__result) \ __lll_private_flag (FUTEX_WAIT, private), \
: "i" (SYS_futex), "0" (__r2), "d" (__r3), \ (val), (timespec)); \
"d" (__r4), "d" (__r5) \
: "cc", "memory" ); \
__result; \
}) })
#define lll_futex_timed_wait_bitset(futexp, val, timespec, clockbit, private) \ #define lll_futex_timed_wait_bitset(futexp, val, timespec, clockbit, private) \
({ \ ({ \
register unsigned long int __r2 asm ("2") = (unsigned long int) (futexp); \ INTERNAL_SYSCALL_DECL (__err); \
register unsigned long int __r3 asm ("3") \ int __op = FUTEX_WAIT_BITSET | clockbit; \
= __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"); \
\ \
__asm __volatile ("svc %b1" \ INTERNAL_SYSCALL (futex, __err, 6, (futexp), \
: "=d" (__result) \ __lll_private_flag (__op, private), \
: "i" (SYS_futex), "0" (__r2), "d" (__r3), \ (val), (timespec), NULL /* Unused. */, \
"d" (__r4), "d" (__r5), "d" (__r6), "d" (__r7) \ FUTEX_BITSET_MATCH_ANY); \
: "cc", "memory" ); \
__result; \
}) })
#define lll_futex_wake(futexp, nr, private) \
#define lll_futex_wake(futex, nr, private) \
({ \ ({ \
register unsigned long int __r2 asm ("2") = (unsigned long int) (futex); \ INTERNAL_SYSCALL_DECL (__err); \
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"); \
\ \
__asm __volatile ("svc %b1" \ INTERNAL_SYSCALL (futex, __err, 4, (futexp), \
: "=d" (__result) \ __lll_private_flag (FUTEX_WAKE, private), \
: "i" (SYS_futex), "0" (__r2), "d" (__r3), "d" (__r4) \ (nr), 0); \
: "cc", "memory" ); \
__result; \
}) })
#define lll_robust_dead(futexv, private) \ #define lll_robust_dead(futexv, private) \
do \ do \
{ \ { \
@ -142,48 +117,30 @@
/* Returns non-zero if error happened, zero if success. */ /* 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); \ INTERNAL_SYSCALL_DECL (__err); \
register unsigned long int __r3 asm ("3") \ long int __ret; \
= __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"); \
\ \
__asm __volatile ("svc %b1" \ __ret = INTERNAL_SYSCALL (futex, __err, 6, (futexp), \
: "=d" (__result) \ __lll_private_flag (FUTEX_CMP_REQUEUE, private),\
: "i" (SYS_futex), "0" (__r2), "d" (__r3), \ (nr_wake), (nr_move), (mutex), (val)); \
"d" (__r4), "d" (__r5), "d" (__r6), "d" (__r7) \ INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
: "cc", "memory" ); \
__result > -4096UL; \
}) })
/* Returns non-zero if error happened, zero if success. */ /* 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); \ INTERNAL_SYSCALL_DECL (__err); \
register unsigned long int __r3 asm ("3") \ long int __ret; \
= __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"); \
\ \
__asm __volatile ("svc %b1" \ __ret = INTERNAL_SYSCALL (futex, __err, 6, (futexp), \
: "=d" (__result) \ __lll_private_flag (FUTEX_WAKE_OP, private), \
: "i" (SYS_futex), "0" (__r2), "d" (__r3), \ (nr_wake), (nr_wake2), (futexp2), \
"d" (__r4), "d" (__r5), "d" (__r6), "d" (__r7) \ FUTEX_OP_CLEAR_WAKE_IF_GT_ONE); \
: "cc", "memory" ); \ INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
__result > -4096UL; \
}) })
#define lll_compare_and_swap(futex, oldval, newval, operation) \ #define lll_compare_and_swap(futex, oldval, newval, operation) \
do { \ do { \
__typeof (futex) __futex = (futex); \ __typeof (futex) __futex = (futex); \