mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-11-18 18:05:21 +00:00
add and fix testandset for x86_64
This commit is contained in:
parent
3a033cf79b
commit
d9168c9869
@ -249,15 +249,14 @@ static inline int testandset(volatile int *p)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __i386__
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#define HAVE_TEST_AND_SET 1
|
||||
static inline int testandset(volatile int *p)
|
||||
{
|
||||
int ret;
|
||||
long int readval;
|
||||
long int ret;
|
||||
/* Note: the "xchg" instruction does not need a "lock" prefix */
|
||||
__asm__ __volatile__("xchgl %0, %1"
|
||||
: "=r" (ret), "=m" (*p), "=a" (readval)
|
||||
__asm__ __volatile__("xchgl %k0, %1"
|
||||
: "=r" (ret), "=m" (*p)
|
||||
: "0" (1), "m" (*p)
|
||||
: "memory");
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user