Source code of Windows XP (NT5)
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.

195 lines
3.3 KiB

  1. // TITLE("Processor Control Registers")
  2. //++
  3. //
  4. // Copyright (c) 1992 Digital Equipment Corporation
  5. //
  6. // Module Name:
  7. //
  8. // pcr.s
  9. //
  10. // Abstract:
  11. //
  12. // This module implements the code necessary to access the
  13. // processor control registers (pcr) on an alpha processor.
  14. // On mips processors the pcr (which contains processor-specific data)
  15. // was mapped in the virtual address space using a fixed tb entry.
  16. // For alpha, we don't have fixed tb entries so we will get pcr data
  17. // via routine interfaces that will vary depending upon whether we are
  18. // on a multi- or uni-processor system..
  19. //
  20. // Author:
  21. //
  22. // Joe Notarangelo 15-Apr-1992
  23. //
  24. // Environment:
  25. //
  26. // Kernel mode only.
  27. //
  28. // Revision History:
  29. //
  30. //--
  31. #include "ksalpha.h"
  32. //++
  33. //
  34. // KIRQL
  35. // KeGetCurrentIrql(
  36. // VOID
  37. // )
  38. //
  39. // Routine Description:
  40. //
  41. // This function returns the current irql of the processor.
  42. //
  43. // Arguments:
  44. //
  45. // None.
  46. //
  47. // Return Value:
  48. //
  49. // Current processor irql.
  50. //
  51. //--
  52. LEAF_ENTRY(KeGetCurrentIrql)
  53. GET_CURRENT_IRQL // v0 = current irql
  54. ret zero, (ra) // return
  55. .end KeGetCurrentIrql
  56. //++
  57. //
  58. // PPRCB
  59. // KeGetCurrentPrcb
  60. // VOID
  61. // )
  62. //
  63. // Routine Description:
  64. //
  65. // This function returns the current processor control block for this
  66. // processor.
  67. //
  68. // Arguments:
  69. //
  70. // None.
  71. //
  72. // Return Value:
  73. //
  74. // Pointer to current processor's prcb.
  75. //
  76. //--
  77. LEAF_ENTRY(KeGetCurrentPrcb)
  78. GET_PROCESSOR_CONTROL_BLOCK_BASE // v0 = prcb base
  79. ret zero, (ra) // return
  80. .end KeGetCurrentPrcb
  81. //++
  82. //
  83. // PKTHREAD
  84. // KeGetCurrentThread
  85. // VOID
  86. // )
  87. //
  88. // Routine Description:
  89. //
  90. // This function return the current thread running on this processor.
  91. //
  92. // Arguments:
  93. //
  94. // None.
  95. //
  96. // Return Value:
  97. //
  98. // Pointer to current thread.
  99. //
  100. //--
  101. LEAF_ENTRY(KeGetCurrentThread)
  102. GET_CURRENT_THREAD // v0 = current thread address
  103. ret zero, (ra) // return
  104. .end KeGetCurrentThread
  105. //++
  106. //
  107. // PKPCR
  108. // KeGetPcr(
  109. // VOID
  110. // )
  111. //
  112. // Routine Description:
  113. //
  114. // This function returns the base address of the processor control
  115. // region for the current processor.
  116. //
  117. // Arguments:
  118. //
  119. // None.
  120. //
  121. // Return Value:
  122. //
  123. // Pointer to current thread executing on this processor.
  124. //
  125. //--
  126. LEAF_ENTRY(KeGetPcr)
  127. GET_PROCESSOR_CONTROL_REGION_BASE // v0 = pcr base address
  128. ret zero, (ra) // return
  129. .end KeGetPcr
  130. //++
  131. //
  132. // BOOLEAN
  133. // KeIsExecutingDpc(
  134. // VOID
  135. // )
  136. //
  137. // Routine Description:
  138. //
  139. // This function returns the DPC Active flag on the current processor.
  140. //
  141. // Arguments:
  142. //
  143. // None.
  144. //
  145. // Return Value:
  146. //
  147. // Current DPC Active flag. This flag indicates if a DPC routine is
  148. // currently running on this processor.
  149. //
  150. //--
  151. LEAF_ENTRY(KeIsExecutingDpc)
  152. #if !defined(NT_UP)
  153. DISABLE_INTERRUPTS // disable interrupts
  154. #endif
  155. GET_PROCESSOR_CONTROL_BLOCK_BASE // get current prcb address
  156. ldl v0, PbDpcRoutineActive(v0) // get DPC routine active flag
  157. #if !defined(NT_UP)
  158. ENABLE_INTERRUPTS // enable interrupts
  159. #endif
  160. ret zero, (ra) // return
  161. .end KeIsExecutingDpc
  162.