And also, from
assemble codes of KeGetCurrentIRQL, we know that current IRQL locates at [ffdff024].
Address
ffdff024 is in
kernel space.
IRQL vs. Hardware
IRQs:
For X86 system,
it has two 8259 pics (programmable interrupt controller), each could handle 8
IRQs. But the slave
8259 pic is
attached to master 8259 ‘s pin 2 (IRQ2). So there are 15 IRQs available.
In general, IRQ 0
has the highest privilege,
the next is IRQ
1, the last is IRQ7. (Irq 8 –
Irq 15 have the
same privilage with IRQ2 ?).
For each IRQ, we
can mask it by zero the
correspond bit of
IMR (interrupt mask
register, port
21h for the master 8259,
0xA1h for the
slave.). The IMR register is
only writable, it
is not readable. So system
must store it’s
current value. For each IRQL,
Windows NT
maintains a table of IMR at
hal!KiI8259MaskTable.
(Softice’s IRQ
command possibly
uses this value, I’m not
sure.)
The realizaton of
IRQ priorities is dependent to hardware (8259 pic). Windows uses hardware
independent IRQL to
mask all the
differences of the various hardwares. IRQL can be looked as an
extension of hardware IRQ levels. But
IRQL is defined and
manipulated by the OS, it’s an action of software. The IRQLs of a lower priority
IRQ may be a
higher level.
(See the output result of “intobj” under softice.)
To manager IRQs,
windows uses Interrupt Object (KINTERRUPT). The interrupt object is initialized
and tied to
system interrupt
objects chain, when device drivers call IoConnectInterrupt.
Structure
Definition of Interrupt object:
typedef struct
_KINTERRUPT {
// Size: 0x1E4
/*000*/
CSHORT
Type
/*002*/
USHORT
Size
/*004*/
LIST_ENTRY InterruptListEntry
/*00C*/ ULONG
ServiceRoutine
/*010*/ ULONG
ServiceContext
/*014*/ SpinLock
/*018*/
Spare1
/*01C*/
ActualLock
/*020*/
DispatchAddress
/*024*/ Vector
// The tied
vector of this IRQ
/*028*/ Irql
// Current
IRQ’s IRQL
/*029*/
SynchronizeIrql
// The
SynchronizeIRQL of the IRQ (To be detailed later)
/*02A*/
FloatingSave
/*02B*/
Connected
/*02C*/ Number
/*02D*/
ShareVector
/*030*/
Mode
/*034*/
Spare2
/*038*/
Spare3
/*03C*/
DispatchCode