zoukankan      html  css  js  c++  java
  • 从时钟中断到线程调度的分析(二)

        既然时钟中断函数是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,所以看看这个函数是干嘛的

  • 相关阅读:
    CF Hello 2020 E.New Year and Castle Construction
    HTML 简介
    グランドエスケープ
    CF 1244 C
    N皇后解法以及位运算优化
    CF
    动态规划TG.lv(1) (洛谷提高历练地)
    搜索Ex (洛谷提高历练地)
    数字图像处理——图像增强
    数字图像处理——图像的几何变换
  • 原文地址:https://www.cnblogs.com/testvt/p/5492994.html
Copyright © 2011-2022 走看看