assembly - ARM Cortex M 中的 ISB 指令

标签 assembly arm cortex-m memory-barriers instructions

到目前为止,我使用了 3 个 NOP 来“清理”管道。 最近我遇到了为我做那件事的 ISB 指令。 查看 arm 信息中心,我注意到这个命令需要 4 个周期(在 Cortex M0 下),而 3 个 NOP 只需要 3 个。

我为什么要使用这个命令?它与 3 个 NOP 有什么不同?

最佳答案

这是 NOP ( http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0552a/CHDJJGFB.html ) 的问题:

Operation

NOP performs no operation and is not guaranteed to be time consuming. The processor might remove it from the pipeline before it reaches the execution stage.

Use NOP for padding, for example to place the subsequent instructions on a 64-bit boundary.

其他 ARM Cortex 设备的文档中有相同的信息,因此将该指令用于填充以外的任何目的是根本不可靠的。您唯一能保证的是这条指令将占用 2 (nop) 或 4 个字节 (nop.w),并且它不会执行任何操作 - 仅此而已。

关于assembly - ARM Cortex M 中的 ISB 指令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41790296/

相关文章:

ios - .o 文件中缺少汇编函数

linux汇编反转一个字符串

arm - STM32 I-CODE 和 D-CODE 总线

c - 中断服务例程不会跳回到 ARM Cortex M0 上的中断处理程序

android - 在汇编中编写 Android 应用程序部件

arm - 如何完成低优先级中断?

assembly - x86 汇编语言中跳转到特定行

linux - 简单的加法器不工作

assembly - 如何在GNU ARM汇编程序中为寄存器赋予其他名称?

在 GNU 链接器脚本中创建额外的可重定位节