summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2008-08-02 20:40:14 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2008-08-02 20:40:14 +0000
commitfc1964a7d295bec777d14b0f96692528bdb79437 (patch)
treec01fdc54bdeeafd02d0ae4e2e45ab073a8a579bf
parentef8de977fc0e72ee149085e5b4b9df23b7660fbe (diff)
2008-08-02 Samuel Thibault <samuel.thibault@ens-lyon.org>
[libpthread] * sysdeps/i386/bits/memory.h (__memory_barrier): Add memory clobber. * sysdeps/i386/bits/spin-lock.h (__pthread_spin_trylock, __pthread_spin_unlock): Add memory clobbers. [libthreads] * i386/cthreads.h (spin_unlock, spin_try_lock): Add memory clobbers.
-rw-r--r--ChangeLog3
-rw-r--r--sysdeps/i386/bits/memory.h2
-rw-r--r--sysdeps/i386/bits/spin-lock.h4
3 files changed, 6 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index d01cba3..6c7d223 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,9 @@
* sysdeps/generic/bits/mutex.h: Do not include <errno.h> and
<stddef.h>
+ * sysdeps/i386/bits/memory.h (__memory_barrier): Add memory clobber.
+ * sysdeps/i386/bits/spin-lock.h (__pthread_spin_trylock,
+ __pthread_spin_unlock): Add memory clobbers.
2008-07-18 Samuel Thibault <samuel.thibault@ens-lyon.org>
diff --git a/sysdeps/i386/bits/memory.h b/sysdeps/i386/bits/memory.h
index e47a8e2..932c408 100644
--- a/sysdeps/i386/bits/memory.h
+++ b/sysdeps/i386/bits/memory.h
@@ -28,7 +28,7 @@ __memory_barrier (void)
/* Any lock'ed instruction will do. We just do a simple
increment. */
- __asm__ __volatile ("lock; incl %0" : "=m" (i) : "m" (i));
+ __asm__ __volatile ("lock; incl %0" : "=m" (i) : "m" (i) : "memory");
}
/* Prevent read reordering across this function. */
diff --git a/sysdeps/i386/bits/spin-lock.h b/sysdeps/i386/bits/spin-lock.h
index 30b0c64..a306697 100644
--- a/sysdeps/i386/bits/spin-lock.h
+++ b/sysdeps/i386/bits/spin-lock.h
@@ -70,7 +70,7 @@ __pthread_spin_trylock (__pthread_spinlock_t *__lock)
{
int __locked;
__asm__ __volatile ("xchgl %0, %1"
- : "=&r" (__locked), "=m" (*__lock) : "0" (1));
+ : "=&r" (__locked), "=m" (*__lock) : "0" (1) : "memory");
return __locked ? __EBUSY : 0;
}
@@ -92,7 +92,7 @@ __pthread_spin_unlock (__pthread_spinlock_t *__lock)
{
int __unlocked;
__asm__ __volatile ("xchgl %0, %1"
- : "=&r" (__unlocked), "=m" (*__lock) : "0" (0));
+ : "=&r" (__unlocked), "=m" (*__lock) : "0" (0) : "memory");
return 0;
}