beat_hvCall.S 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  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. #define STK_PARM(i) (48 + ((i)-3)*8)
  24. /* Not implemented on Beat, now */
  25. #define HCALL_INST_PRECALL
  26. #define HCALL_INST_POSTCALL
  27. .text
  28. #define HVSC .long 0x44000022
  29. /* Note: takes only 7 input parameters at maximum */
  30. _GLOBAL(beat_hcall_norets)
  31. HMT_MEDIUM
  32. mfcr r0
  33. stw r0,8(r1)
  34. HCALL_INST_PRECALL
  35. mr r11,r3
  36. mr r3,r4
  37. mr r4,r5
  38. mr r5,r6
  39. mr r6,r7
  40. mr r7,r8
  41. mr r8,r9
  42. HVSC /* invoke the hypervisor */
  43. HCALL_INST_POSTCALL
  44. lwz r0,8(r1)
  45. mtcrf 0xff,r0
  46. blr /* return r3 = status */
  47. /* Note: takes 8 input parameters at maximum */
  48. _GLOBAL(beat_hcall_norets8)
  49. HMT_MEDIUM
  50. mfcr r0
  51. stw r0,8(r1)
  52. HCALL_INST_PRECALL
  53. mr r11,r3
  54. mr r3,r4
  55. mr r4,r5
  56. mr r5,r6
  57. mr r6,r7
  58. mr r7,r8
  59. mr r8,r9
  60. ld r10,STK_PARM(r10)(r1)
  61. HVSC /* invoke the hypervisor */
  62. HCALL_INST_POSTCALL
  63. lwz r0,8(r1)
  64. mtcrf 0xff,r0
  65. blr /* return r3 = status */
  66. /* Note: takes only 6 input parameters, 1 output parameters at maximum */
  67. _GLOBAL(beat_hcall1)
  68. HMT_MEDIUM
  69. mfcr r0
  70. stw r0,8(r1)
  71. HCALL_INST_PRECALL
  72. std r4,STK_PARM(r4)(r1) /* save ret buffer */
  73. mr r11,r3
  74. mr r3,r5
  75. mr r4,r6
  76. mr r5,r7
  77. mr r6,r8
  78. mr r7,r9
  79. mr r8,r10
  80. HVSC /* invoke the hypervisor */
  81. HCALL_INST_POSTCALL
  82. ld r12,STK_PARM(r4)(r1)
  83. std r4, 0(r12)
  84. lwz r0,8(r1)
  85. mtcrf 0xff,r0
  86. blr /* return r3 = status */
  87. /* Note: takes only 6 input parameters, 2 output parameters at maximum */
  88. _GLOBAL(beat_hcall2)
  89. HMT_MEDIUM
  90. mfcr r0
  91. stw r0,8(r1)
  92. HCALL_INST_PRECALL
  93. std r4,STK_PARM(r4)(r1) /* save ret buffer */
  94. mr r11,r3
  95. mr r3,r5
  96. mr r4,r6
  97. mr r5,r7
  98. mr r6,r8
  99. mr r7,r9
  100. mr r8,r10
  101. HVSC /* invoke the hypervisor */
  102. HCALL_INST_POSTCALL
  103. ld r12,STK_PARM(r4)(r1)
  104. std r4, 0(r12)
  105. std r5, 8(r12)
  106. lwz r0,8(r1)
  107. mtcrf 0xff,r0
  108. blr /* return r3 = status */
  109. /* Note: takes only 6 input parameters, 3 output parameters at maximum */
  110. _GLOBAL(beat_hcall3)
  111. HMT_MEDIUM
  112. mfcr r0
  113. stw r0,8(r1)
  114. HCALL_INST_PRECALL
  115. std r4,STK_PARM(r4)(r1) /* save ret buffer */
  116. mr r11,r3
  117. mr r3,r5
  118. mr r4,r6
  119. mr r5,r7
  120. mr r6,r8
  121. mr r7,r9
  122. mr r8,r10
  123. HVSC /* invoke the hypervisor */
  124. HCALL_INST_POSTCALL
  125. ld r12,STK_PARM(r4)(r1)
  126. std r4, 0(r12)
  127. std r5, 8(r12)
  128. std r6, 16(r12)
  129. lwz r0,8(r1)
  130. mtcrf 0xff,r0
  131. blr /* return r3 = status */
  132. /* Note: takes only 6 input parameters, 4 output parameters at maximum */
  133. _GLOBAL(beat_hcall4)
  134. HMT_MEDIUM
  135. mfcr r0
  136. stw r0,8(r1)
  137. HCALL_INST_PRECALL
  138. std r4,STK_PARM(r4)(r1) /* save ret buffer */
  139. mr r11,r3
  140. mr r3,r5
  141. mr r4,r6
  142. mr r5,r7
  143. mr r6,r8
  144. mr r7,r9
  145. mr r8,r10
  146. HVSC /* invoke the hypervisor */
  147. HCALL_INST_POSTCALL
  148. ld r12,STK_PARM(r4)(r1)
  149. std r4, 0(r12)
  150. std r5, 8(r12)
  151. std r6, 16(r12)
  152. std r7, 24(r12)
  153. lwz r0,8(r1)
  154. mtcrf 0xff,r0
  155. blr /* return r3 = status */
  156. /* Note: takes only 6 input parameters, 5 output parameters at maximum */
  157. _GLOBAL(beat_hcall5)
  158. HMT_MEDIUM
  159. mfcr r0
  160. stw r0,8(r1)
  161. HCALL_INST_PRECALL
  162. std r4,STK_PARM(r4)(r1) /* save ret buffer */
  163. mr r11,r3
  164. mr r3,r5
  165. mr r4,r6
  166. mr r5,r7
  167. mr r6,r8
  168. mr r7,r9
  169. mr r8,r10
  170. HVSC /* invoke the hypervisor */
  171. HCALL_INST_POSTCALL
  172. ld r12,STK_PARM(r4)(r1)
  173. std r4, 0(r12)
  174. std r5, 8(r12)
  175. std r6, 16(r12)
  176. std r7, 24(r12)
  177. std r8, 32(r12)
  178. lwz r0,8(r1)
  179. mtcrf 0xff,r0
  180. blr /* return r3 = status */
  181. /* Note: takes only 6 input parameters, 6 output parameters at maximum */
  182. _GLOBAL(beat_hcall6)
  183. HMT_MEDIUM
  184. mfcr r0
  185. stw r0,8(r1)
  186. HCALL_INST_PRECALL
  187. std r4,STK_PARM(r4)(r1) /* save ret buffer */
  188. mr r11,r3
  189. mr r3,r5
  190. mr r4,r6
  191. mr r5,r7
  192. mr r6,r8
  193. mr r7,r9
  194. mr r8,r10
  195. HVSC /* invoke the hypervisor */
  196. HCALL_INST_POSTCALL
  197. ld r12,STK_PARM(r4)(r1)
  198. std r4, 0(r12)
  199. std r5, 8(r12)
  200. std r6, 16(r12)
  201. std r7, 24(r12)
  202. std r8, 32(r12)
  203. std r9, 40(r12)
  204. lwz r0,8(r1)
  205. mtcrf 0xff,r0
  206. blr /* return r3 = status */