需要Solaris(sparc架构)上的原子加法操作代码
我需要相当于以下的原子操作代码:(
__asm__ __volatile__ (
" lock;\n"
" addl %1, %0; \n"
" movl %0, %%eax"
: "=m"(a), "=a" (c)
: "ir"(b)
);
在 Linux 上添加两个变量 a 和 b 并将输出存储在 a 和 c 中)
在 Solaris(Sparc 架构)上需要相当于上面的代码。 有人可以帮我吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
本文应该深入回答您的所有问题,甚至提供代码:http://developers。 sun.com/solaris/articles/atomic_sparc/
您可能需要在内联汇编方面稍微重新格式化它,但除此之外,应该很好。
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.