Windows NT 4.0 source code leak
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
1.5 KiB

4 years ago
  1. /*++
  2. Copyright (c) 1994 Microsoft Corporation
  3. Module Name:
  4. xxclock.c
  5. Abstract:
  6. This module implements the function necesssary to change the clock
  7. interrupt rate.
  8. Author:
  9. David N. Cutler (davec) 7-Feb-1994
  10. Environment:
  11. Kernel mode only.
  12. Revision History:
  13. --*/
  14. #include "halp.h"
  15. //
  16. // Define global data used to communicate new clock rates to the clock
  17. // interrupt service routine.
  18. //
  19. ULONG HalpCurrentTimeIncrement;
  20. ULONG HalpNextIntervalCount;
  21. ULONG HalpNextTimeIncrement;
  22. ULONG HalpNewTimeIncrement;
  23. ULONG
  24. HalSetTimeIncrement (
  25. IN ULONG DesiredIncrement
  26. )
  27. /*++
  28. Routine Description:
  29. This function is called to set the clock interrupt rate to the frequency
  30. required by the specified time increment value.
  31. N.B. This function is only executed on the processor that keeps the
  32. system time.
  33. Arguments:
  34. DesiredIncrement - Supplies desired number of 100ns units between clock
  35. interrupts.
  36. Return Value:
  37. The actual time increment in 100ns units.
  38. --*/
  39. {
  40. ULONG NewTimeIncrement;
  41. ULONG NextIntervalCount;
  42. KIRQL OldIrql;
  43. //
  44. // Raise IRQL to the highest level, set the new clock interrupt
  45. // parameters, lower IRQl, and return the new time increment value.
  46. //
  47. KeRaiseIrql(HIGH_LEVEL, &OldIrql);
  48. NextIntervalCount = DesiredIncrement / MINIMUM_INCREMENT;
  49. NewTimeIncrement = NextIntervalCount * MINIMUM_INCREMENT;
  50. HalpNextIntervalCount = NextIntervalCount;
  51. HalpNewTimeIncrement = NewTimeIncrement;
  52. KeLowerIrql(OldIrql);
  53. return NewTimeIncrement;
  54. }