I've been familiar with both the task priority register cr8
(IRQL on Windows), and of course I know how we can enable and disable interrupts using cli
and sti
. However, I have a few questions regarding the two.
First, does clearing the interrupt flag cli
"override" the current value stored in the TPR? For example: the TPR is PASSIVE_LEVEL (0)
. If interrupts are disabled, does the value in the TPR not matter anymore? Second: I was reading this from Wikipedia:
Loading TPR with 0 enables all external interrupts. Loading TPR with 15 (1111b) disables all external interrupts.
Does this mean setting the TPR to 0xF
KzRaiseIrql(HIGH_LEVEL)
is equivalent to cli
? What happens if my TPR is 0xF
and the interrupt flag is cleared? What if the interrupt flag is enabled?
The two are completely independent, and it works exactly as you’d expect.
If IF is 0, it doesn’t matter what TPR is. If TPR is 0xF, it doesn’t matter what IF is. In either case, all interrupts are masked.