Update.
authorUlrich Drepper <drepper@redhat.com>
Fri, 7 Mar 2003 22:23:23 +0000 (22:23 +0000)
committerUlrich Drepper <drepper@redhat.com>
Fri, 7 Mar 2003 22:23:23 +0000 (22:23 +0000)
* rt/tst-aio7.c (do_test): Give buff permanent extend, too.

ChangeLog
linuxthreads/ChangeLog
linuxthreads/sysdeps/ia64/pspinlock.c
rt/tst-aio7.c

index 1931979d39eb03750e9e52d8afdb6fa60f38e837..34780aebc009626e35a4a7f06b114421b3739e30 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2003-03-07  Ulrich Drepper  <drepper@redhat.com>
 
+       * rt/tst-aio7.c (do_test): Give buff permanent extend, too.
+
        * sysdeps/powerpc/fpu/w_sqrt.c: Fix comment.
 
 2003-03-07  Roland McGrath  <roland@redhat.com>
index ff677b0d7651a2c7d172be132b47eb81d74d7148..e226fa7566d0c483b1c353794a2e2c29aecb1913 100644 (file)
@@ -1,3 +1,8 @@
+2003-03-07  Jakub Jelinek  <jakub@redhat.com>
+
+       * sysdeps/ia64/pspinlock.c (__pthread_spin_lock,
+       __pthread_spin_trylock): Rewritten.
+
 2003-03-06  Ulrich Drepper  <drepper@redhat.com>
 
        * tst-cancel4.c (tf_sleep): Lower sleep time a bit to not upset
index e3aeea60cb95b9f3a3357f785845bebf2843ce55..14c7f3a18115b2acee11eee58f426f2eb338c643 100644 (file)
@@ -1,5 +1,5 @@
 /* POSIX spinlock implementation.  ia64 version.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jes Sorensen <jes@linuxcare.com>
 
@@ -21,6 +21,7 @@
 #include <errno.h>
 #include <pthread.h>
 #include "internals.h"
+#include <ia64intrin.h>
 
 /* This implementation is inspired by the implementation used in the
    Linux kernel. */
 int
 __pthread_spin_lock (pthread_spinlock_t *lock)
 {
-  asm volatile
-    ("mov ar.ccv = r0\n\t"
-     "mov r3 = 1\n\t"
-     ";;\n"
-     "1:\n\t"
-     "ld4 r2 = %0\n\t"
-     ";;\n\t"
-     "cmp4.eq p0, p7 = r0, r2\n\t"
-     "(p7) br.cond.spnt.few 1b \n\t"
-     "cmpxchg4.acq r2 = %0, r3, ar.ccv\n\t"
-     ";;\n\t"
-     "cmp4.eq p0, p7 = r0, r2\n\t"
-     "(p7) br.cond.spnt.few 1b\n\t"
-     ";;\n"
-     :: "m" (lock) : "r2", "r3", "p7", "memory");
+  int *p = (int *) lock;
+  
+  while (__builtin_expect (__sync_val_compare_and_swap_si (p, 0, 1), 0))
+    {
+      /* Spin without using the atomic instruction.  */
+      do
+        __asm __volatile ("" : : : "memory");
+      while (*p);
+    }
   return 0;
 }
 weak_alias (__pthread_spin_lock, pthread_spin_lock)
@@ -51,16 +46,7 @@ weak_alias (__pthread_spin_lock, pthread_spin_lock)
 int
 __pthread_spin_trylock (pthread_spinlock_t *lock)
 {
-  int oldval;
-
-  asm volatile
-    ("mov ar.ccv = r0\n\t"
-     "mov r2 = 1\n\t"
-     ";;\n\t"
-     "cmpxchg4.acq %0 = %1, r2, ar.ccv\n\t"
-     ";;\n"
-     : "=r" (oldval) : "m" (lock) : "r2", "memory");
-  return oldval > 0 ? 0 : EBUSY;
+  return __sync_val_compare_and_swap_si ((int *) lock, 0, 1) == 0 ? 0 : EBUSY;
 }
 weak_alias (__pthread_spin_trylock, pthread_spin_trylock)
 
index 2925b6233cdd5f1c64b765d628c81e39c7fadc01..a035f943bae0f773b86a54cc12606ebc9fe65bf7 100644 (file)
@@ -119,7 +119,7 @@ do_test (void)
   {
     const int BYTES = 8, ELEMS = 2;
     int i, r, fd;
-    char buff[BYTES];
+    static char buff[BYTES];
     char name[] = "/tmp/aio7.XXXXXX";
     struct timespec timeout;
     static struct aiocb cb0, cb1;