【发布时间】:2016-02-18 01:49:59
【问题描述】:
我正在尝试了解 Linux 中断处理机制。我试着用谷歌搜索了一下,但找不到这个问题的答案。有人可以向我解释一下为什么 handle_IRQ_event 需要在最后调用 local_irq_disable 吗?在此之后,控制返回到 do_irq,最终将返回到入口点。那么谁将启用中断。?它是中断处理程序的责任吗?如果是,为什么会这样?
编辑
参考代码
asmlinkage int handle_IRQ_event(unsigned int irq, struct pt_regs *regs, struct irqaction *action)
{
int status = 1;
int retval = 0;
if (!(action->flags & SA_INTERRUPT))
local_irq_enable();
do
{
status |= action->flags;
retval |= action->handler(irq, action->dev_id, regs);
action = action->next;
}
while (action);
if (status & SA_SAMPLE_RANDOM)
add_interrupt_randomness(irq);
local_irq_disable();
return retval;
}
【问题讨论】:
-
有相关的代码可以发一下吗?你一直在看什么?没有任何上下文,我们无法为您提供帮助。
-
Antiduh,我指的是在handle_IRQ_event函数的末尾使用local_irq_disable调用。?
-
我知道。在您的问题中发布一些代码。 stackoverflow.com/help/mcve
-
asmlinkage int handle_IRQ_event(unsigned int irq, struct pt_regs *regs, struct irqaction *action) { int status = 1; int retval = 0; if (!(action->flags & SA_INTERRUPT)) local_irq_enable();做{状态|=动作->标志; retval |= action->handler(irq, action->dev_id, regs);行动=行动->下一步; } 而(动作); if (status & SA_SAMPLE_RANDOM) add_interrupt_randomness(irq); local_irq_disable();返回 retval; }
-
以上是LLD3中handle_IRQ_event函数的实现。请让我知道这是否足够?
标签: linux-kernel linux-device-driver embedded-linux