IRQL = Interrupt Request.中断请求,当中断发生后,发生中断的设备通过它使用的中断请求信号线象中断控制器报告中断。CPU可以通过IRQ号来识别中断。
如果某个Interrupt产生了,且IRQL <= 目前Processor的IRQL Setting,那么将不会影响目前程序的运行。如果IRQL > 目前Processor的IRQL Setting,将执行中断程序,总而言之,较搞优先级的Interrupt中断较低优先级的Interrupt。通过函数KeGetCurrentIRQL()可以得到目前Processor的IRQL。可用的IRQL如下:
- 软件IRQL(Software IRQL )
- PASSIVE_LEVEL 0 // Passive release level
- LOW_LEVEL 0 // Lowest interrupt level
- APC_LEVEL 1 // APC interrupt level
- DISPATCH_LEVEL 2 // Dispatch level
- 硬件IRQL(Hardware IRQL )
- DIRQL: from 3 to 26 for device ISR
- PROFILE_LEVEL 27, 0x1B // Timer used for profiling.
- CLOCK1_LEVEL 28, 0x1C // Interval clock 1 level - not used on x86
- CLOCK2_LEVEL 28, 0x1C // Interval clock 2 level
- SYNCH_LEVEL 28, 0x1C // Synchronization level
- IPI_LEVEL 29, 0x1D // Interprocessor interrupt level
- POWER_LEVEL 30, 0x1E // Power failure level
- HIGH_LEVEL 31, 0x1F // Highest interrupt level
PASSIVE_LEVEL
DISPATCH_LEVEL,
DIRQL
使用SpinLock的可解決在多個驅動程式中同步的問題。DDK提供了兩組function。
- KeAcquireSpinLock()
- KeReleaseSpinLock()
- KeAcquireSpinLockAtDpcLevel()
- KeReleaseSpinLockAtDpcLevel()
No comments:
Post a Comment