Stuff
public text v1 · immutableint cmpxchg(int oldval, int newval, lock_t * l)
{
int result;
asm volatile("lock; cmpxchgl %2, %0" :
"+m" (*l), "=a" (result) :
"r"(newval), "1"(oldval) :
"cc");
return result;
}
int test_and_set(lock_t * l, int newval)
{
return cmpxchg(l->status, newval, &l->status);
}