需要Solaris(sparc架构)上的原子加法操作代码

发布于 2024-08-11 00:26:04 字数 370 浏览 1 评论 0原文

我需要相当于以下的原子操作代码:(

__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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

命硬 2024-08-18 00:26:04

本文应该深入回答您的所有问题,甚至提供代码: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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文