problem w/ GCC asm stmt on sparc

David S. Miller
Tue Jun 24 14:13:00 GMT 1997

A more efficient (and working ;-) sequence would be:

int spin_trylock(spinlock_t *lock)
	unsigned int result;
	__asm__ __volatile__("ldstub [%1], %0"
			     : "=r" (result)
			     : "r" (lock)
			     : "memory");
	return (result == 0);

I know that works because I have been using it in the Linux kernel for
some time now on SMP ;-)

David "Sparc" Miller

More information about the crossgcc mailing list