beat_hvCall.S 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. /*
  2. * Beat hypervisor call I/F
  3. *
  4. * (C) Copyright 2007 TOSHIBA CORPORATION
  5. *
  6. * This code is based on arch/powerpc/platforms/pseries/hvCall.S.
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License along
  19. * with this program; if not, write to the Free Software Foundation, Inc.,
  20. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  21. */
  22. #include <asm/ppc_asm.h>
  23. /* Not implemented on Beat, now */
  24. #define HCALL_INST_PRECALL
  25. #define HCALL_INST_POSTCALL
  26. .text
  27. #define HVSC .long 0x44000022
  28. /* Note: takes only 7 input parameters at maximum */
  29. _GLOBAL(beat_hcall_norets)
  30. HMT_MEDIUM
  31. mfcr r0
  32. stw r0,8(r1)
  33. HCALL_INST_PRECALL
  34. mr r11,r3
  35. mr r3,r4
  36. mr r4,r5
  37. mr r5,r6
  38. mr r6,r7
  39. mr r7,r8
  40. mr r8,r9
  41. HVSC /* invoke the hypervisor */
  42. HCALL_INST_POSTCALL
  43. lwz r0,8(r1)
  44. mtcrf 0xff,r0
  45. blr /* return r3 = status */
  46. /* Note: takes 8 input parameters at maximum */
  47. _GLOBAL(beat_hcall_norets8)
  48. HMT_MEDIUM
  49. mfcr r0
  50. stw r0,8(r1)
  51. HCALL_INST_PRECALL
  52. mr r11,r3
  53. mr r3,r4
  54. mr r4,r5
  55. mr r5,r6
  56. mr r6,r7
  57. mr r7,r8
  58. mr r8,r9
  59. ld r10,STK_PARAM(R10)(r1)
  60. HVSC /* invoke the hypervisor */
  61. HCALL_INST_POSTCALL
  62. lwz r0,8(r1)
  63. mtcrf 0xff,r0
  64. blr /* return r3 = status */
  65. /* Note: takes only 6 input parameters, 1 output parameters at maximum */
  66. _GLOBAL(beat_hcall1)
  67. HMT_MEDIUM
  68. mfcr r0
  69. stw r0,8(r1)
  70. HCALL_INST_PRECALL
  71. std r4,STK_PARAM(R4)(r1) /* save ret buffer */
  72. mr r11,r3
  73. mr r3,r5
  74. mr r4,r6
  75. mr r5,r7
  76. mr r6,r8
  77. mr r7,r9
  78. mr r8,r10
  79. HVSC /* invoke the hypervisor */
  80. HCALL_INST_POSTCALL
  81. ld r12,STK_PARAM(R4)(r1)
  82. std r4, 0(r12)
  83. lwz r0,8(r1)
  84. mtcrf 0xff,r0
  85. blr /* return r3 = status */
  86. /* Note: takes only 6 input parameters, 2 output parameters at maximum */
  87. _GLOBAL(beat_hcall2)
  88. HMT_MEDIUM
  89. mfcr r0
  90. stw r0,8(r1)
  91. HCALL_INST_PRECALL
  92. std r4,STK_PARAM(R4)(r1) /* save ret buffer */
  93. mr r11,r3
  94. mr r3,r5
  95. mr r4,r6
  96. mr r5,r7
  97. mr r6,r8
  98. mr r7,r9
  99. mr r8,r10
  100. HVSC /* invoke the hypervisor */
  101. HCALL_INST_POSTCALL
  102. ld r12,STK_PARAM(R4)(r1)
  103. std r4, 0(r12)
  104. std r5, 8(r12)
  105. lwz r0,8(r1)
  106. mtcrf 0xff,r0
  107. blr /* return r3 = status */
  108. /* Note: takes only 6 input parameters, 3 output parameters at maximum */
  109. _GLOBAL(beat_hcall3)
  110. HMT_MEDIUM
  111. mfcr r0
  112. stw r0,8(r1)
  113. HCALL_INST_PRECALL
  114. std r4,STK_PARAM(R4)(r1) /* save ret buffer */
  115. mr r11,r3
  116. mr r3,r5
  117. mr r4,r6
  118. mr r5,r7
  119. mr r6,r8
  120. mr r7,r9
  121. mr r8,r10
  122. HVSC /* invoke the hypervisor */
  123. HCALL_INST_POSTCALL
  124. ld r12,STK_PARAM(R4)(r1)
  125. std r4, 0(r12)
  126. std r5, 8(r12)
  127. std r6, 16(r12)
  128. lwz r0,8(r1)
  129. mtcrf 0xff,r0
  130. blr /* return r3 = status */
  131. /* Note: takes only 6 input parameters, 4 output parameters at maximum */
  132. _GLOBAL(beat_hcall4)
  133. HMT_MEDIUM
  134. mfcr r0
  135. stw r0,8(r1)
  136. HCALL_INST_PRECALL
  137. std r4,STK_PARAM(R4)(r1) /* save ret buffer */
  138. mr r11,r3
  139. mr r3,r5
  140. mr r4,r6
  141. mr r5,r7
  142. mr r6,r8
  143. mr r7,r9
  144. mr r8,r10
  145. HVSC /* invoke the hypervisor */
  146. HCALL_INST_POSTCALL
  147. ld r12,STK_PARAM(R4)(r1)
  148. std r4, 0(r12)
  149. std r5, 8(r12)
  150. std r6, 16(r12)
  151. std r7, 24(r12)
  152. lwz r0,8(r1)
  153. mtcrf 0xff,r0
  154. blr /* return r3 = status */
  155. /* Note: takes only 6 input parameters, 5 output parameters at maximum */
  156. _GLOBAL(beat_hcall5)
  157. HMT_MEDIUM
  158. mfcr r0
  159. stw r0,8(r1)
  160. HCALL_INST_PRECALL
  161. std r4,STK_PARAM(R4)(r1) /* save ret buffer */
  162. mr r11,r3
  163. mr r3,r5
  164. mr r4,r6
  165. mr r5,r7
  166. mr r6,r8
  167. mr r7,r9
  168. mr r8,r10
  169. HVSC /* invoke the hypervisor */
  170. HCALL_INST_POSTCALL
  171. ld r12,STK_PARAM(R4)(r1)
  172. std r4, 0(r12)
  173. std r5, 8(r12)
  174. std r6, 16(r12)
  175. std r7, 24(r12)
  176. std r8, 32(r12)
  177. lwz r0,8(r1)
  178. mtcrf 0xff,r0
  179. blr /* return r3 = status */
  180. /* Note: takes only 6 input parameters, 6 output parameters at maximum */
  181. _GLOBAL(beat_hcall6)
  182. HMT_MEDIUM
  183. mfcr r0
  184. stw r0,8(r1)
  185. HCALL_INST_PRECALL
  186. std r4,STK_PARAM(R4)(r1) /* save ret buffer */
  187. mr r11,r3
  188. mr r3,r5
  189. mr r4,r6
  190. mr r5,r7
  191. mr r6,r8
  192. mr r7,r9
  193. mr r8,r10
  194. HVSC /* invoke the hypervisor */
  195. HCALL_INST_POSTCALL
  196. ld r12,STK_PARAM(R4)(r1)
  197. std r4, 0(r12)
  198. std r5, 8(r12)
  199. std r6, 16(r12)
  200. std r7, 24(r12)
  201. std r8, 32(r12)
  202. std r9, 40(r12)
  203. lwz r0,8(r1)
  204. mtcrf 0xff,r0
  205. blr /* return r3 = status */