提交 4955a2cd 编写于 作者: B bellard

test and set fixes


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1269 c046a42c-6fe2-441c-8c8c-71466251a162
上级 a8d3431a
...@@ -392,28 +392,26 @@ static inline int testandset (int *p) ...@@ -392,28 +392,26 @@ static inline int testandset (int *p)
#ifdef __i386__ #ifdef __i386__
static inline int testandset (int *p) static inline int testandset (int *p)
{ {
char ret; long int readval = 0;
long int readval;
__asm__ __volatile__ ("lock; cmpxchgl %3, %1; sete %0" __asm__ __volatile__ ("lock; cmpxchgl %2, %0"
: "=q" (ret), "=m" (*p), "=a" (readval) : "+m" (*p), "+a" (readval)
: "r" (1), "m" (*p), "a" (0) : "r" (1)
: "memory"); : "cc");
return ret; return readval;
} }
#endif #endif
#ifdef __x86_64__ #ifdef __x86_64__
static inline int testandset (int *p) static inline int testandset (int *p)
{ {
char ret; long int readval = 0;
int readval;
__asm__ __volatile__ ("lock; cmpxchgl %3, %1; sete %0" __asm__ __volatile__ ("lock; cmpxchgl %2, %0"
: "=q" (ret), "=m" (*p), "=a" (readval) : "+m" (*p), "+a" (readval)
: "r" (1), "m" (*p), "a" (0) : "r" (1)
: "memory"); : "cc");
return ret; return readval;
} }
#endif #endif
...@@ -484,7 +482,7 @@ static inline int testandset (int *p) ...@@ -484,7 +482,7 @@ static inline int testandset (int *p)
: "=r" (ret) : "=r" (ret)
: "m" (p) : "m" (p)
: "cc","memory"); : "cc","memory");
return ret == 0; return ret;
} }
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册