This is the mail archive of the
libc-hacker@sourceware.cygnus.com
mailing list for the glibc project.
Re: gdb and linuxthreads (A deadlock in linuxthreads.)
One last thing: in the LinuxThreads changelog, we have
1998-08-31 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/i386/i686/pt-machine.h (testandset): Add memory clobber.
* sysdeps/i386/pt-machine.h: Likewise.
Suggested by Roland McGrath.
For symmetry, I'd suggest we put a memory clobber on compare_and_swap
as well. Weird things could happen if the compiler moves loads and
stores across the cswap. The patch follows.
- Xavier
Index: sysdeps/i386/pt-machine.h
===================================================================
RCS file: /glibc/cvsfiles/libc/linuxthreads/sysdeps/i386/pt-machine.h,v
retrieving revision 1.6
diff -c -r1.6 pt-machine.h
*** pt-machine.h 1998/10/09 15:10:45 1.6
--- pt-machine.h 1998/12/21 13:49:11
***************
*** 60,66 ****
__asm__ __volatile__ ("lock; cmpxchgl %3, %1; sete %0"
: "=q" (ret), "=m" (*p), "=a" (readval)
! : "r" (newval), "m" (*p), "a" (oldval));
return ret;
}
--- 60,67 ----
__asm__ __volatile__ ("lock; cmpxchgl %3, %1; sete %0"
: "=q" (ret), "=m" (*p), "=a" (readval)
! : "r" (newval), "m" (*p), "a" (oldval)
! : "memory");
return ret;
}
Index: sysdeps/i386/i686/pt-machine.h
===================================================================
RCS file: /glibc/cvsfiles/libc/linuxthreads/sysdeps/i386/i686/pt-machine.h,v
retrieving revision 1.5
diff -c -r1.5 pt-machine.h
*** pt-machine.h 1998/10/09 11:22:13 1.5
--- pt-machine.h 1998/12/21 13:49:11
***************
*** 57,63 ****
__asm__ __volatile__ ("lock; cmpxchgl %3, %1; sete %0"
: "=q" (ret), "=m" (*p), "=a" (readval)
! : "r" (newval), "m" (*p), "a" (oldval));
return ret;
}
--- 57,64 ----
__asm__ __volatile__ ("lock; cmpxchgl %3, %1; sete %0"
: "=q" (ret), "=m" (*p), "=a" (readval)
! : "r" (newval), "m" (*p), "a" (oldval)
! : "memory");
return ret;
}