Leaked source code of windows server 2003
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.

146 lines
2.9 KiB

  1. /**
  2. *** Copyright (C) 1996-97 Intel Corporation. All rights reserved.
  3. ***
  4. *** The information and source code contained herein is the exclusive
  5. *** property of Intel Corporation and may not be disclosed, examined
  6. *** or reproduced in whole or in part without explicit written authorization
  7. *** from the company.
  8. **/
  9. // TITLE("Manipulate Interrupt Request Level")
  10. //++
  11. //
  12. // Module Name:
  13. //
  14. // emclk.s
  15. //
  16. // Abstract:
  17. //
  18. // This module implements the code necessary to adjust the ITM for time slicing,
  19. // to calibrate the ITC to determine the Time Base fundamental unit value (the
  20. // closest value for an update of 100ns).
  21. //
  22. //
  23. // Author:
  24. //
  25. // Edward G. Chron (echron) 29-Apr-1996
  26. //
  27. // Environment:
  28. //
  29. // Kernel mode only.
  30. //
  31. // Revision History:
  32. //
  33. // 29-Apr-1996 Initial Version for EAS2.1
  34. //
  35. //--
  36. #include "ksia64.h"
  37. .file "emclk.s"
  38. .global HalpPerformanceFrequency
  39. //++
  40. //
  41. // VOID
  42. // HalpCalibrateTB (
  43. // )
  44. //
  45. // Routine Description:
  46. //
  47. // This function calibrates the time base by determining the frequency
  48. // that the ITC is running at to determine the interval value for a
  49. // 100 ns time increment (used by clock and profile).
  50. //
  51. // Arguments:
  52. //
  53. // None.
  54. //
  55. // Return Value:
  56. //
  57. // None.
  58. //
  59. //--
  60. LEAF_ENTRY(HalpCalibrateTB)
  61. add t2 = @gprel(HalpPerformanceFrequency), gp
  62. add t1 = 1, r0
  63. ;;
  64. st8 [t2] = t1
  65. (p0) br.ret.sptk brp
  66. LEAF_EXIT(HalpCalibrateTB)
  67. //++
  68. //
  69. // VOID
  70. // HalpUpdateITM (
  71. // ULONGLONG HalpClockCount
  72. // )
  73. //
  74. // Routine Description:
  75. //
  76. // This function updates the ITM based on the current value of the
  77. // ITC combined with the arguement supplied.
  78. //
  79. // Arguments:
  80. //
  81. // HalpClockCount (a0) - Supplies the increment to be added to the current ITC value.
  82. //
  83. // Return Value:
  84. //
  85. // None.
  86. //
  87. //--
  88. LEAF_ENTRY(HalpUpdateITM)
  89. mov t1 = ar.itc // get the current clock value
  90. ;;
  91. add t1 = t1, a0 // current time plus interval
  92. ;;
  93. mov cr.itm = t1 // update the itm with the new target time
  94. (p0) br.ret.sptk brp
  95. LEAF_EXIT(HalpUpdateITM)
  96. //++
  97. //
  98. // VOID
  99. // HalpEnableInterrupts (
  100. // )
  101. //
  102. // Routine Description:
  103. //
  104. // This function enables interrupts.
  105. //
  106. // Arguments:
  107. //
  108. // None.
  109. //
  110. // Return Value:
  111. //
  112. // None.
  113. //
  114. //--
  115. LEAF_ENTRY(HalpEnableInterrupts)
  116. FAST_ENABLE_INTERRUPTS
  117. (p0) br.ret.sptk brp
  118. LEAF_EXIT(HalpEnableInterrupts)
  119. LEAF_ENTRY(HalProcessorIdle)
  120. FAST_ENABLE_INTERRUPTS
  121. nop.m 0
  122. br.ret.sptk b0
  123. LEAF_EXIT(HalProcessorIdle)