xref: /openbmc/linux/arch/powerpc/platforms/pseries/hvCall.S (revision f8bf101b3b1171923a011a47923a93f4b22e6cb0)
12874c5fdSThomas Gleixner/* SPDX-License-Identifier: GPL-2.0-or-later */
269a80d3fSPaul Mackerras/*
369a80d3fSPaul Mackerras * This file contains the generic code to perform a call to the
469a80d3fSPaul Mackerras * pSeries LPAR hypervisor.
569a80d3fSPaul Mackerras */
658995a9aSAnton Blanchard#include <linux/jump_label.h>
769a80d3fSPaul Mackerras#include <asm/hvcall.h>
869a80d3fSPaul Mackerras#include <asm/processor.h>
969a80d3fSPaul Mackerras#include <asm/ppc_asm.h>
1057852a85SMike Kravetz#include <asm/asm-offsets.h>
1146f52210SStephen Rothwell#include <asm/ptrace.h>
122c86cd18SChristophe Leroy#include <asm/feature-fixups.h>
13cc1adb5fSAnton Blanchard
14cc1adb5fSAnton Blanchard	.section	".text"
1569a80d3fSPaul Mackerras
16c8cd093aSAnton Blanchard#ifdef CONFIG_TRACEPOINTS
17c8cd093aSAnton Blanchard
18e9666d10SMasahiro Yamada#ifndef CONFIG_JUMP_LABEL
199a10ccb2SNicholas Piggin	.data
20c8cd093aSAnton Blanchard
21c8cd093aSAnton Blanchard	.globl hcall_tracepoint_refcount
22c8cd093aSAnton Blanchardhcall_tracepoint_refcount:
23eb039161STobin C. Harding	.8byte	0
24c8cd093aSAnton Blanchard
25c8cd093aSAnton Blanchard	.section	".text"
26cc1adb5fSAnton Blanchard#endif
27c8cd093aSAnton Blanchard
2857852a85SMike Kravetz/*
2944ce6a5eSMichael Neuling * precall must preserve all registers.  use unused STK_PARAM()
30baa49d81SNicholas Piggin * areas to save snapshots and opcode. STK_PARAM() in the caller's
31baa49d81SNicholas Piggin * frame will be available even on ELFv2 because these are all
32baa49d81SNicholas Piggin * variadic functions.
3357852a85SMike Kravetz */
346f26353cSAnton Blanchard#define HCALL_INST_PRECALL(FIRST_REG)				\
35c8cd093aSAnton Blanchard	mflr	r0;						\
3644ce6a5eSMichael Neuling	std	r3,STK_PARAM(R3)(r1);				\
3744ce6a5eSMichael Neuling	std	r4,STK_PARAM(R4)(r1);				\
3844ce6a5eSMichael Neuling	std	r5,STK_PARAM(R5)(r1);				\
3944ce6a5eSMichael Neuling	std	r6,STK_PARAM(R6)(r1);				\
4044ce6a5eSMichael Neuling	std	r7,STK_PARAM(R7)(r1);				\
4144ce6a5eSMichael Neuling	std	r8,STK_PARAM(R8)(r1);				\
4244ce6a5eSMichael Neuling	std	r9,STK_PARAM(R9)(r1);				\
4344ce6a5eSMichael Neuling	std	r10,STK_PARAM(R10)(r1);				\
44c8cd093aSAnton Blanchard	std	r0,16(r1);					\
4544ce6a5eSMichael Neuling	addi	r4,r1,STK_PARAM(FIRST_REG);			\
46baa49d81SNicholas Piggin	stdu	r1,-STACK_FRAME_MIN_SIZE(r1);			\
474e991e3cSNicholas Piggin	bl	CFUNC(__trace_hcall_entry);			\
48baa49d81SNicholas Piggin	ld	r3,STACK_FRAME_MIN_SIZE+STK_PARAM(R3)(r1);	\
49baa49d81SNicholas Piggin	ld	r4,STACK_FRAME_MIN_SIZE+STK_PARAM(R4)(r1);	\
50baa49d81SNicholas Piggin	ld	r5,STACK_FRAME_MIN_SIZE+STK_PARAM(R5)(r1);	\
51baa49d81SNicholas Piggin	ld	r6,STACK_FRAME_MIN_SIZE+STK_PARAM(R6)(r1);	\
52baa49d81SNicholas Piggin	ld	r7,STACK_FRAME_MIN_SIZE+STK_PARAM(R7)(r1);	\
53baa49d81SNicholas Piggin	ld	r8,STACK_FRAME_MIN_SIZE+STK_PARAM(R8)(r1);	\
54baa49d81SNicholas Piggin	ld	r9,STACK_FRAME_MIN_SIZE+STK_PARAM(R9)(r1);	\
55baa49d81SNicholas Piggin	ld	r10,STACK_FRAME_MIN_SIZE+STK_PARAM(R10)(r1)
5657852a85SMike Kravetz
5757852a85SMike Kravetz/*
5857852a85SMike Kravetz * postcall is performed immediately before function return which
59cc1adb5fSAnton Blanchard * allows liberal use of volatile registers.
6057852a85SMike Kravetz */
616f26353cSAnton Blanchard#define __HCALL_INST_POSTCALL					\
62baa49d81SNicholas Piggin	ld	r0,STACK_FRAME_MIN_SIZE+STK_PARAM(R3)(r1);	\
63baa49d81SNicholas Piggin	std	r3,STACK_FRAME_MIN_SIZE+STK_PARAM(R3)(r1);	\
64c8cd093aSAnton Blanchard	mr	r4,r3;						\
65aaad4224SAnton Blanchard	mr	r3,r0;						\
664e991e3cSNicholas Piggin	bl	CFUNC(__trace_hcall_exit);			\
67baa49d81SNicholas Piggin	ld	r0,STACK_FRAME_MIN_SIZE+16(r1);			\
68baa49d81SNicholas Piggin	addi	r1,r1,STACK_FRAME_MIN_SIZE;			\
6944ce6a5eSMichael Neuling	ld	r3,STK_PARAM(R3)(r1);				\
70cc1adb5fSAnton Blanchard	mtlr	r0
716f26353cSAnton Blanchard
726f26353cSAnton Blanchard#define HCALL_INST_POSTCALL_NORETS				\
736f26353cSAnton Blanchard	li	r5,0;						\
746f26353cSAnton Blanchard	__HCALL_INST_POSTCALL
756f26353cSAnton Blanchard
766f26353cSAnton Blanchard#define HCALL_INST_POSTCALL(BUFREG)				\
776f26353cSAnton Blanchard	mr	r5,BUFREG;					\
786f26353cSAnton Blanchard	__HCALL_INST_POSTCALL
796f26353cSAnton Blanchard
80e9666d10SMasahiro Yamada#ifdef CONFIG_JUMP_LABEL
81cc1adb5fSAnton Blanchard#define HCALL_BRANCH(LABEL)					\
82cc1adb5fSAnton Blanchard	ARCH_STATIC_BRANCH(LABEL, hcall_tracepoint_key)
83cc1adb5fSAnton Blanchard#else
84cc1adb5fSAnton Blanchard
85cc1adb5fSAnton Blanchard/*
86cc1adb5fSAnton Blanchard * We branch around this in early init (eg when populating the MMU
87cc1adb5fSAnton Blanchard * hashtable) by using an unconditional cpu feature.
88cc1adb5fSAnton Blanchard */
89cc1adb5fSAnton Blanchard#define HCALL_BRANCH(LABEL)					\
90cc1adb5fSAnton BlanchardBEGIN_FTR_SECTION;						\
91cc1adb5fSAnton Blanchard	b	1f;						\
92cc1adb5fSAnton BlanchardEND_FTR_SECTION(0, 1);						\
939a10ccb2SNicholas Piggin	LOAD_REG_ADDR(r12, hcall_tracepoint_refcount) ;		\
94750bd41aSNicholas Piggin	ld	r12,0(r12);					\
95cc1adb5fSAnton Blanchard	cmpdi	r12,0;						\
96cc1adb5fSAnton Blanchard	bne-	LABEL;						\
97cc1adb5fSAnton Blanchard1:
98cc1adb5fSAnton Blanchard#endif
99cc1adb5fSAnton Blanchard
10057852a85SMike Kravetz#else
1016f26353cSAnton Blanchard#define HCALL_INST_PRECALL(FIRST_ARG)
1026f26353cSAnton Blanchard#define HCALL_INST_POSTCALL_NORETS
1036f26353cSAnton Blanchard#define HCALL_INST_POSTCALL(BUFREG)
104cc1adb5fSAnton Blanchard#define HCALL_BRANCH(LABEL)
10557852a85SMike Kravetz#endif
10657852a85SMike Kravetz
1072c8c89b9SNicholas Piggin_GLOBAL_TOC(plpar_hcall_norets_notrace)
1082c8c89b9SNicholas Piggin	HMT_MEDIUM
1092c8c89b9SNicholas Piggin
1102c8c89b9SNicholas Piggin	mfcr	r0
1112c8c89b9SNicholas Piggin	stw	r0,8(r1)
1122c8c89b9SNicholas Piggin	HVSC				/* invoke the hypervisor */
11359dc5bfcSNicholas Piggin
11459dc5bfcSNicholas Piggin	li	r4,0
11559dc5bfcSNicholas Piggin	stb	r4,PACASRR_VALID(r13)
11659dc5bfcSNicholas Piggin
1172c8c89b9SNicholas Piggin	lwz	r0,8(r1)
1182c8c89b9SNicholas Piggin	mtcrf	0xff,r0
1192c8c89b9SNicholas Piggin	blr				/* return r3 = status */
1202c8c89b9SNicholas Piggin
121c1931e21SAnton Blanchard_GLOBAL_TOC(plpar_hcall_norets)
12269a80d3fSPaul Mackerras	HMT_MEDIUM
12369a80d3fSPaul Mackerras
12469a80d3fSPaul Mackerras	mfcr	r0
12569a80d3fSPaul Mackerras	stw	r0,8(r1)
126cc1adb5fSAnton Blanchard	HCALL_BRANCH(plpar_hcall_norets_trace)
12769a80d3fSPaul Mackerras	HVSC				/* invoke the hypervisor */
12869a80d3fSPaul Mackerras
12959dc5bfcSNicholas Piggin	li	r4,0
13059dc5bfcSNicholas Piggin	stb	r4,PACASRR_VALID(r13)
13159dc5bfcSNicholas Piggin
13269a80d3fSPaul Mackerras	lwz	r0,8(r1)
13369a80d3fSPaul Mackerras	mtcrf	0xff,r0
13469a80d3fSPaul Mackerras	blr				/* return r3 = status */
13569a80d3fSPaul Mackerras
136cc1adb5fSAnton Blanchard#ifdef CONFIG_TRACEPOINTS
137cc1adb5fSAnton Blanchardplpar_hcall_norets_trace:
138cc1adb5fSAnton Blanchard	HCALL_INST_PRECALL(R4)
139cc1adb5fSAnton Blanchard	HVSC
140cc1adb5fSAnton Blanchard	HCALL_INST_POSTCALL_NORETS
14159dc5bfcSNicholas Piggin
14259dc5bfcSNicholas Piggin	li	r4,0
14359dc5bfcSNicholas Piggin	stb	r4,PACASRR_VALID(r13)
14459dc5bfcSNicholas Piggin
145cc1adb5fSAnton Blanchard	lwz	r0,8(r1)
146cc1adb5fSAnton Blanchard	mtcrf	0xff,r0
147cc1adb5fSAnton Blanchard	blr
148cc1adb5fSAnton Blanchard#endif
149cc1adb5fSAnton Blanchard
150c1931e21SAnton Blanchard_GLOBAL_TOC(plpar_hcall)
15169a80d3fSPaul Mackerras	HMT_MEDIUM
15269a80d3fSPaul Mackerras
15369a80d3fSPaul Mackerras	mfcr	r0
15469a80d3fSPaul Mackerras	stw	r0,8(r1)
15569a80d3fSPaul Mackerras
156cc1adb5fSAnton Blanchard	HCALL_BRANCH(plpar_hcall_trace)
15757852a85SMike Kravetz
15844ce6a5eSMichael Neuling	std     r4,STK_PARAM(R4)(r1)     /* Save ret buffer */
159b9377ffcSAnton Blanchard
160b9377ffcSAnton Blanchard	mr	r4,r5
161b9377ffcSAnton Blanchard	mr	r5,r6
162b9377ffcSAnton Blanchard	mr	r6,r7
163b9377ffcSAnton Blanchard	mr	r7,r8
164b9377ffcSAnton Blanchard	mr	r8,r9
165b9377ffcSAnton Blanchard	mr	r9,r10
16669a80d3fSPaul Mackerras
16769a80d3fSPaul Mackerras	HVSC				/* invoke the hypervisor */
16869a80d3fSPaul Mackerras
16944ce6a5eSMichael Neuling	ld	r12,STK_PARAM(R4)(r1)
170b9377ffcSAnton Blanchard	std	r4,  0(r12)
171b9377ffcSAnton Blanchard	std	r5,  8(r12)
172b9377ffcSAnton Blanchard	std	r6, 16(r12)
173b9377ffcSAnton Blanchard	std	r7, 24(r12)
174b13a96cfSHeiko J Schick
17559dc5bfcSNicholas Piggin	li	r4,0
17659dc5bfcSNicholas Piggin	stb	r4,PACASRR_VALID(r13)
17759dc5bfcSNicholas Piggin
178cc1adb5fSAnton Blanchard	lwz	r0,8(r1)
179cc1adb5fSAnton Blanchard	mtcrf	0xff,r0
180cc1adb5fSAnton Blanchard
181cc1adb5fSAnton Blanchard	blr				/* return r3 = status */
182cc1adb5fSAnton Blanchard
183cc1adb5fSAnton Blanchard#ifdef CONFIG_TRACEPOINTS
184cc1adb5fSAnton Blanchardplpar_hcall_trace:
185cc1adb5fSAnton Blanchard	HCALL_INST_PRECALL(R5)
186cc1adb5fSAnton Blanchard
187cc1adb5fSAnton Blanchard	mr	r4,r5
188cc1adb5fSAnton Blanchard	mr	r5,r6
189cc1adb5fSAnton Blanchard	mr	r6,r7
190cc1adb5fSAnton Blanchard	mr	r7,r8
191cc1adb5fSAnton Blanchard	mr	r8,r9
192cc1adb5fSAnton Blanchard	mr	r9,r10
193cc1adb5fSAnton Blanchard
194cc1adb5fSAnton Blanchard	HVSC
195cc1adb5fSAnton Blanchard
196*3b678768SAthira Rajeev	ld	r12,STACK_FRAME_MIN_SIZE+STK_PARAM(R4)(r1)
197cc1adb5fSAnton Blanchard	std	r4,0(r12)
198cc1adb5fSAnton Blanchard	std	r5,8(r12)
199cc1adb5fSAnton Blanchard	std	r6,16(r12)
200cc1adb5fSAnton Blanchard	std	r7,24(r12)
201cc1adb5fSAnton Blanchard
2026f26353cSAnton Blanchard	HCALL_INST_POSTCALL(r12)
20357852a85SMike Kravetz
20459dc5bfcSNicholas Piggin	li	r4,0
20559dc5bfcSNicholas Piggin	stb	r4,PACASRR_VALID(r13)
20659dc5bfcSNicholas Piggin
207b13a96cfSHeiko J Schick	lwz	r0,8(r1)
208b13a96cfSHeiko J Schick	mtcrf	0xff,r0
209b13a96cfSHeiko J Schick
210cc1adb5fSAnton Blanchard	blr
211cc1adb5fSAnton Blanchard#endif
212b13a96cfSHeiko J Schick
213b4aea36bSMohan Kumar M/*
214b4aea36bSMohan Kumar M * plpar_hcall_raw can be called in real mode. kexec/kdump need some
215b4aea36bSMohan Kumar M * hypervisor calls to be executed in real mode. So plpar_hcall_raw
216b4aea36bSMohan Kumar M * does not access the per cpu hypervisor call statistics variables,
217b4aea36bSMohan Kumar M * since these variables may not be present in the RMO region.
218b4aea36bSMohan Kumar M */
219b4aea36bSMohan Kumar M_GLOBAL(plpar_hcall_raw)
220b4aea36bSMohan Kumar M	HMT_MEDIUM
221b4aea36bSMohan Kumar M
222b4aea36bSMohan Kumar M	mfcr	r0
223b4aea36bSMohan Kumar M	stw	r0,8(r1)
224b4aea36bSMohan Kumar M
22544ce6a5eSMichael Neuling	std     r4,STK_PARAM(R4)(r1)     /* Save ret buffer */
226b4aea36bSMohan Kumar M
227b4aea36bSMohan Kumar M	mr	r4,r5
228b4aea36bSMohan Kumar M	mr	r5,r6
229b4aea36bSMohan Kumar M	mr	r6,r7
230b4aea36bSMohan Kumar M	mr	r7,r8
231b4aea36bSMohan Kumar M	mr	r8,r9
232b4aea36bSMohan Kumar M	mr	r9,r10
233b4aea36bSMohan Kumar M
234b4aea36bSMohan Kumar M	HVSC				/* invoke the hypervisor */
235b4aea36bSMohan Kumar M
23644ce6a5eSMichael Neuling	ld	r12,STK_PARAM(R4)(r1)
237b4aea36bSMohan Kumar M	std	r4,  0(r12)
238b4aea36bSMohan Kumar M	std	r5,  8(r12)
239b4aea36bSMohan Kumar M	std	r6, 16(r12)
240b4aea36bSMohan Kumar M	std	r7, 24(r12)
241b4aea36bSMohan Kumar M
24259dc5bfcSNicholas Piggin	li	r4,0
24359dc5bfcSNicholas Piggin	stb	r4,PACASRR_VALID(r13)
24459dc5bfcSNicholas Piggin
245b4aea36bSMohan Kumar M	lwz	r0,8(r1)
246b4aea36bSMohan Kumar M	mtcrf	0xff,r0
247b4aea36bSMohan Kumar M
248b4aea36bSMohan Kumar M	blr				/* return r3 = status */
249b4aea36bSMohan Kumar M
250c1931e21SAnton Blanchard_GLOBAL_TOC(plpar_hcall9)
251b13a96cfSHeiko J Schick	HMT_MEDIUM
252b13a96cfSHeiko J Schick
253b13a96cfSHeiko J Schick	mfcr	r0
254b13a96cfSHeiko J Schick	stw	r0,8(r1)
255b13a96cfSHeiko J Schick
256cc1adb5fSAnton Blanchard	HCALL_BRANCH(plpar_hcall9_trace)
25757852a85SMike Kravetz
25844ce6a5eSMichael Neuling	std     r4,STK_PARAM(R4)(r1)     /* Save ret buffer */
259b9377ffcSAnton Blanchard
260b9377ffcSAnton Blanchard	mr	r4,r5
261b9377ffcSAnton Blanchard	mr	r5,r6
262b9377ffcSAnton Blanchard	mr	r6,r7
263b9377ffcSAnton Blanchard	mr	r7,r8
264b9377ffcSAnton Blanchard	mr	r8,r9
265b9377ffcSAnton Blanchard	mr	r9,r10
26644ce6a5eSMichael Neuling	ld	r10,STK_PARAM(R11)(r1)	 /* put arg7 in R10 */
26744ce6a5eSMichael Neuling	ld	r11,STK_PARAM(R12)(r1)	 /* put arg8 in R11 */
26844ce6a5eSMichael Neuling	ld	r12,STK_PARAM(R13)(r1)    /* put arg9 in R12 */
269b13a96cfSHeiko J Schick
270b13a96cfSHeiko J Schick	HVSC				/* invoke the hypervisor */
271b13a96cfSHeiko J Schick
272ab87e8dcSAnton Blanchard	mr	r0,r12
27344ce6a5eSMichael Neuling	ld	r12,STK_PARAM(R4)(r1)
274b9377ffcSAnton Blanchard	std	r4,  0(r12)
275b9377ffcSAnton Blanchard	std	r5,  8(r12)
276b9377ffcSAnton Blanchard	std	r6, 16(r12)
277b9377ffcSAnton Blanchard	std	r7, 24(r12)
278b9377ffcSAnton Blanchard	std	r8, 32(r12)
279b9377ffcSAnton Blanchard	std	r9, 40(r12)
280b9377ffcSAnton Blanchard	std	r10,48(r12)
281b9377ffcSAnton Blanchard	std	r11,56(r12)
282ab87e8dcSAnton Blanchard	std	r0, 64(r12)
283b13a96cfSHeiko J Schick
28459dc5bfcSNicholas Piggin	li	r4,0
28559dc5bfcSNicholas Piggin	stb	r4,PACASRR_VALID(r13)
28659dc5bfcSNicholas Piggin
287cc1adb5fSAnton Blanchard	lwz	r0,8(r1)
288cc1adb5fSAnton Blanchard	mtcrf	0xff,r0
289cc1adb5fSAnton Blanchard
290cc1adb5fSAnton Blanchard	blr				/* return r3 = status */
291cc1adb5fSAnton Blanchard
292cc1adb5fSAnton Blanchard#ifdef CONFIG_TRACEPOINTS
293cc1adb5fSAnton Blanchardplpar_hcall9_trace:
294cc1adb5fSAnton Blanchard	HCALL_INST_PRECALL(R5)
295cc1adb5fSAnton Blanchard
296cc1adb5fSAnton Blanchard	mr	r4,r5
297cc1adb5fSAnton Blanchard	mr	r5,r6
298cc1adb5fSAnton Blanchard	mr	r6,r7
299cc1adb5fSAnton Blanchard	mr	r7,r8
300cc1adb5fSAnton Blanchard	mr	r8,r9
301cc1adb5fSAnton Blanchard	mr	r9,r10
302baa49d81SNicholas Piggin	ld	r10,STACK_FRAME_MIN_SIZE+STK_PARAM(R11)(r1)
303baa49d81SNicholas Piggin	ld	r11,STACK_FRAME_MIN_SIZE+STK_PARAM(R12)(r1)
304baa49d81SNicholas Piggin	ld	r12,STACK_FRAME_MIN_SIZE+STK_PARAM(R13)(r1)
305cc1adb5fSAnton Blanchard
306cc1adb5fSAnton Blanchard	HVSC
307cc1adb5fSAnton Blanchard
308cc1adb5fSAnton Blanchard	mr	r0,r12
309baa49d81SNicholas Piggin	ld	r12,STACK_FRAME_MIN_SIZE+STK_PARAM(R4)(r1)
310cc1adb5fSAnton Blanchard	std	r4,0(r12)
311cc1adb5fSAnton Blanchard	std	r5,8(r12)
312cc1adb5fSAnton Blanchard	std	r6,16(r12)
313cc1adb5fSAnton Blanchard	std	r7,24(r12)
314cc1adb5fSAnton Blanchard	std	r8,32(r12)
315cc1adb5fSAnton Blanchard	std	r9,40(r12)
316cc1adb5fSAnton Blanchard	std	r10,48(r12)
317cc1adb5fSAnton Blanchard	std	r11,56(r12)
318cc1adb5fSAnton Blanchard	std	r0,64(r12)
319cc1adb5fSAnton Blanchard
3206f26353cSAnton Blanchard	HCALL_INST_POSTCALL(r12)
32157852a85SMike Kravetz
32259dc5bfcSNicholas Piggin	li	r4,0
32359dc5bfcSNicholas Piggin	stb	r4,PACASRR_VALID(r13)
32459dc5bfcSNicholas Piggin
325b13a96cfSHeiko J Schick	lwz	r0,8(r1)
326b13a96cfSHeiko J Schick	mtcrf	0xff,r0
327b13a96cfSHeiko J Schick
328cc1adb5fSAnton Blanchard	blr
329cc1adb5fSAnton Blanchard#endif
330f90ece28SMichael Neuling
331f90ece28SMichael Neuling/* See plpar_hcall_raw to see why this is needed */
332f90ece28SMichael Neuling_GLOBAL(plpar_hcall9_raw)
333f90ece28SMichael Neuling	HMT_MEDIUM
334f90ece28SMichael Neuling
335f90ece28SMichael Neuling	mfcr	r0
336f90ece28SMichael Neuling	stw	r0,8(r1)
337f90ece28SMichael Neuling
33844ce6a5eSMichael Neuling	std     r4,STK_PARAM(R4)(r1)     /* Save ret buffer */
339f90ece28SMichael Neuling
340f90ece28SMichael Neuling	mr	r4,r5
341f90ece28SMichael Neuling	mr	r5,r6
342f90ece28SMichael Neuling	mr	r6,r7
343f90ece28SMichael Neuling	mr	r7,r8
344f90ece28SMichael Neuling	mr	r8,r9
345f90ece28SMichael Neuling	mr	r9,r10
34644ce6a5eSMichael Neuling	ld	r10,STK_PARAM(R11)(r1)	 /* put arg7 in R10 */
34744ce6a5eSMichael Neuling	ld	r11,STK_PARAM(R12)(r1)	 /* put arg8 in R11 */
34844ce6a5eSMichael Neuling	ld	r12,STK_PARAM(R13)(r1)    /* put arg9 in R12 */
349f90ece28SMichael Neuling
350f90ece28SMichael Neuling	HVSC				/* invoke the hypervisor */
351f90ece28SMichael Neuling
352f90ece28SMichael Neuling	mr	r0,r12
35344ce6a5eSMichael Neuling	ld	r12,STK_PARAM(R4)(r1)
354f90ece28SMichael Neuling	std	r4,  0(r12)
355f90ece28SMichael Neuling	std	r5,  8(r12)
356f90ece28SMichael Neuling	std	r6, 16(r12)
357f90ece28SMichael Neuling	std	r7, 24(r12)
358f90ece28SMichael Neuling	std	r8, 32(r12)
359f90ece28SMichael Neuling	std	r9, 40(r12)
360f90ece28SMichael Neuling	std	r10,48(r12)
361f90ece28SMichael Neuling	std	r11,56(r12)
362f90ece28SMichael Neuling	std	r0, 64(r12)
363f90ece28SMichael Neuling
36459dc5bfcSNicholas Piggin	li	r4,0
36559dc5bfcSNicholas Piggin	stb	r4,PACASRR_VALID(r13)
36659dc5bfcSNicholas Piggin
367f90ece28SMichael Neuling	lwz	r0,8(r1)
368f90ece28SMichael Neuling	mtcrf	0xff,r0
369f90ece28SMichael Neuling
370f90ece28SMichael Neuling	blr				/* return r3 = status */
371