blob: 07ae6ad5f49fc4737b38455f2cfaa90315953e6c [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * 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
11#include <asm/ppc_asm.h>
12#include <asm/processor.h>
Paul Mackerras76f9f872005-10-10 22:52:26 +100013#include <asm/ptrace.h> /* XXX for STACK_FRAME_OVERHEAD */
Linus Torvalds1da177e2005-04-16 15:20:36 -070014
15 .text
16
Stephen Rothwell99a23792005-09-28 00:17:40 +100017/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070018 * Hypervisor call
Stephen Rothwell99a23792005-09-28 00:17:40 +100019 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070020 * Invoke the iSeries hypervisor via the System Call instruction
21 * Parameters are passed to this routine in registers r3 - r10
Stephen Rothwell99a23792005-09-28 00:17:40 +100022 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070023 * r3 contains the HV function to be called
24 * r4-r10 contain the operands to the hypervisor function
25 *
26 */
27
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)
37
38
39 mfcr r0
40 std r0,-8(r1)
41 stdu r1,-(STACK_FRAME_OVERHEAD+16)(r1)
Stephen Rothwell99a23792005-09-28 00:17:40 +100042
Linus Torvalds1da177e2005-04-16 15:20:36 -070043 /* r0 = 0xffffffffffffffff indicates a hypervisor call */
Stephen Rothwell99a23792005-09-28 00:17:40 +100044
Linus Torvalds1da177e2005-04-16 15:20:36 -070045 li r0,-1
Stephen Rothwell99a23792005-09-28 00:17:40 +100046
Linus Torvalds1da177e2005-04-16 15:20:36 -070047 /* Invoke the hypervisor */
48
49 sc
50
51 ld r1,0(r1)
52 ld r0,-8(r1)
53 mtcrf 0xff,r0
54
55 /* return to caller, return value in r3 */
Stephen Rothwell99a23792005-09-28 00:17:40 +100056
Linus Torvalds1da177e2005-04-16 15:20:36 -070057 blr
58
59_GLOBAL(HvCall0Ret16)
60_GLOBAL(HvCall1Ret16)
61_GLOBAL(HvCall2Ret16)
62_GLOBAL(HvCall3Ret16)
63_GLOBAL(HvCall4Ret16)
64_GLOBAL(HvCall5Ret16)
65_GLOBAL(HvCall6Ret16)
66_GLOBAL(HvCall7Ret16)
67
68 mfcr r0
69 std r0,-8(r1)
70 std r31,-16(r1)
71 stdu r1,-(STACK_FRAME_OVERHEAD+32)(r1)
72
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
81
82 sc
83
84 std r3,0(r31)
85 std r4,8(r31)
86
87 mr r3,r5
88
89 ld r1,0(r1)
90 ld r0,-8(r1)
91 mtcrf 0xff,r0
92 ld r31,-16(r1)
Stephen Rothwell99a23792005-09-28 00:17:40 +100093
Linus Torvalds1da177e2005-04-16 15:20:36 -070094 blr