cpu 如何知道硬件中断?

How cpu is aware of hardware interrupt?

根据维基百科,

An interrupt is a signal to the processor emitted by hardware or software indicating an event that needs immediate attention. An interrupt alerts the processor to a high-priority condition requiring the interruption of the current code the processor is executing. The processor responds by suspending its current activities, saving its state, and executing a function called an interrupt handler (or an interrupt service routine, ISR) to deal with the event.

上面写了cpu是由硬件控制器通知的。 我无法弄清楚通知的过程。

cpu从哪里看出中断的存在?程序计数器指针是否被覆盖? cpu 如何决定停止执行当前任务? cpu 正在处理当前任务时,中断信号存储在哪里?

硬件中断通常在当前正在执行的 CPU 指令结束时触发,并通过实际硬件信号向 CPU 发出信号 - 中断请求 pin/line CPU 被拉 high/low。执行中断确认硬件周期而不是执行下一条指令,其内部结构是特定于体系结构的,以确定从哪个代码地址开始执行中断处理程序。中断的代码 PC 必须保存在某个地方,并且可能会触发内存保护环更改。它本质上是一种全硬件操作,但由软件预先配置。您应该查阅您的 CPU 和中断控制器用户手册以获取中断机制的完整详细信息,并查阅您的 OS 以获取其 initialization/configuration.