既然时钟中断函数是HalpClockInterrupt,那就从它开始研究,WRK没有公布它,还是从reactos开始看吧,reactos是仿windows,所以可能和windows原版有些差别,不过差别不大
VOID FASTCALL HalpClockInterruptHandler(IN PKTRAP_FRAME TrapFrame) { ULONG LastIncrement; KIRQL Irql;3 /* Enter trap */ KiEnterInterruptTrap(TrapFrame); /* Start the interrupt */ if (ghhghhjvc(CLOCK2_LEVEL, PRIMARY_VECTOR_BASE, &Irql)) { /* Update the performance counter */ HalpPerfCounter.QuadPart += HalpCurrentRollOver; HalpPerfCounterCutoff = KiEnableTimerWatchdog; /* Save increment */ LastIncrement = HalpCurrentTimeIncrement; /* Check if someone changed the time rate */ if (HalpClockSetMSRate) { /* Update the global values */ HalpCurrentTimeIncrement = HalpRolloverTable[HalpNextMSRate - 1].Increment; HalpCurrentRollOver = HalpRolloverTable[HalpNextMSRate - 1].RollOver; /* Set new timer rollover */ HalpSetTimerRollOver((USHORT)HalpCurrentRollOver); /* We‘re done */ HalpClockSetMSRate = FALSE; } /* Update the system time -- the kernel will exit this trap */ KeUpdateSystemTime(TrapFrame, LastIncrement, Irql); 更新系统时间 } /* Spurious, just end the interrupt */ KiEoiHelper(TrapFrame); }
时钟中断最后会调用KeUpdateSystemTime,所以看看这个函数是干嘛的
时间: 2024-10-26 13:34:47