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.

145 lines
4.7 KiB

  1. // TITLE("Get Set Context Special Apc Wrapper")
  2. //++
  3. //
  4. // Copyright (c) 1993 Digital Equipment Corporation
  5. //
  6. // Module Name:
  7. //
  8. // pswrap.s
  9. //
  10. // Abstract:
  11. //
  12. // This module implements the PspGetSetContextSpecialApc function as an
  13. // assembly wrapper around the call to the real function.
  14. //
  15. // Author:
  16. //
  17. // Thomas Van Baak (tvb) 26-Jul-1993
  18. //
  19. // Environment:
  20. //
  21. // Kernel mode.
  22. //
  23. // Revision History:
  24. //
  25. //--
  26. #include "ksalpha.h"
  27. SBTTL("Set Context Special Apc Wrapper")
  28. //++
  29. //
  30. // VOID
  31. // PspGetSetContextSpecialApc (
  32. // IN PKAPC Apc,
  33. // IN PKNORMAL_ROUTINE *NormalRoutine,
  34. // IN PVOID *NormalContext,
  35. // IN PVOID *SystemArgument1,
  36. // IN PVOID *SystemArgument2
  37. // )
  38. //
  39. // Routine Description:
  40. //
  41. // This is a wrapper around the call to PspGetSetContextSpecialApcMain.
  42. // Its purpose is to save all preserved registers on the stack so the
  43. // virtual unwind loop in PspGetSetContextSpecialApc is guaranteed to find
  44. // that all preserved registers have been saved on the stack. The algorithm
  45. // used to query or modify thread context assumes all registers are stored
  46. // somewhere on the stack: either in the trap frame itself, or in register
  47. // save areas of any intervening stack frames.
  48. //
  49. // Arguments:
  50. //
  51. // Apc - Supplies a pointer to the APC control object that caused entry
  52. // into this routine.
  53. //
  54. // NormalRoutine - Supplies a pointer to the normal routine function that
  55. // was specified when the APC was initialized. This parameter is not
  56. // used.
  57. //
  58. // NormalContext - Supplies a pointer to an arbitrary data structure that
  59. // was specified when the APC was initialized. This parameter is not
  60. // used.
  61. //
  62. // SystemArgument1, SystemArgument2 - Supplies a set of two pointer to two
  63. // arguments that contain untyped data. These parameters are not used.
  64. //
  65. // Return Value:
  66. //
  67. // None.
  68. //
  69. //--
  70. .struct 0
  71. StRa: .space 8 // return address
  72. StS0: .space 8 // 7 non-volatile integer registers
  73. StS1: .space 8 //
  74. StS2: .space 8 //
  75. StS3: .space 8 //
  76. StS4: .space 8 //
  77. StS5: .space 8 //
  78. StFp: .space 8 //
  79. StF2: .space 8 // 8 non-volatile floating registers
  80. StF3: .space 8 //
  81. StF4: .space 8 //
  82. StF5: .space 8 //
  83. StF6: .space 8 //
  84. StF7: .space 8 //
  85. StF8: .space 8 //
  86. StF9: .space 8 //
  87. .space 0 * 8 // padding for 16-byte stack alignment
  88. StFrameSize: //
  89. NESTED_ENTRY(PspGetSetContextSpecialApc, StFrameSize, zero)
  90. lda sp, -StFrameSize(sp) // allocate stack frame
  91. stq ra, StRa(sp) // save return address
  92. stq s0, StS0(sp) // save non-volatile integer registers
  93. stq s1, StS1(sp) //
  94. stq s2, StS2(sp) //
  95. stq s3, StS3(sp) //
  96. stq s4, StS4(sp) //
  97. stq s5, StS5(sp) //
  98. // stq fp, StFp(sp) //
  99. stt f2, StF2(sp) // save non-volatile floating registers
  100. stt f3, StF3(sp) //
  101. stt f4, StF4(sp) //
  102. stt f5, StF5(sp) //
  103. stt f6, StF6(sp) //
  104. stt f7, StF7(sp) //
  105. stt f8, StF8(sp) //
  106. stt f9, StF9(sp) //
  107. PROLOGUE_END
  108. //
  109. // Pass the same five arguments to PspGetSetContextSpecialApcMain.
  110. //
  111. bsr ra, PspGetSetContextSpecialApcMain
  112. ldq ra, StRa(sp) // restore return address
  113. ldq s0, StS0(sp) // restore saved integer registers
  114. ldq s1, StS1(sp) //
  115. ldq s2, StS2(sp) //
  116. ldq s3, StS3(sp) //
  117. ldq s4, StS4(sp) //
  118. ldq s5, StS5(sp) //
  119. // ldq fp, StFp(sp) //
  120. ldt f2, StF2(sp) // restore saved floating registers
  121. ldt f3, StF3(sp) //
  122. ldt f4, StF4(sp) //
  123. ldt f5, StF5(sp) //
  124. ldt f6, StF6(sp) //
  125. ldt f7, StF7(sp) //
  126. ldt f8, StF8(sp) //
  127. ldt f9, StF9(sp) //
  128. lda sp, StFrameSize(sp) // deallocate stack frame
  129. ret zero, (ra) // return
  130. .end PspGetSetContextSpecialApc
  131.