• 从时钟中断到线程调度的分析(二)


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

  • 相关阅读:
    斐波那契数列变形
    poj 1061 青蛙的约会+拓展欧几里得+题解
    Leading and Trailing LightOJ
    HDU-1576 A/B 基础数论+解题报告
    swal() 弹出层的用法
    jqurey.running.min.js运动的字体效果
    echarts中dataZoom的使用
    echarts动态添加数据
    设备适配尺寸
    sublime Text3 插件
  • 原文地址:https://www.cnblogs.com/testvt/p/5492994.html
Copyright © 2020-2023  润新知