aboutsummaryrefslogtreecommitdiff
path: root/nptl
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2006-03-01 20:05:53 +0000
committerRoland McGrath <roland@gnu.org>2006-03-01 20:05:53 +0000
commitc4a4875d0fe42612280c62130b25d01a8d76fea8 (patch)
treefe1f0782d1b960f139048340ce354422052f8eb8 /nptl
parent996f5e601e84cfabe27d829e523e07c2ceffdd2e (diff)
downloadglibc-c4a4875d0fe42612280c62130b25d01a8d76fea8.tar
glibc-c4a4875d0fe42612280c62130b25d01a8d76fea8.tar.gz
glibc-c4a4875d0fe42612280c62130b25d01a8d76fea8.tar.bz2
glibc-c4a4875d0fe42612280c62130b25d01a8d76fea8.zip
* sysdeps/sparc/sparc32/fpu/libm-test-ulps: Update.
* sysdeps/sparc/fpu/fraiseexcpt.c (__feraiseexcept): Use inline asm to make sure the compiler doesn't optimize insns out.
Diffstat (limited to 'nptl')
-rw-r--r--nptl/ChangeLog8
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h58
2 files changed, 64 insertions, 2 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 8c761fdd90..84d9b71a7c 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,11 @@
+2006-03-01 Jakub Jelinek <jakub@redhat.com>
+
+ * sysdeps/unix/sysv/linux/sparc/lowlevellock.h (lll_robust_mutex_dead,
+ lll_robust_mutex_trylock, lll_robust_mutex_lock,
+ lll_robust_mutex_cond_lock, lll_robust_mutex_timedlock,
+ lll_robust_mutex_unlock): Define.
+ (__lll_robust_lock_wait, __lll_robust_timedlock_wait): New prototypes.
+
2006-02-28 H.J. Lu <hongjiu.lu@intel.com>
* sysdeps/unix/sysv/linux/ia64/clone2.S: Include <clone2.S>
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h
index ad82aa3ea4..77eefc546c 100644
--- a/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h
@@ -78,6 +78,15 @@
INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
})
+#define lll_robust_mutex_dead(futexv) \
+ do \
+ { \
+ int *__futexp = &(futexv); \
+ atomic_or (__futexp, FUTEX_OWNER_DIED); \
+ lll_futex_wake (__futexp, 1); \
+ } \
+ while (0)
+
/* Returns non-zero if error happened, zero if success. */
#ifdef __sparc32_atomic_do_lock
/* Avoid FUTEX_WAKE_OP if supporting pre-v9 CPUs. */
@@ -112,9 +121,18 @@ __lll_mutex_cond_trylock (int *futex)
}
#define lll_mutex_cond_trylock(futex) __lll_mutex_cond_trylock (&(futex))
+static inline int
+__attribute__ ((always_inline))
+__lll_robust_mutex_trylock (int *futex, int id)
+{
+ return atomic_compare_and_exchange_val_acq (futex, id, 0) != 0;
+}
+#define lll_robust_mutex_trylock(futex, id) \
+ __lll_robust_mutex_trylock (&(futex), id)
+
extern void __lll_lock_wait (int *futex) attribute_hidden;
-
+extern int __lll_robust_lock_wait (int *futex) attribute_hidden;
static inline void
__attribute__ ((always_inline))
@@ -127,6 +145,17 @@ __lll_mutex_lock (int *futex)
}
#define lll_mutex_lock(futex) __lll_mutex_lock (&(futex))
+static inline int
+__attribute__ ((always_inline))
+__lll_robust_mutex_lock (int *futex, int id)
+{
+ int result = 0;
+ if (atomic_compare_and_exchange_bool_acq (futex, id, 0) != 0)
+ result = __lll_robust_lock_wait (futex);
+ return result;
+}
+#define lll_robust_mutex_lock(futex, id) \
+ __lll_robust_mutex_lock (&(futex), id)
static inline void
__attribute__ ((always_inline))
@@ -139,10 +168,14 @@ __lll_mutex_cond_lock (int *futex)
}
#define lll_mutex_cond_lock(futex) __lll_mutex_cond_lock (&(futex))
+#define lll_robust_mutex_cond_lock(futex, id) \
+ __lll_robust_mutex_lock (&(futex), (id) | FUTEX_WAITERS)
+
extern int __lll_timedlock_wait (int *futex, const struct timespec *)
attribute_hidden;
-
+extern int __lll_robust_timedlock_wait (int *futex, const struct timespec *)
+ attribute_hidden;
static inline int
__attribute__ ((always_inline))
@@ -158,6 +191,19 @@ __lll_mutex_timedlock (int *futex, const struct timespec *abstime)
#define lll_mutex_timedlock(futex, abstime) \
__lll_mutex_timedlock (&(futex), abstime)
+static inline int
+__attribute__ ((always_inline))
+__lll_robust_mutex_timedlock (int *futex, const struct timespec *abstime,
+ int id)
+{
+ int result = 0;
+ if (atomic_compare_and_exchange_bool_acq (futex, id, 0) != 0)
+ result = __lll_robust_timedlock_wait (futex, abstime);
+ return result;
+}
+#define lll_robust_mutex_timedlock(futex, abstime, id) \
+ __lll_robust_mutex_timedlock (&(futex), abstime, id)
+
#define lll_mutex_unlock(lock) \
((void) ({ \
int *__futex = &(lock); \
@@ -166,6 +212,14 @@ __lll_mutex_timedlock (int *futex, const struct timespec *abstime)
lll_futex_wake (__futex, 1); \
}))
+#define lll_robust_mutex_unlock(lock) \
+ ((void) ({ \
+ int *__futex = &(lock); \
+ int __val = atomic_exchange_rel (__futex, 0); \
+ if (__builtin_expect (__val & FUTEX_WAITERS, 0)) \
+ lll_futex_wake (__futex, 1); \
+ }))
+
#define lll_mutex_unlock_force(lock) \
((void) ({ \
int *__futex = &(lock); \