* winbase.h (ilockexch): Fix asm constraints.

(ilockcmpexch):  Likewise.
This commit is contained in:
Dave Korn 2009-06-05 13:53:01 +00:00
parent a341aab5a5
commit 611fe46079
2 changed files with 25 additions and 11 deletions

View File

@ -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> 2009-06-05 Corinna Vinschen <corinna@vinschen.de>
* heap.cc (heap_init): Fix typo in comment. * heap.cc (heap_init): Fix typo in comment.

View File

@ -38,22 +38,31 @@ ilockdecr (volatile long *m)
extern __inline__ long extern __inline__ long
ilockexch (volatile long *t, long v) ilockexch (volatile long *t, long v)
{ {
register int __res; return
__asm__ __volatile__ ("\n\ ({
1: lock cmpxchgl %3,(%1)\n\ register __typeof (*t) ret __asm ("%eax");
jne 1b\n\ __asm __volatile ("\n"
": "=a" (__res), "=q" (t): "1" (t), "q" (v), "0" (*t): "cc"); "1: lock cmpxchgl %2, %1\n"
return __res; " jne 1b\n"
: "=a" (ret), "=m" (*t)
: "r" (v), "m" (*t), "0" (*t)
: "memory");
ret;
});
} }
extern __inline__ long extern __inline__ long
ilockcmpexch (volatile long *t, long v, long c) ilockcmpexch (volatile long *t, long v, long c)
{ {
register int __res; return
__asm__ __volatile__ ("\n\ ({
lock cmpxchgl %3,(%1)\n\ register __typeof (*t) ret __asm ("%eax");
": "=a" (__res), "=q" (t) : "1" (t), "q" (v), "0" (c): "cc"); __asm __volatile ("lock cmpxchgl %2, %1"
return __res; : "=a" (ret), "=m" (*t)
: "r" (v), "m" (*t), "0" (c)
: "memory");
ret;
});
} }
#undef InterlockedIncrement #undef InterlockedIncrement