Revision 4955a2cd exec-all.h
b/exec-all.h | ||
---|---|---|
392 | 392 |
#ifdef __i386__ |
393 | 393 |
static inline int testandset (int *p) |
394 | 394 |
{ |
395 |
char ret; |
|
396 |
long int readval; |
|
395 |
long int readval = 0; |
|
397 | 396 |
|
398 |
__asm__ __volatile__ ("lock; cmpxchgl %3, %1; sete %0"
|
|
399 |
: "=q" (ret), "=m" (*p), "=a" (readval)
|
|
400 |
: "r" (1), "m" (*p), "a" (0)
|
|
401 |
: "memory");
|
|
402 |
return ret;
|
|
397 |
__asm__ __volatile__ ("lock; cmpxchgl %2, %0"
|
|
398 |
: "+m" (*p), "+a" (readval)
|
|
399 |
: "r" (1) |
|
400 |
: "cc");
|
|
401 |
return readval;
|
|
403 | 402 |
} |
404 | 403 |
#endif |
405 | 404 |
|
406 | 405 |
#ifdef __x86_64__ |
407 | 406 |
static inline int testandset (int *p) |
408 | 407 |
{ |
409 |
char ret; |
|
410 |
int readval; |
|
408 |
long int readval = 0; |
|
411 | 409 |
|
412 |
__asm__ __volatile__ ("lock; cmpxchgl %3, %1; sete %0"
|
|
413 |
: "=q" (ret), "=m" (*p), "=a" (readval)
|
|
414 |
: "r" (1), "m" (*p), "a" (0)
|
|
415 |
: "memory");
|
|
416 |
return ret;
|
|
410 |
__asm__ __volatile__ ("lock; cmpxchgl %2, %0"
|
|
411 |
: "+m" (*p), "+a" (readval)
|
|
412 |
: "r" (1) |
|
413 |
: "cc");
|
|
414 |
return readval;
|
|
417 | 415 |
} |
418 | 416 |
#endif |
419 | 417 |
|
... | ... | |
484 | 482 |
: "=r" (ret) |
485 | 483 |
: "m" (p) |
486 | 484 |
: "cc","memory"); |
487 |
return ret == 0;
|
|
485 |
return ret; |
|
488 | 486 |
} |
489 | 487 |
#endif |
490 | 488 |
|
Also available in: Unified diff