关于中断和中断处理的问题
您能否让我知道硬件/驱动程序如何引发中断?在 SMP 中,哪个 CPU 会被中断? 如果IRQ被多个设备共享,内核如何识别哪个设备引起了中断。
/加内什
Could you please let me know how the hardware/driver raises an interrupt? and in an SMP, which CPU gets interrupted?
If IRQ is shared by multiple devices, how the kernel identifies the which device caused the interrupt.
/Ganesh
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
传统上,有一条实际的中断线从设备连接到中断控制器,当它处于高电平(或低电平,或处于边沿)时,会生成中断,CPU 开始执行中断处理程序。
在现代系统中,中断往往是总线上的消息,这些消息被发送到中断控制器(或者可能有多个)。
在更多细节方面,您需要更具体,细节取决于您所讨论的硬件类型。
Traditionally there is an actual interrupt wire that runs from the device to the interrupt controller, when it is high (or low, or on an edge) an interrupt is generated and the CPU starts executing the interrupt handler.
On modern systems interrupts tend to be messages on a bus which are sent to the interrupt controller (or there may be several).
In terms of more detail you'll need to be more specific, the details vary depending on what sort of hardware you're talking about.
中断处理程序也称为ISR,是操作系统中设备驱动程序的一部分。在操作系统中,每个 irq 号代表来自中断控制器的一条中断线。
这些设备硬连线到中断控制器,如果设备中产生中断,中断控制器将向相应的 CPU 发出信号。中断目标 CPU 可在中断控制器中针对每个中断线进行编程。
为了在硬件中共享中断号,例如 ARM 中的 GPIO,中断控制器或设备应该为真正的中断号提供一个额外的寄存器。此外,ISR 应查阅该寄存器以获取真实的 IRQ 编号。
The interrupt handler also called ISR is a part of device driver in OS. In OS, each irq number represents a interrupt line from the interrupt controller.
The devices are hard wired to the interrupt controller and the interrupt controller will signal the corresponding CPU if there are interrupts generated in devices. The interrupt target CPUs are programmable in interrupt controller for each interrupt lines.
For sharing interrupt numbers in hardware, like GPIO in ARM, the interrupt controller or device should provide an additional register for the real interrupt number. In addition, the ISR should consult that register for the real IRQ number.