GICD_ISENABLER和GICD_ICENABLER之间的区别用于禁用中断

时间:2013-10-29 08:01:47

标签: linux linux-kernel arm

根据GIC手册, GICD_ISENABLER

Reads 
0 Forwarding of the corresponding interrupt is disabled. 
1 Forwarding of the corresponding interrupt is enabled.
Writes 
0 Has no effect.
1 Enables the forwarding of the corresponding interrupt.

GICD_ICENABLER

Reads 
0 Forwarding of the corresponding interrupt is disabled.
1 Forwarding of the corresponding interrupt is enabled.
Writes 
0 Has No Effect
1 Disables the forwarding of the corresponding interrupt

是否需要2个寄存器?可以通过1解决目的。

1 个答案:

答案 0 :(得分:0)

作为背景,您可以阅读 Cortex-M的位带功能的ARM Appnote 179的第2.5节。问题是避免read-modify-write个周期。假设您有一些主线代码,希望禁用中断 #X 。在此过程中,会发生无关的中断 #Y 并禁用该中断。 CPU进程可以按以下顺序进行,

  1. 主线读取中断屏蔽#X,#Y 清除。
  2. 发生中断
  3. 中断禁用int #Y
  4. Mainline恢复,设置int #X mask
  5. Mainline写中断屏蔽,不设置 #Y
  6. 虽然这些寄存器的读数是等效的,但写入非常重要,竞争条件如上所述,并且中断很常见。您可以禁止屏蔽 irq服务例程中的中断。但是,通常有硬件,它不会关闭,通常需要进行这种屏蔽。

    当屏蔽中断位时,您当然可以屏蔽主线中的所有中断。但是,这会增加中断延迟并且通常对系统不利。使用双寄存器结构,可以避免读 - 修改 - 写并以原子方式屏蔽中断位。

相关问题