palproc.S 5.1 KB

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