开发者

Need atomic addition operation code on Solaris(sparc architecture)

开发者 https://www.devze.com 2022-12-11 16:34 出处:网络
I need atomic operation code equivalent to following: __asm__ __volatile__ ( \" lock;\\n\" \" addl %1, %0; \\n\"

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

精彩评论

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