diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2005-02-07 14:09:05 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2005-02-07 14:09:05 +0000 |
commit | 4955a2cd1600344081e0b618d96c3b29942f76ef (patch) | |
tree | 534dedc088fe6a87770ddfcc37f10f9af8f2cda0 /exec-all.h | |
parent | a8d3431ae931aa44ee6228ffecf6277714389de7 (diff) |
test and set fixes
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1269 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'exec-all.h')
-rw-r--r-- | exec-all.h | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/exec-all.h b/exec-all.h index 0079b6494a..b1f488cd0a 100644 --- a/exec-all.h +++ b/exec-all.h @@ -392,28 +392,26 @@ static inline int testandset (int *p) #ifdef __i386__ static inline int testandset (int *p) { - char ret; - long int readval; + long int readval = 0; - __asm__ __volatile__ ("lock; cmpxchgl %3, %1; sete %0" - : "=q" (ret), "=m" (*p), "=a" (readval) - : "r" (1), "m" (*p), "a" (0) - : "memory"); - return ret; + __asm__ __volatile__ ("lock; cmpxchgl %2, %0" + : "+m" (*p), "+a" (readval) + : "r" (1) + : "cc"); + return readval; } #endif #ifdef __x86_64__ static inline int testandset (int *p) { - char ret; - int readval; + long int readval = 0; - __asm__ __volatile__ ("lock; cmpxchgl %3, %1; sete %0" - : "=q" (ret), "=m" (*p), "=a" (readval) - : "r" (1), "m" (*p), "a" (0) - : "memory"); - return ret; + __asm__ __volatile__ ("lock; cmpxchgl %2, %0" + : "+m" (*p), "+a" (readval) + : "r" (1) + : "cc"); + return readval; } #endif @@ -484,7 +482,7 @@ static inline int testandset (int *p) : "=r" (ret) : "m" (p) : "cc","memory"); - return ret == 0; + return ret; } #endif |