123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- #include <errno.h>
- #include <pthread.h>
- #include <sgidefs.h>
- #include <sys/tas.h>
- #include "internals.h"
- int
- __pthread_spin_lock (pthread_spinlock_t *lock)
- {
- unsigned int tmp1, tmp2;
- __asm__ __volatile__
- ("\t\t\t# spin_lock\n"
- "1:\n\t"
- ".set push\n\t"
- #if _MIPS_SIM == _ABIO32
- ".set mips2\n\t"
- #endif
- "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)
- : "memory");
- return 0;
- }
- weak_alias (__pthread_spin_lock, pthread_spin_lock)
- int
- __pthread_spin_trylock (pthread_spinlock_t *lock)
- {
-
- return 0;
- }
- weak_alias (__pthread_spin_trylock, pthread_spin_trylock)
- int
- __pthread_spin_unlock (pthread_spinlock_t *lock)
- {
- __asm__ __volatile__
- ("\t\t\t# spin_unlock\n\t"
- "sw $0,%0"
- : "=m" (*lock)
- :
- : "memory");
- return 0;
- }
- weak_alias (__pthread_spin_unlock, pthread_spin_unlock)
- int
- __pthread_spin_init (pthread_spinlock_t *lock, int pshared)
- {
-
- *lock = 0;
- return 0;
- }
- weak_alias (__pthread_spin_init, pthread_spin_init)
- int
- __pthread_spin_destroy (pthread_spinlock_t *lock)
- {
-
- return 0;
- }
- weak_alias (__pthread_spin_destroy, pthread_spin_destroy)
|