开发者

Need atomic addition operation code on Solaris(sparc architecture)

I need atomic operation code equivalent to following:

__asm__ __volatile__ (
                    " lock;\n"
                    " addl %1, %0; \n"
                    " movl %0, %%eax"
                    : "=m"(a), "=a" (c)
     开发者_Go百科               : "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?


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

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜