关于中断处理

On the hardware platforms supported by Windows, external I/O interrupts come into one of the lines on an interrupt controller. The controller in turn interrupts the processor on a single line. Once the processor is interrupted, it queries the controller to get the interrupt request (IRQ). The interrupt controller translates the IRQ to an interrupt number, uses this number as an index into a structure called the interrupt dispatch table (IDT), and transfers control to the appropriate interrupt dispatch routine. At system boot time, Windows fills in the IDT with pointers to the kernel routines that handle each interrupt and exception.

Windows maps hardware IRQs to interrupt numbers in the IDT, and the system also uses the IDT to configure trap handlers for exceptions. For example, the x86 and x64 exception number for a page fault (an exception that occurs when a thread attempts to access a page of virtual memory that isn't defined or present) is 0xe. Thus, entry 0xe in the IDT points to the system's page fault handler. Although the architectures supported by Windows allow up to 256 IDT entries, the number of IRQs a particular machine can support is determined by the design of the interrupt controller the machine uses.

windows把硬件IRQ的中断号映射到IDT(系统同样使用IDT来配置异常处理的陷阱句柄)。

Each processor has a separate IDT so that different processors can run different ISRs, if appropriate. For example, in a multiprocessor system, each processor receives the clock interrupt, but only one processor updates the system clock in response to this interrupt. All the processors, however, use the interrupt to measure thread quantum and to initiate rescheduling when a thread's quantum ends. Similarly, some system configurations might require that a particular processor handle certain device interrupts.

每一个处理器都有各自独立的IDT,所以不同的处理器可以运行不同的中断服务例程。 例如,在一个多处理器的系统中,每个处理器都接收时钟中断,但只有一个处理器更新系统时钟来响应这个中断。

 Software Interrupt Request Levels (IRQLs)

中断请求级别

Although interrupt controllers perform a level of interrupt prioritization, Windows imposes its own interrupt priority scheme known as interrupt request levels (IRQLs). The kernel represents IRQLs internally as a number from 0 through 31 on x86 and from 0 to 15 on x64 and IA64, with higher numbers representing higher-priority interrupts. Although the kernel defines the standard set of IRQLs for software interrupts, the HAL maps hardware-interrupt numbers to the IRQLs.

虽然中断控制器标识了中断优先级,但是Windows仍然创建了自己的称作中断请求级别(IRQs)的结构。内核将IRQs区分为0-31(x86), 0-15(x64,IA64),数字越大表征中断优先级越高。 内核定义了软件中断的标准IRQLs集合,HAL将硬件中断号映射到IRQLs中。

你可能感兴趣的:(thread,windows,exception,System,Numbers,Pointers)