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.

239 lines
8.8 KiB

  1. #include "ksia64.h"
  2. //--------------------------------------------------------------------
  3. // Routine:
  4. //
  5. // VOID
  6. // KiSaveEmDebugContext(
  7. // IN OUT PCONTEXT Context)
  8. //
  9. // Description:
  10. //
  11. // This function takes the contents of the EM debug registers
  12. // and saves them in the specified EM mode Context frame.
  13. //
  14. // Input:
  15. //
  16. // a0: Context - Pointer to the EM Context frame where the debug
  17. // registers should be saved.
  18. //
  19. // Output:
  20. //
  21. // Stores the debug registers in the target EM Context frame.
  22. //
  23. // Return value:
  24. //
  25. // None
  26. //
  27. //
  28. // N.B. The format iA mode FP registers is 80 bits and will not change.
  29. //
  30. //--------------------------------------------------------------------
  31. LEAF_ENTRY(KiSaveEmDebugContext)
  32. add t1 = CxDbD0, a0 // Point at Context's DbD0
  33. add t2 = CxDbI0, a0 // Point at Context's DbI0
  34. mov t5 = dbr[r0] // Get Dbr0
  35. mov t6 = ibr[r0] // Get Ibr0
  36. ;;
  37. st8 [t1] = t5, CxDbD1 - CxDbD0 // Save Dbr
  38. st8 [t2] = t6, CxDbI1 - CxDbI0 // Save Ibr
  39. add t3 = 1, r0 // Next is Dbr1
  40. add t4 = 1, r0 // Next is Ibr1
  41. ;;
  42. mov t5 = dbr[t3] // Get Dbr1
  43. mov t6 = ibr[t4] // Get Ibr1
  44. ;;
  45. st8 [t1] = t5, CxDbD2 - CxDbD1 // Save Dbr
  46. st8 [t2] = t6, CxDbI2 - CxDbI1 // Save Ibr
  47. add t3 = 1, t3 // Next is Dbr2
  48. add t4 = 1, t4 // Next is Ibr2
  49. ;;
  50. mov t5 = dbr[t3] // Get Dbr2
  51. mov t6 = ibr[t4] // Get Ibr2
  52. ;;
  53. st8 [t1] = t5, CxDbD3 - CxDbD2 // Save Dbr
  54. st8 [t2] = t6, CxDbI3 - CxDbI2 // Save Ibr
  55. add t3 = 1, t3 // Next is Dbr3
  56. add t4 = 1, t4 // Next is Ibr3
  57. ;;
  58. mov t5 = dbr[t3] // Get Dbr3
  59. mov t6 = ibr[t4] // Get Ibr3
  60. ;;
  61. st8 [t1] = t5, CxDbD4 - CxDbD3 // Save Dbr
  62. st8 [t2] = t6, CxDbI4 - CxDbI3 // Save Ibr
  63. add t3 = 1, t3 // Next is Dbr4
  64. add t4 = 1, t4 // Next is Ibr4
  65. ;;
  66. mov t5 = dbr[t3] // Get Dbr4
  67. mov t6 = ibr[t4] // Get Ibr4
  68. ;;
  69. st8 [t1] = t5, CxDbD5 - CxDbD4 // Save Dbr
  70. st8 [t2] = t6, CxDbI5 - CxDbI4 // Save Ibr
  71. add t3 = 1, t3 // Next is Dbr5
  72. add t4 = 1, t4 // Next is Ibr5
  73. ;;
  74. mov t5 = dbr[t3] // Get Dbr5
  75. mov t6 = ibr[t4] // Get Ibr5
  76. ;;
  77. st8 [t1] = t5, CxDbD6 - CxDbD5 // Save Dbr
  78. st8 [t2] = t6, CxDbI6 - CxDbI5 // Save Ibr
  79. add t3 = 1, t3 // Next is Dbr6
  80. add t4 = 1, t4 // Next is Ibr6
  81. ;;
  82. mov t5 = dbr[t3] // Get Dbr6
  83. mov t6 = ibr[t4] // Get Ibr6
  84. ;;
  85. st8 [t1] = t5, CxDbD7 - CxDbD6 // Save Dbr
  86. st8 [t2] = t6, CxDbI7 - CxDbI6 // Save Ibr
  87. add t3 = 1, t3 // Next is Dbr7
  88. add t4 = 1, t4 // Next is Ibr7
  89. ;;
  90. mov t5 = dbr[t3] // Get Dbr7
  91. mov t6 = ibr[t4] // Get Ibr7
  92. ;;
  93. st8 [t1] = t5, CxFltS0 - CxDbD7 // Save Dbr
  94. st8 [t2] = t6, CxDbD0 - CxDbI7 // Save Ibr
  95. br.ret.sptk brp
  96. ;;
  97. LEAF_EXIT(KiSaveEmDebugContext)
  98. //--------------------------------------------------------------------
  99. // Routine:
  100. //
  101. // VOID
  102. // KiLoadEmDebugContext(
  103. // IN PCONTEXT Context)
  104. //
  105. // Description:
  106. //
  107. // This function takes the values stored for the EM debug registers
  108. // in the specified EM mode Context frame and loads the debug registers
  109. // for the thread with them.
  110. //
  111. // Input:
  112. //
  113. // a0: Context - Pointer to the EM Context frame where the debug
  114. // register contents are to be loaded from.
  115. //
  116. // Output:
  117. //
  118. // None
  119. //
  120. // Return value:
  121. //
  122. // None
  123. //
  124. // N.B. The format iA mode FP registers is 80 bits and will not change.
  125. //
  126. //--------------------------------------------------------------------
  127. LEAF_ENTRY(KiLoadEmDebugContext)
  128. add t1 = CxDbD0, a0 // Point at Context's DbD0
  129. add t2 = CxDbI0, a0 // Point at Context's DbI0
  130. ;;
  131. ld8 t5 = [t1], CxDbD1 - CxDbD0 // Load Value for Dbr0
  132. ld8 t6 = [t2], CxDbI1 - CxDbI0 // Load Value for Ibr0
  133. ;;
  134. mov dbr[r0] = t5 // Load Dbr0
  135. mov ibr[r0] = t6 // Load Ibr0
  136. add t3 = 1, r0 // Start with Dbr1
  137. add t4 = 1, r0 // Start with Ibr1
  138. ld8 t5 = [t1], CxDbD2 - CxDbD1 // Load Value for Dbr1
  139. ld8 t6 = [t2], CxDbI2 - CxDbI1 // Load Value for Ibr1
  140. ;;
  141. mov dbr[t3] = t5 // Load Dbr1
  142. mov ibr[t4] = t6 // Load Ibr1
  143. add t3 = 2, r0 // Start with Dbr2
  144. add t4 = 2, r0 // Start with Ibr2
  145. ld8 t5 = [t1], CxDbD3 - CxDbD2 // Load Value for Dbr2
  146. ld8 t6 = [t2], CxDbI3 - CxDbI2 // Load Value for Ibr2
  147. ;;
  148. mov dbr[t3] = t5 // Load Dbr2
  149. mov ibr[t4] = t6 // Load Ibr2
  150. add t3 = 3, r0 // Start with Dbr3
  151. add t4 = 3, r0 // Start with Ibr3
  152. ld8 t5 = [t1], CxDbD4 - CxDbD3 // Load Value for Dbr3
  153. ld8 t6 = [t2], CxDbI4 - CxDbI3 // Load Value for Ibr3
  154. ;;
  155. mov dbr[t3] = t5 // Load Dbr3
  156. mov ibr[t4] = t6 // Load Ibr3
  157. add t3 = 4, r0 // Start with Dbr4
  158. add t4 = 4, r0 // Start with Ibr4
  159. ld8 t5 = [t1], CxDbD5 - CxDbD4 // Load Value for Dbr4
  160. ld8 t6 = [t2], CxDbI5 - CxDbI4 // Load Value for Ibr4
  161. ;;
  162. mov dbr[t3] = t5 // Load Dbr4
  163. mov ibr[t4] = t6 // Load Ibr4
  164. add t3 = 5, r0 // Start with Dbr5
  165. add t4 = 5, r0 // Start with Ibr5
  166. ld8 t5 = [t1], CxDbD6 - CxDbD5 // Load Value for Dbr5
  167. ld8 t6 = [t2], CxDbI6 - CxDbI5 // Load Value for Ibr5
  168. ;;
  169. mov dbr[t3] = t5 // Load Dbr5
  170. mov ibr[t4] = t6 // Load Ibr5
  171. add t3 = 6, r0 // Start with Dbr6
  172. add t4 = 6, r0 // Start with Ibr6
  173. ld8 t5 = [t1], CxDbD7 - CxDbD6 // Load Value for Dbr6
  174. ld8 t6 = [t2], CxDbI7 - CxDbI6 // Load Value for Ibr6
  175. ;;
  176. mov dbr[t3] = t5 // Load Dbr6
  177. mov ibr[t4] = t6 // Load Ibr6
  178. add t3 = 7, r0 // Start with Dbr7
  179. add t4 = 7, r0 // Start with Ibr7
  180. ld8 t5 = [t1], CxFltS0- CxDbD7 // Load Value for Dbr7
  181. ld8 t6 = [t2], CxDbD0 - CxDbI7 // Load Value for Ibr7
  182. ;;
  183. mov dbr[t3] = t5 // Load Dbr7
  184. mov ibr[t4] = t6 // Load Ibr7
  185. br.ret.sptk brp
  186. LEAF_EXIT(KiLoadEmDebugContext)