Committer: Michael Beasley <mike@snafu.setup>
[mikesnafu-overlay.git] / arch / powerpc / platforms / iseries / hvcall.S
blob07ae6ad5f49fc4737b38455f2cfaa90315953e6c
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  */
11 #include <asm/ppc_asm.h>
12 #include <asm/processor.h>
13 #include <asm/ptrace.h>         /* XXX for STACK_FRAME_OVERHEAD */
15         .text
18  * Hypervisor call
19  *
20  * Invoke the iSeries hypervisor via the System Call instruction
21  * Parameters are passed to this routine in registers r3 - r10
22  *
23  * r3 contains the HV function to be called
24  * r4-r10 contain the operands to the hypervisor function
25  *
26  */
28 _GLOBAL(HvCall)
29 _GLOBAL(HvCall0)
30 _GLOBAL(HvCall1)
31 _GLOBAL(HvCall2)
32 _GLOBAL(HvCall3)
33 _GLOBAL(HvCall4)
34 _GLOBAL(HvCall5)
35 _GLOBAL(HvCall6)
36 _GLOBAL(HvCall7)
39         mfcr    r0
40         std     r0,-8(r1)
41         stdu    r1,-(STACK_FRAME_OVERHEAD+16)(r1)
43         /* r0 = 0xffffffffffffffff indicates a hypervisor call */
45         li      r0,-1
47         /* Invoke the hypervisor */
49         sc
51         ld      r1,0(r1)
52         ld      r0,-8(r1)
53         mtcrf   0xff,r0
55         /*  return to caller, return value in r3 */
57         blr
59 _GLOBAL(HvCall0Ret16)
60 _GLOBAL(HvCall1Ret16)
61 _GLOBAL(HvCall2Ret16)
62 _GLOBAL(HvCall3Ret16)
63 _GLOBAL(HvCall4Ret16)
64 _GLOBAL(HvCall5Ret16)
65 _GLOBAL(HvCall6Ret16)
66 _GLOBAL(HvCall7Ret16)
68         mfcr    r0
69         std     r0,-8(r1)
70         std     r31,-16(r1)
71         stdu    r1,-(STACK_FRAME_OVERHEAD+32)(r1)
73         mr      r31,r4
74         li      r0,-1
75         mr      r4,r5
76         mr      r5,r6
77         mr      r6,r7
78         mr      r7,r8
79         mr      r8,r9
80         mr      r9,r10
82         sc
84         std     r3,0(r31)
85         std     r4,8(r31)
87         mr      r3,r5
89         ld      r1,0(r1)
90         ld      r0,-8(r1)
91         mtcrf   0xff,r0
92         ld      r31,-16(r1)
94         blr