diff options
Diffstat (limited to 'sysdeps/unix/sysv/linux/i386/lowlevellock.h')
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/lowlevellock.h | 78 |
1 files changed, 10 insertions, 68 deletions
diff --git a/sysdeps/unix/sysv/linux/i386/lowlevellock.h b/sysdeps/unix/sysv/linux/i386/lowlevellock.h index 7ae32196a5..38fbc2556f 100644 --- a/sysdeps/unix/sysv/linux/i386/lowlevellock.h +++ b/sysdeps/unix/sysv/linux/i386/lowlevellock.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2016 Free Software Foundation, Inc. +/* Copyright (C) 2002-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -26,7 +26,14 @@ # include <sys/param.h> # include <bits/pthreadtypes.h> # include <kernel-features.h> -# include <tcb-offsets.h> +/* <tcb-offsets.h> is generated from tcb-offsets.sym to define offsets + and sizes of types in <tls.h> as well as <pthread.h> which includes + <lowlevellock.h> via nptl/descr.h. Don't include <tcb-offsets.h> + when generating <tcb-offsets.h> to avoid circular dependency which + may lead to build hang on a many-core machine. */ +# ifndef GEN_AS_CONST_HEADERS +# include <tcb-offsets.h> +# endif # ifndef LOCK_INSTR # ifdef UP @@ -132,20 +139,6 @@ } \ }) -#define lll_robust_lock(futex, id, private) \ - ({ int result, ignore1, ignore2; \ - __asm __volatile (LOCK_INSTR "cmpxchgl %1, %2\n\t" \ - "jz 18f\n\t" \ - "1:\tleal %2, %%edx\n" \ - "0:\tmovl %7, %%ecx\n" \ - "2:\tcall __lll_robust_lock_wait\n" \ - "18:" \ - : "=a" (result), "=c" (ignore1), "=m" (futex), \ - "=&d" (ignore2) \ - : "0" (0), "1" (id), "m" (futex), "g" ((int) (private))\ - : "memory"); \ - result; }) - /* Special version of lll_lock which causes the unlock function to always wakeup waiters. */ @@ -165,22 +158,6 @@ }) -#define lll_robust_cond_lock(futex, id, private) \ - ({ int result, ignore1, ignore2; \ - __asm __volatile (LOCK_INSTR "cmpxchgl %1, %2\n\t" \ - "jz 18f\n\t" \ - "1:\tleal %2, %%edx\n" \ - "0:\tmovl %7, %%ecx\n" \ - "2:\tcall __lll_robust_lock_wait\n" \ - "18:" \ - : "=a" (result), "=c" (ignore1), "=m" (futex), \ - "=&d" (ignore2) \ - : "0" (0), "1" (id | FUTEX_WAITERS), "m" (futex), \ - "g" ((int) (private)) \ - : "memory"); \ - result; }) - - #define lll_timedlock(futex, timeout, private) \ ({ int result, ignore1, ignore2, ignore3; \ __asm __volatile (LOCK_INSTR "cmpxchgl %1, %3\n\t" \ @@ -203,21 +180,6 @@ extern int __lll_timedlock_elision (int *futex, short *adapt_count, #define lll_timedlock_elision(futex, adapt_count, timeout, private) \ __lll_timedlock_elision(&(futex), &(adapt_count), timeout, private) -#define lll_robust_timedlock(futex, timeout, id, private) \ - ({ int result, ignore1, ignore2, ignore3; \ - __asm __volatile (LOCK_INSTR "cmpxchgl %1, %3\n\t" \ - "jz 18f\n\t" \ - "1:\tleal %3, %%ecx\n" \ - "0:\tmovl %8, %%edx\n" \ - "2:\tcall __lll_robust_timedlock_wait\n" \ - "18:" \ - : "=a" (result), "=c" (ignore1), "=&d" (ignore2), \ - "=m" (futex), "=S" (ignore3) \ - : "0" (0), "1" (id), "m" (futex), "m" (timeout), \ - "4" ((int) (private)) \ - : "memory"); \ - result; }) - #if !IS_IN (libc) || defined UP # define __lll_unlock_asm LOCK_INSTR "subl $1, %0\n\t" #else @@ -255,21 +217,6 @@ extern int __lll_timedlock_elision (int *futex, short *adapt_count, } \ }) -#define lll_robust_unlock(futex, private) \ - (void) \ - ({ int ignore, ignore2; \ - __asm __volatile (LOCK_INSTR "andl %3, %0\n\t" \ - "je 18f\n\t" \ - "1:\tleal %0, %%eax\n" \ - "0:\tmovl %5, %%ecx\n" \ - "2:\tcall __lll_unlock_wake\n" \ - "18:" \ - : "=m" (futex), "=&a" (ignore), "=&c" (ignore2) \ - : "i" (FUTEX_WAITERS), "m" (futex), \ - "g" ((int) (private)) \ - : "memory"); \ - }) - #define lll_islocked(futex) \ (futex != LLL_LOCK_INITIALIZER) @@ -297,12 +244,7 @@ extern int __lll_timedwait_tid (int *tid, const struct timespec *abstime) ({ \ int __result = 0; \ if ((tid) != 0) \ - { \ - if ((abstime)->tv_nsec < 0 || (abstime)->tv_nsec >= 1000000000) \ - __result = EINVAL; \ - else \ - __result = __lll_timedwait_tid (&(tid), (abstime)); \ - } \ + __result = __lll_timedwait_tid (&(tid), (abstime)); \ __result; }) |