Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
2002-07-02  H.J. Lu  <hjl@gnu.org>

	* sysdeps/mips/atomicity.h: Don't include <sgidefs.h>.  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.
  • Loading branch information
Ulrich Drepper committed Jul 16, 2002
1 parent 807bce8 commit a99bfa8
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 72 deletions.
11 changes: 10 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
2002-07-02 H.J. Lu <hjl@gnu.org>

* sysdeps/mips/atomicity.h: Don't include <sgidefs.h>. 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.

2002-07-15 Ulrich Drepper <drepper@redhat.com>

* elf/dl-load.c (_dl_map_object_from_fd): If loaded object uses
TLS fail is USE_TLS is not defined.
TLS fail if USE_TLS is not defined.

* libio/wfileops.c (_IO_wfile_seekoff): Reposition wide pointers
and adjust state for seek position. [PR libc/4070]
Expand Down
6 changes: 6 additions & 0 deletions linuxthreads/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2002-07-02 H.J. Lu <hjl@gnu.org>

* sysdeps/mips/pspinlock.c: Don't include <sgidefs.h>. Always
use ll/sc.
* sysdeps/mips/pt-machine.h: Likewise.

2002-07-14 Ulrich Drepper <drepper@redhat.com>

* manager.c (pthread_handle_create): Initialize self-reference in
Expand Down
17 changes: 3 additions & 14 deletions linuxthreads/sysdeps/mips/pspinlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,9 @@

#include <errno.h>
#include <pthread.h>
#include <sgidefs.h>
#include <sys/tas.h>
#include "internals.h"

#if (_MIPS_ISA >= _MIPS_ISA_MIPS2)

/* This implementation is similar to the one used in the Linux kernel. */
int
__pthread_spin_lock (pthread_spinlock_t *lock)
Expand All @@ -34,10 +31,13 @@ __pthread_spin_lock (pthread_spinlock_t *lock)
asm volatile
("\t\t\t# spin_lock\n"
"1:\n\t"
".set push\n\t"
".set mips2\n\t"
"ll %1,%3\n\t"
"li %2,1\n\t"
"bnez %1,1b\n\t"
"sc %2,%0\n\t"
".set pop\n\t"
"beqz %2,1b"
: "=m" (*lock), "=&r" (tmp1), "=&r" (tmp2)
: "m" (*lock)
Expand All @@ -46,17 +46,6 @@ __pthread_spin_lock (pthread_spinlock_t *lock)
return 0;
}

#else /* !(_MIPS_ISA >= _MIPS_ISA_MIPS2) */

int
__pthread_spin_lock (pthread_spinlock_t *lock)
{
while (_test_and_set ((int *) lock, 1));
return 0;
}

#endif /* !(_MIPS_ISA >= _MIPS_ISA_MIPS2) */

weak_alias (__pthread_spin_lock, pthread_spin_lock)


Expand Down
8 changes: 3 additions & 5 deletions linuxthreads/sysdeps/mips/pt-machine.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#ifndef _PT_MACHINE_H
#define _PT_MACHINE_H 1

#include <sgidefs.h>
#include <sys/tas.h>

#ifndef PT_EI
Expand Down Expand Up @@ -51,8 +50,6 @@ register char * stack_pointer __asm__ ("$29");

/* Compare-and-swap for semaphores. */

#if (_MIPS_ISA >= _MIPS_ISA_MIPS2)

#define HAS_COMPARE_AND_SWAP
PT_EI int
__compare_and_swap (long int *p, long int oldval, long int newval)
Expand All @@ -62,11 +59,14 @@ __compare_and_swap (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 */"
Expand All @@ -77,6 +77,4 @@ __compare_and_swap (long int *p, long int oldval, long int newval)
return ret;
}

#endif /* (_MIPS_ISA >= _MIPS_ISA_MIPS2) */

#endif /* pt-machine.h */
45 changes: 9 additions & 36 deletions sysdeps/mips/atomicity.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@
#ifndef _MIPS_ATOMICITY_H
#define _MIPS_ATOMICITY_H 1

#include <sgidefs.h>
#include <inttypes.h>

#if (_MIPS_ISA >= _MIPS_ISA_MIPS2)

static inline int
__attribute__ ((unused))
exchange_and_add (volatile uint32_t *mem, int val)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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 */"
Expand All @@ -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 */
2 changes: 1 addition & 1 deletion sysdeps/unix/sysv/linux/configure
Original file line number Diff line number Diff line change
Expand Up @@ -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*)
Expand Down
2 changes: 1 addition & 1 deletion sysdeps/unix/sysv/linux/configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -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*)
Expand Down
17 changes: 3 additions & 14 deletions sysdeps/unix/sysv/linux/mips/sys/tas.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
#define _SYS_TAS_H 1

#include <features.h>
#include <sgidefs.h>
#include <sys/sysmips.h>

__BEGIN_DECLS

Expand All @@ -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
{
Expand All @@ -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 */"
Expand All @@ -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
Expand Down

0 comments on commit a99bfa8

Please sign in to comment.