diff options
author | Dave Korn <dave.korn.cygwin@gmail.com> | 2009-06-05 13:53:01 +0000 |
---|---|---|
committer | Dave Korn <dave.korn.cygwin@gmail.com> | 2009-06-05 13:53:01 +0000 |
commit | 611fe46079da132279a9a94af2f3e79b94038d27 (patch) | |
tree | ddd7c226f6ad3da782fd1254aa5956401cafd2d8 | |
parent | a341aab5a55d82a04f44a52cd8161f55d443580d (diff) | |
download | newlib-611fe46079da132279a9a94af2f3e79b94038d27.zip newlib-611fe46079da132279a9a94af2f3e79b94038d27.tar.gz newlib-611fe46079da132279a9a94af2f3e79b94038d27.tar.bz2 |
* winbase.h (ilockexch): Fix asm constraints.
(ilockcmpexch): Likewise.
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/winbase.h | 31 |
2 files changed, 25 insertions, 11 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 339ed9f..14e82b9 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2009-06-05 Dave Korn <dave.korn.cygwin@gmail.com> + + * winbase.h (ilockexch): Fix asm constraints. + (ilockcmpexch): Likewise. + 2009-06-05 Corinna Vinschen <corinna@vinschen.de> * heap.cc (heap_init): Fix typo in comment. diff --git a/winsup/cygwin/winbase.h b/winsup/cygwin/winbase.h index 18f0be3..eec196d 100644 --- a/winsup/cygwin/winbase.h +++ b/winsup/cygwin/winbase.h @@ -38,22 +38,31 @@ ilockdecr (volatile long *m) extern __inline__ long ilockexch (volatile long *t, long v) { - register int __res; - __asm__ __volatile__ ("\n\ -1: lock cmpxchgl %3,(%1)\n\ - jne 1b\n\ - ": "=a" (__res), "=q" (t): "1" (t), "q" (v), "0" (*t): "cc"); - return __res; + return + ({ + register __typeof (*t) ret __asm ("%eax"); + __asm __volatile ("\n" + "1: lock cmpxchgl %2, %1\n" + " jne 1b\n" + : "=a" (ret), "=m" (*t) + : "r" (v), "m" (*t), "0" (*t) + : "memory"); + ret; + }); } extern __inline__ long ilockcmpexch (volatile long *t, long v, long c) { - register int __res; - __asm__ __volatile__ ("\n\ - lock cmpxchgl %3,(%1)\n\ - ": "=a" (__res), "=q" (t) : "1" (t), "q" (v), "0" (c): "cc"); - return __res; + return + ({ + register __typeof (*t) ret __asm ("%eax"); + __asm __volatile ("lock cmpxchgl %2, %1" + : "=a" (ret), "=m" (*t) + : "r" (v), "m" (*t), "0" (c) + : "memory"); + ret; + }); } #undef InterlockedIncrement |