views:

134

answers:

1

I need atomic operation code equivalent to following:

__asm__ __volatile__ (
                    " lock;\n"
                    " addl %1, %0; \n"
                    " movl %0, %%eax"
                    : "=m"(a), "=a" (c)
                    : "ir"(b)
                    );

(Adding two variables a and b and output stored in both a and c on Linux)

Equivalent to above is needed on Solaris(Sparc architecture). Is there anyone to help me out?

+1  A: 

This article should answer all of your questions in depth and even provides code: http://developers.sun.com/solaris/articles/atomic%5Fsparc/

You may need to re-format it a little in terms of inline assembly, but other than that, should be good to go.

D.J. Capelis