汇编器和跳转指令(它是如何工作的)

发布于 2024-08-19 21:30:52 字数 64 浏览 2 评论 0原文

跳跃是如何运作的? 它是设置IP寄存器还是增加IP寄存器?

我们执行代码的位置是相对还是绝对改变?

How does jump works ?
Does it set the IP register or does it increase it ??

Is it relative or absolute change of place were we execute the code?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

夏末染殇 2024-08-26 21:30:52

在 Intel 上,既有增加 IP 的近跳转,也有使用绝对地址的远跳转。所以答案是——两者都有。

在其他体系结构上,通常两种形式的跳转都可用,但不一定是相同的命令。例如,在 ARM 上,对于远跳转,您只需分配给 PC 寄存器(mov pc, rx)。或者从内存中加载它。另一方面,B(分支)命令向同一 PC 寄存器添加增量。

On Intel, there is both near jump that increments the IP, and far jump that uses an absolute address. So the answer is - both.

On other architectures, typically, both forms of jump are available as well, but not necessarily as the same command. On ARM, for example, for far jump you just assign to the PC register (mov pc, rx). Or load it from memory. The B (branch) command, on the other hand, adds an increment to the same PC register.

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