hvcall.S 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * This file contains the code to perform calls to the
  3. * iSeries LPAR hypervisor
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License
  7. * as published by the Free Software Foundation; either version
  8. * 2 of the License, or (at your option) any later version.
  9. */
  10. #include <asm/ppc_asm.h>
  11. #include <asm/processor.h>
  12. #include <asm/ptrace.h> /* XXX for STACK_FRAME_OVERHEAD */
  13. .text
  14. /*
  15. * Hypervisor call
  16. *
  17. * Invoke the iSeries hypervisor via the System Call instruction
  18. * Parameters are passed to this routine in registers r3 - r10
  19. *
  20. * r3 contains the HV function to be called
  21. * r4-r10 contain the operands to the hypervisor function
  22. *
  23. */
  24. _GLOBAL(HvCall)
  25. _GLOBAL(HvCall0)
  26. _GLOBAL(HvCall1)
  27. _GLOBAL(HvCall2)
  28. _GLOBAL(HvCall3)
  29. _GLOBAL(HvCall4)
  30. _GLOBAL(HvCall5)
  31. _GLOBAL(HvCall6)
  32. _GLOBAL(HvCall7)
  33. mfcr r0
  34. std r0,-8(r1)
  35. stdu r1,-(STACK_FRAME_OVERHEAD+16)(r1)
  36. /* r0 = 0xffffffffffffffff indicates a hypervisor call */
  37. li r0,-1
  38. /* Invoke the hypervisor */
  39. sc
  40. ld r1,0(r1)
  41. ld r0,-8(r1)
  42. mtcrf 0xff,r0
  43. /* return to caller, return value in r3 */
  44. blr
  45. _GLOBAL(HvCall0Ret16)
  46. _GLOBAL(HvCall1Ret16)
  47. _GLOBAL(HvCall2Ret16)
  48. _GLOBAL(HvCall3Ret16)
  49. _GLOBAL(HvCall4Ret16)
  50. _GLOBAL(HvCall5Ret16)
  51. _GLOBAL(HvCall6Ret16)
  52. _GLOBAL(HvCall7Ret16)
  53. mfcr r0
  54. std r0,-8(r1)
  55. std r31,-16(r1)
  56. stdu r1,-(STACK_FRAME_OVERHEAD+32)(r1)
  57. mr r31,r4
  58. li r0,-1
  59. mr r4,r5
  60. mr r5,r6
  61. mr r6,r7
  62. mr r7,r8
  63. mr r8,r9
  64. mr r9,r10
  65. sc
  66. std r3,0(r31)
  67. std r4,8(r31)
  68. mr r3,r5
  69. ld r1,0(r1)
  70. ld r0,-8(r1)
  71. mtcrf 0xff,r0
  72. ld r31,-16(r1)
  73. blr