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.

170 lines
5.5 KiB

  1. //++
  2. // Copyright (c) 1996-99 Intel Corp.
  3. // All Rights Reserved
  4. //
  5. // INTEL CORPORATION PROPRIETARY INFORMATION
  6. //
  7. // This software is supplied under the terms of a license
  8. // agreement or nondisclosure agreement with Intel Corpo-
  9. // ration and may not be copied or disclosed except in
  10. // accordance with the terms of that agreement.
  11. //
  12. //
  13. //
  14. // Module Name:
  15. //
  16. // palproc.s
  17. //
  18. // Abstract:
  19. //
  20. // Contains an implementation for making PAL PROC calls on
  21. // IA-64 architecture.
  22. //
  23. //
  24. //
  25. // Revision History:
  26. //
  27. //--
  28. .file "palproc.s"
  29. #include <palproc.h>
  30. //-----------------------------------------------------------------------------
  31. //++
  32. // MakeStaticPALCall
  33. //
  34. // This routine is called whenever an architected static calling convention
  35. // based PAL call is to be made. This call does use RSE actually, but our policy
  36. // in making static PAL calls before memory is available is to make sure that
  37. // we do not nest too deep and allocate beyond 96 banked registers. In other
  38. // words we carefully code calls and control flow before memory is available.
  39. //
  40. // Arguments : All parameters set up to do static PAL call.
  41. //
  42. // On Entry :
  43. //
  44. // Return Value:
  45. //
  46. // As per static calling conventions.
  47. //
  48. //--
  49. //---------------------------------------------------------------------------
  50. PROCEDURE_ENTRY(MakeStaticPALCall)
  51. NESTED_SETUP (5,8,0,0)
  52. mov loc3 = b5
  53. mov loc4 = r2
  54. mov loc7 = r1;;
  55. movl loc6 = PAL_MC_CLEAR_LOG
  56. mov r2 = psr;;
  57. mov loc5 = r2
  58. cmp.eq p6,p7 = r28,loc6;;
  59. (p7)movl loc6 = PAL_MC_DYNAMIC_STATE;;
  60. (p7)cmp.eq p6,p7 = r28,loc6;;
  61. (p7)movl loc6 = PAL_MC_ERROR_INFO;;
  62. (p7)cmp.eq p6,p7 = r28,loc6;;
  63. (p7)movl loc6 = PAL_MC_RESUME;;
  64. (p7)cmp.eq p6,p7 = r28,loc6
  65. mov loc6 = 0x1;;
  66. (p7)dep r2 = loc6,r2,13,1;; // psr.ic = 1
  67. // p6 will be true, if it is one of the MCHK calls. There has been lots of debate
  68. // on psr.ic for these values. For now, do not do any thing to psr.ic
  69. // (p6)dep r2 = r0,r2,13,1;; // psr.ic = 0
  70. dep r2 = r0,r2,14,1;; // psr.i = 0
  71. mov psr.l = r2
  72. srlz.d;; // Needs data serailization.
  73. srlz.i;; // Needs instruction serailization.
  74. StaticGetPALLocalIP:
  75. mov loc2 = ip;;
  76. add loc2 = StaticComeBackFromPALCall - StaticGetPALLocalIP,loc2;;
  77. mov b0 = loc2 // return address after Pal call
  78. mov r28 = in1 // get the input parameters to PAL call
  79. mov r29 = in2
  80. mov r30 = in3;;
  81. mov r31 = in4
  82. mov b5 = in0;; // get the PalProcEntrypt from input
  83. br.sptk b5 // Take the plunge.
  84. StaticComeBackFromPALCall::
  85. mov psr.l = loc5;;
  86. srlz.d;; // Needs data serailization.
  87. srlz.i;; // Needs instruction serailization.
  88. mov b5 = loc3
  89. mov r2 = loc4
  90. mov r1 = loc7
  91. NESTED_RETURN
  92. PROCEDURE_EXIT(MakeStaticPALCall)
  93. //-----------------------------------------------------------------------------
  94. //++
  95. // MakeStackedPALCall
  96. //
  97. // This routine is called whenever an architected stacked calling convention
  98. // based PAL call is to be made. This call is made after memory is available.
  99. // Although stacked calls could be made directly from 'C', there is a PAL
  100. // requirement which forces the index to be in GR28 and hence this stub is
  101. // needed
  102. //
  103. // Arguments : All parameters set up to do stacted PAL call.
  104. //
  105. // On Entry :
  106. // in0: PAL_PROC entrypoint
  107. // in1-in4 : PAL_PROC arguments
  108. //
  109. // Return Value:
  110. //
  111. // As per stacked calling conventions.
  112. //
  113. //--
  114. //---------------------------------------------------------------------------
  115. PROCEDURE_ENTRY(MakeStackedPALCall)
  116. NESTED_SETUP (5,8,4,0)
  117. mov loc3 = b5
  118. mov loc4 = r2
  119. mov loc7 = r1
  120. mov r2 = psr;;
  121. mov loc5 = r2;;
  122. dep r2 = r0,r2,14,1;; // psr.i = 0
  123. mov psr.l = r2
  124. srlz.d;; // Needs data serailization.
  125. srlz.i;; // Needs instruction serailization.
  126. StackedGetPALLocalIP:
  127. mov r28 = in1 // get the input parameters to PAL call
  128. mov out0 = in1
  129. mov out1 = in2;;
  130. mov out2 = in3
  131. mov out3 = in4
  132. mov b5 = in0;; // get the PalProcEntrypt from input
  133. br.call.dpnt b0=b5;; // Take the plunge.
  134. StackedComeBackFromPALCall::
  135. mov psr.l = loc5;;
  136. srlz.d;; // Needs data serailization.
  137. srlz.i;; // Needs instruction serailization.
  138. mov b5 = loc3
  139. mov r2 = loc4
  140. mov r1 = loc7
  141. NESTED_RETURN
  142. PROCEDURE_EXIT(MakeStackedPALCall)