From a99bfa85d82aecc3eb780779377a9e178e7189d2 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 16 Jul 2002 01:02:04 +0000 Subject: Update. 2002-07-02 H.J. Lu * sysdeps/mips/atomicity.h: Don't include . Always use ll/sc. * sysdeps/unix/sysv/linux/mips/sys/tas.h: Likewise. * sysdeps/unix/sysv/linux/configure.in: Set arch_minimum_kernel to 2.4.0 for mips. TLS fail if USE_TLS is not defined. --- sysdeps/mips/atomicity.h | 45 +++++++--------------------------- sysdeps/unix/sysv/linux/configure | 2 +- sysdeps/unix/sysv/linux/configure.in | 2 +- sysdeps/unix/sysv/linux/mips/sys/tas.h | 17 +++---------- 4 files changed, 14 insertions(+), 52 deletions(-) (limited to 'sysdeps') diff --git a/sysdeps/mips/atomicity.h b/sysdeps/mips/atomicity.h index b4b7b64..bccacd9 100644 --- a/sysdeps/mips/atomicity.h +++ b/sysdeps/mips/atomicity.h @@ -20,11 +20,8 @@ #ifndef _MIPS_ATOMICITY_H #define _MIPS_ATOMICITY_H 1 -#include #include -#if (_MIPS_ISA >= _MIPS_ISA_MIPS2) - static inline int __attribute__ ((unused)) exchange_and_add (volatile uint32_t *mem, int val) @@ -34,9 +31,12 @@ exchange_and_add (volatile uint32_t *mem, int val) __asm__ __volatile__ ("/* Inline exchange & add */\n" "1:\n\t" + ".set push\n\t" + ".set mips2\n\t" "ll %0,%3\n\t" "addu %1,%4,%0\n\t" "sc %1,%2\n\t" + ".set pop\n\t" "beqz %1,1b\n\t" "/* End exchange & add */" : "=&r"(result), "=&r"(tmp), "=m"(*mem) @@ -55,9 +55,12 @@ atomic_add (volatile uint32_t *mem, int val) __asm__ __volatile__ ("/* Inline atomic add */\n" "1:\n\t" + ".set push\n\t" + ".set mips2\n\t" "ll %0,%2\n\t" "addu %0,%3,%0\n\t" "sc %0,%1\n\t" + ".set pop\n\t" "beqz %0,1b\n\t" "/* End atomic add */" : "=&r"(result), "=m"(*mem) @@ -74,11 +77,14 @@ compare_and_swap (volatile long int *p, long int oldval, long int newval) __asm__ __volatile__ ("/* Inline compare & swap */\n" "1:\n\t" + ".set push\n\t" + ".set mips2\n\t" "ll %1,%5\n\t" "move %0,$0\n\t" "bne %1,%3,2f\n\t" "move %0,%4\n\t" "sc %0,%2\n\t" + ".set pop\n\t" "beqz %0,1b\n" "2:\n\t" "/* End compare & swap */" @@ -89,37 +95,4 @@ compare_and_swap (volatile long int *p, long int oldval, long int newval) return ret; } -#else /* (_MIPS_ISA >= _MIPS_ISA_MIPS2) */ - -#warning MIPS I atomicity functions are not atomic - -static inline int -__attribute__ ((unused)) -exchange_and_add (volatile uint32_t *mem, int val) -{ - int result = *mem; - *mem += val; - return result; -} - -static inline void -__attribute__ ((unused)) -atomic_add (volatile uint32_t *mem, int val) -{ - *mem += val; -} - -static inline int -__attribute__ ((unused)) -compare_and_swap (volatile long int *p, long int oldval, long int newval) -{ - if (*p != oldval) - return 0; - - *p = newval; - return 1; -} - -#endif /* !(_MIPS_ISA >= _MIPS_ISA_MIPS2) */ - #endif /* atomicity.h */ diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure index b08bbb2..3b30a9c 100644 --- a/sysdeps/unix/sysv/linux/configure +++ b/sysdeps/unix/sysv/linux/configure @@ -72,7 +72,7 @@ case "$machine" in libc_cv_gcc_unwind_find_fde=yes ;; mips*) - arch_minimum_kernel=2.2.15 + arch_minimum_kernel=2.4.0 libc_cv_gcc_unwind_find_fde=yes ;; powerpc*) diff --git a/sysdeps/unix/sysv/linux/configure.in b/sysdeps/unix/sysv/linux/configure.in index 5362d45..c5aa4e8 100644 --- a/sysdeps/unix/sysv/linux/configure.in +++ b/sysdeps/unix/sysv/linux/configure.in @@ -59,7 +59,7 @@ case "$machine" in libc_cv_gcc_unwind_find_fde=yes ;; mips*) - arch_minimum_kernel=2.2.15 + arch_minimum_kernel=2.4.0 libc_cv_gcc_unwind_find_fde=yes ;; powerpc*) diff --git a/sysdeps/unix/sysv/linux/mips/sys/tas.h b/sysdeps/unix/sysv/linux/mips/sys/tas.h index 2a1a045..7ad916c 100644 --- a/sysdeps/unix/sysv/linux/mips/sys/tas.h +++ b/sysdeps/unix/sysv/linux/mips/sys/tas.h @@ -21,8 +21,6 @@ #define _SYS_TAS_H 1 #include -#include -#include __BEGIN_DECLS @@ -34,8 +32,6 @@ extern int _test_and_set (int *p, int v) __THROW; # define _EXTERN_INLINE extern __inline # endif -# if (_MIPS_ISA >= _MIPS_ISA_MIPS2) - _EXTERN_INLINE int _test_and_set (int *p, int v) __THROW { @@ -44,10 +40,13 @@ _test_and_set (int *p, int v) __THROW __asm__ __volatile__ ("/* Inline test and set */\n" "1:\n\t" + ".set push\n\t" + ".set mips2\n\t" "ll %0,%3\n\t" "move %1,%4\n\t" "beq %0,%4,2f\n\t" "sc %1,%2\n\t" + ".set pop\n\t" "beqz %1,1b\n" "2:\n\t" "/* End test and set */" @@ -58,16 +57,6 @@ _test_and_set (int *p, int v) __THROW return r; } -# else /* !(_MIPS_ISA >= _MIPS_ISA_MIPS2) */ - -_EXTERN_INLINE int -_test_and_set (int *p, int v) __THROW -{ - return sysmips (MIPS_ATOMIC_SET, (int) p, v, 0); -} - -# endif /* !(_MIPS_ISA >= _MIPS_ISA_MIPS2) */ - #endif /* __USE_EXTERN_INLINES */ __END_DECLS -- cgit v1.1