3.定时器的扫描过程
真正开始扫描定时器的就是上述的KiRetireDpcList 检测到PRCB的定时器请求是true 调用KiTimerExpiration
//解除定时器的操作
VOID
KiTimerExpiration (
IN PKDPC TimerDpc,
IN PVOID DeferredContext,
IN PVOID SystemArgument1,
IN PVOID SystemArgument2
)
/*++
Routine Description:
This function is called when the clock interupt routine discovers that
a timer has expired.
N.B. This function executes on the same processor that receives clock
interrupts.
Arguments:
TimerDpc - Not used.
DeferredContext - Not used.
SystemArgument1 - Supplies the starting timer table index value to
use for the timer table scan.
SystemArgument2 - Not used.
Return Value:
None.
--*/
{
ULARGE_INTEGER CurrentTime;
ULONG DpcCount;
PKDPC Dpc;
DPC_ENTRY DpcTable[MAXIMUM_TIMERS_PROCESSED];
KIRQL DummyIrql;
LONG HandLimit;
LONG Index;
LARGE_INTEGER Interval;
PLIST_ENTRY ListHead;
PKSPIN_LOCK_QUEUE LockQueue;
PLIST_ENTRY NextEntry;
KIRQL OldIrql;
LONG Period;
#if !defined(NT_UP) || defined(_WIN64)
PKPRCB Prcb = KeGetCurrentPrcb();
#endif
ULARGE_INTEGER SystemTime;
PKTIMER Timer;
ULONG TimersExamined;
ULONG TimersProcessed;
UNREFERENCED_PARAMETER(TimerDpc);
UNREFERENCED_PARAMETER(DeferredContext);
UNREFERENCED_PARAMETER(SystemArgument2);
//
// Capture the timer expiration time, the current interrupt time, and
// the low tick count.
//
// N.B. Interrupts are disabled to ensure that interrupt activity on the
// current processor does not cause the values read to be skewed.
//
_disable();
KiQuerySystemTime((PLARGE_INTEGER)&SystemTime);
KiQueryInterruptTime((PLARGE_INTEGER)&CurrentTime);
HandLimit = (LONG)KiQueryLowTickCount();
_enable();
//
// If the timer table has not wrapped, then start with the specified
// timer table index value, and scan for timer entries that have expired.
// Otherwise, start with the specified timer table index value and scan
// the entire table for timer entries that have expired.
//
// N.B. This later condition exists when DPC processing is blocked for a
// period longer than one round trip throught the timer table.
//
// N.B. The current instance of the timer expiration execution w