This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: problem w/ GCC asm stmt on sparc



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 ;-)

Later,
David "Sparc" Miller
davem@caip.rutgers.edu