locking problem with mips atomicity
Michael Eager
eager@mvista.com
Tue Mar 16 16:10:00 GMT 2004
Richard Henderson wrote:
>
> On Mon, Mar 15, 2004 at 03:57:02PM -0800, Michael Eager wrote:
> > - "ll %0,%3\n\t"
> > - "addu %1,%4,%0\n\t"
> > - "sc %1,%2\n\t"
> > + "la %3,%2\n\t"
> > + "ll %0,0(%3)\n\t"
> > + "addu %1,%5,%0\n\t"
> > + "sc %1,0(%3)\n\t"
> > ".set pop\n\t"
> > "beqz %1,1b\n\t"
> > "/* End exchange & add */"
> > - : "=&r"(__result), "=&r"(__tmp), "=m"(*__mem)
> > + : "=&r"(__result), "=&r"(__tmp), "=m"(*__mem), "=r" (temp)
>
> Better is to make the compiler force the address into a register.
> It may already be that way, resulting in "la r3,0(r4)".
This is exactly what this code does.
--
Michael Eager eager@mvista.com 408-328-8426
MontaVista Software, Inc. 1237 E. Arques Ave., Sunnyvale, CA 94085
More information about the Gcc
mailing list