xref: /linux/arch/powerpc/platforms/ps3/hvcall.S (revision 79790b6818e96c58fe2bffee1b418c16e64e7b80)
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 *  PS3 hvcall interface.
4 *
5 *  Copyright (C) 2006 Sony Computer Entertainment Inc.
6 *  Copyright 2006 Sony Corp.
7 *  Copyright 2003, 2004 (c) MontaVista Software, Inc.
8 */
9
10#include <asm/processor.h>
11#include <asm/ppc_asm.h>
12#include <asm/ptrace.h>
13
14#define lv1call .long 0x44000022; extsw r3, r3
15
16#define LV1_N_IN_0_OUT(API_NAME, API_NUMBER)	\
17_GLOBAL(_##API_NAME)				\
18						\
19	mflr	r0;				\
20	std	r0, LRSAVE(r1);			\
21						\
22	stdu    r1, -STACK_FRAME_MIN_SIZE(r1);	\
23	li      r11, API_NUMBER;		\
24	lv1call;				\
25	addi	r1, r1, STACK_FRAME_MIN_SIZE;	\
26						\
27	ld	r0, LRSAVE(r1);			\
28	mtlr	r0;				\
29	blr
30
31#define LV1_0_IN_0_OUT LV1_N_IN_0_OUT
32#define LV1_1_IN_0_OUT LV1_N_IN_0_OUT
33#define LV1_2_IN_0_OUT LV1_N_IN_0_OUT
34#define LV1_3_IN_0_OUT LV1_N_IN_0_OUT
35#define LV1_4_IN_0_OUT LV1_N_IN_0_OUT
36#define LV1_5_IN_0_OUT LV1_N_IN_0_OUT
37#define LV1_6_IN_0_OUT LV1_N_IN_0_OUT
38#define LV1_7_IN_0_OUT LV1_N_IN_0_OUT
39
40#define LV1_0_IN_1_OUT(API_NAME, API_NUMBER)	\
41_GLOBAL(_##API_NAME)				\
42						\
43	mflr	r0;				\
44	std	r0, LRSAVE(r1);			\
45						\
46	std	r3, -8(r1);			\
47	stdu    r1, -STACK_FRAME_MIN_SIZE-8(r1); \
48						\
49	li      r11, API_NUMBER;		\
50	lv1call;				\
51						\
52	addi	r1, r1, STACK_FRAME_MIN_SIZE+8;	\
53	ld	r11, -8(r1);			\
54	std	r4, 0(r11);			\
55						\
56	ld	r0, LRSAVE(r1);			\
57	mtlr	r0;				\
58	blr
59
60#define LV1_0_IN_2_OUT(API_NAME, API_NUMBER)	\
61_GLOBAL(_##API_NAME)				\
62						\
63	mflr	r0;				\
64	std	r0, LRSAVE(r1);			\
65						\
66	std     r3, -8(r1);			\
67	std	r4, -16(r1);			\
68	stdu    r1, -STACK_FRAME_MIN_SIZE-16(r1); \
69						\
70	li      r11, API_NUMBER;		\
71	lv1call;				\
72						\
73	addi	r1, r1, STACK_FRAME_MIN_SIZE+16; \
74	ld	r11, -8(r1);			\
75	std	r4, 0(r11);			\
76	ld	r11, -16(r1);			\
77	std	r5, 0(r11);			\
78						\
79	ld	r0, LRSAVE(r1);			\
80	mtlr	r0;				\
81	blr
82
83#define LV1_0_IN_3_OUT(API_NAME, API_NUMBER)	\
84_GLOBAL(_##API_NAME)				\
85						\
86	mflr	r0;				\
87	std	r0, LRSAVE(r1);			\
88						\
89	std     r3, -8(r1);			\
90	std	r4, -16(r1);			\
91	std	r5, -24(r1);			\
92	stdu    r1, -STACK_FRAME_MIN_SIZE-24(r1); \
93						\
94	li      r11, API_NUMBER;		\
95	lv1call;				\
96						\
97	addi	r1, r1, STACK_FRAME_MIN_SIZE+24; \
98	ld	r11, -8(r1);			\
99	std	r4, 0(r11);			\
100	ld	r11, -16(r1);			\
101	std	r5, 0(r11);			\
102	ld	r11, -24(r1);			\
103	std	r6, 0(r11);			\
104						\
105	ld	r0, LRSAVE(r1);			\
106	mtlr	r0;				\
107	blr
108
109#define LV1_0_IN_7_OUT(API_NAME, API_NUMBER)	\
110_GLOBAL(_##API_NAME)				\
111						\
112	mflr	r0;				\
113	std	r0, LRSAVE(r1);			\
114						\
115	std     r3, -8(r1);			\
116	std	r4, -16(r1);			\
117	std	r5, -24(r1);			\
118	std	r6, -32(r1);			\
119	std	r7, -40(r1);			\
120	std	r8, -48(r1);			\
121	std	r9, -56(r1);			\
122	stdu    r1, -STACK_FRAME_MIN_SIZE-56(r1); \
123						\
124	li      r11, API_NUMBER;		\
125	lv1call;				\
126						\
127	addi	r1, r1, STACK_FRAME_MIN_SIZE+56; \
128	ld	r11, -8(r1);			\
129	std	r4, 0(r11);			\
130	ld	r11, -16(r1);			\
131	std	r5, 0(r11);			\
132	ld	r11, -24(r1);			\
133	std	r6, 0(r11);			\
134	ld	r11, -32(r1);			\
135	std	r7, 0(r11);			\
136	ld	r11, -40(r1);			\
137	std	r8, 0(r11);			\
138	ld	r11, -48(r1);			\
139	std	r9, 0(r11);			\
140	ld	r11, -56(r1);			\
141	std	r10, 0(r11);			\
142						\
143	ld	r0, LRSAVE(r1);			\
144	mtlr	r0;				\
145	blr
146
147#define LV1_1_IN_1_OUT(API_NAME, API_NUMBER)	\
148_GLOBAL(_##API_NAME)				\
149						\
150	mflr	r0;				\
151	std	r0, LRSAVE(r1);			\
152						\
153	std	r4, -8(r1);			\
154	stdu    r1, -STACK_FRAME_MIN_SIZE-8(r1); \
155						\
156	li      r11, API_NUMBER;		\
157	lv1call;				\
158						\
159	addi	r1, r1, STACK_FRAME_MIN_SIZE+8;	\
160	ld	r11, -8(r1);			\
161	std	r4, 0(r11);			\
162						\
163	ld	r0, LRSAVE(r1);			\
164	mtlr	r0;				\
165	blr
166
167#define LV1_1_IN_2_OUT(API_NAME, API_NUMBER)	\
168_GLOBAL(_##API_NAME)				\
169						\
170	mflr	r0;				\
171	std	r0, LRSAVE(r1);			\
172						\
173	std     r4, -8(r1);			\
174	std	r5, -16(r1);			\
175	stdu    r1, -STACK_FRAME_MIN_SIZE-16(r1); \
176						\
177	li      r11, API_NUMBER;		\
178	lv1call;				\
179						\
180	addi	r1, r1, STACK_FRAME_MIN_SIZE+16; \
181	ld	r11, -8(r1);			\
182	std	r4, 0(r11);			\
183	ld	r11, -16(r1);			\
184	std	r5, 0(r11);			\
185						\
186	ld	r0, LRSAVE(r1);			\
187	mtlr	r0;				\
188	blr
189
190#define LV1_1_IN_3_OUT(API_NAME, API_NUMBER)	\
191_GLOBAL(_##API_NAME)				\
192						\
193	mflr	r0;				\
194	std	r0, LRSAVE(r1);			\
195						\
196	std     r4, -8(r1);			\
197	std	r5, -16(r1);			\
198	std	r6, -24(r1);			\
199	stdu    r1, -STACK_FRAME_MIN_SIZE-24(r1); \
200						\
201	li      r11, API_NUMBER;		\
202	lv1call;				\
203						\
204	addi	r1, r1, STACK_FRAME_MIN_SIZE+24; \
205	ld	r11, -8(r1);			\
206	std	r4, 0(r11);			\
207	ld	r11, -16(r1);			\
208	std	r5, 0(r11);			\
209	ld	r11, -24(r1);			\
210	std	r6, 0(r11);			\
211						\
212	ld	r0, LRSAVE(r1);			\
213	mtlr	r0;				\
214	blr
215
216#define LV1_1_IN_4_OUT(API_NAME, API_NUMBER)	\
217_GLOBAL(_##API_NAME)				\
218						\
219	mflr	r0;				\
220	std	r0, LRSAVE(r1);			\
221						\
222	std     r4, -8(r1);			\
223	std	r5, -16(r1);			\
224	std	r6, -24(r1);			\
225	std	r7, -32(r1);			\
226	stdu    r1, -STACK_FRAME_MIN_SIZE-32(r1); \
227						\
228	li      r11, API_NUMBER;		\
229	lv1call;				\
230						\
231	addi	r1, r1, STACK_FRAME_MIN_SIZE+32; \
232	ld	r11, -8(r1);			\
233	std	r4, 0(r11);			\
234	ld	r11, -16(r1);			\
235	std	r5, 0(r11);			\
236	ld	r11, -24(r1);			\
237	std	r6, 0(r11);			\
238	ld	r11, -32(r1);			\
239	std	r7, 0(r11);			\
240						\
241	ld	r0, LRSAVE(r1);			\
242	mtlr	r0;				\
243	blr
244
245#define LV1_1_IN_5_OUT(API_NAME, API_NUMBER)	\
246_GLOBAL(_##API_NAME)				\
247						\
248	mflr	r0;				\
249	std	r0, LRSAVE(r1);			\
250						\
251	std     r4, -8(r1);			\
252	std	r5, -16(r1);			\
253	std	r6, -24(r1);			\
254	std	r7, -32(r1);			\
255	std	r8, -40(r1);			\
256	stdu    r1, -STACK_FRAME_MIN_SIZE-40(r1); \
257						\
258	li      r11, API_NUMBER;		\
259	lv1call;				\
260						\
261	addi	r1, r1, STACK_FRAME_MIN_SIZE+40; \
262	ld	r11, -8(r1);			\
263	std	r4, 0(r11);			\
264	ld	r11, -16(r1);			\
265	std	r5, 0(r11);			\
266	ld	r11, -24(r1);			\
267	std	r6, 0(r11);			\
268	ld	r11, -32(r1);			\
269	std	r7, 0(r11);			\
270	ld	r11, -40(r1);			\
271	std	r8, 0(r11);			\
272						\
273	ld	r0, LRSAVE(r1);			\
274	mtlr	r0;				\
275	blr
276
277#define LV1_1_IN_6_OUT(API_NAME, API_NUMBER)	\
278_GLOBAL(_##API_NAME)				\
279						\
280	mflr	r0;				\
281	std	r0, LRSAVE(r1);			\
282						\
283	std     r4, -8(r1);			\
284	std	r5, -16(r1);			\
285	std	r6, -24(r1);			\
286	std	r7, -32(r1);			\
287	std	r8, -40(r1);			\
288	std	r9, -48(r1);			\
289	stdu    r1, -STACK_FRAME_MIN_SIZE-48(r1); \
290						\
291	li      r11, API_NUMBER;		\
292	lv1call;				\
293						\
294	addi	r1, r1, STACK_FRAME_MIN_SIZE+48; \
295	ld	r11, -8(r1);			\
296	std	r4, 0(r11);			\
297	ld	r11, -16(r1);			\
298	std	r5, 0(r11);			\
299	ld	r11, -24(r1);			\
300	std	r6, 0(r11);			\
301	ld	r11, -32(r1);			\
302	std	r7, 0(r11);			\
303	ld	r11, -40(r1);			\
304	std	r8, 0(r11);			\
305	ld	r11, -48(r1);			\
306	std	r9, 0(r11);			\
307						\
308	ld	r0, LRSAVE(r1);			\
309	mtlr	r0;				\
310	blr
311
312#define LV1_1_IN_7_OUT(API_NAME, API_NUMBER)	\
313_GLOBAL(_##API_NAME)				\
314						\
315	mflr	r0;				\
316	std	r0, LRSAVE(r1);			\
317						\
318	std     r4, -8(r1);			\
319	std	r5, -16(r1);			\
320	std	r6, -24(r1);			\
321	std	r7, -32(r1);			\
322	std	r8, -40(r1);			\
323	std	r9, -48(r1);			\
324	std	r10, -56(r1);			\
325	stdu    r1, -STACK_FRAME_MIN_SIZE-56(r1); \
326						\
327	li      r11, API_NUMBER;		\
328	lv1call;				\
329						\
330	addi	r1, r1, STACK_FRAME_MIN_SIZE+56; \
331	ld	r11, -8(r1);			\
332	std	r4, 0(r11);			\
333	ld	r11, -16(r1);			\
334	std	r5, 0(r11);			\
335	ld	r11, -24(r1);			\
336	std	r6, 0(r11);			\
337	ld	r11, -32(r1);			\
338	std	r7, 0(r11);			\
339	ld	r11, -40(r1);			\
340	std	r8, 0(r11);			\
341	ld	r11, -48(r1);			\
342	std	r9, 0(r11);			\
343	ld	r11, -56(r1);			\
344	std	r10, 0(r11);			\
345						\
346	ld	r0, LRSAVE(r1);			\
347	mtlr	r0;				\
348	blr
349
350#define LV1_2_IN_1_OUT(API_NAME, API_NUMBER)	\
351_GLOBAL(_##API_NAME)				\
352						\
353	mflr	r0;				\
354	std	r0, LRSAVE(r1);			\
355						\
356	std	r5, -8(r1);			\
357	stdu    r1, -STACK_FRAME_MIN_SIZE-8(r1); \
358						\
359	li      r11, API_NUMBER;		\
360	lv1call;				\
361						\
362	addi	r1, r1, STACK_FRAME_MIN_SIZE+8;	\
363	ld	r11, -8(r1);			\
364	std	r4, 0(r11);			\
365						\
366	ld	r0, LRSAVE(r1);			\
367	mtlr	r0;				\
368	blr
369
370#define LV1_2_IN_2_OUT(API_NAME, API_NUMBER)	\
371_GLOBAL(_##API_NAME)				\
372						\
373	mflr	r0;				\
374	std	r0, LRSAVE(r1);			\
375						\
376	std     r5, -8(r1);			\
377	std	r6, -16(r1);			\
378	stdu    r1, -STACK_FRAME_MIN_SIZE-16(r1); \
379						\
380	li      r11, API_NUMBER;		\
381	lv1call;				\
382						\
383	addi	r1, r1, STACK_FRAME_MIN_SIZE+16; \
384	ld	r11, -8(r1);			\
385	std	r4, 0(r11);			\
386	ld	r11, -16(r1);			\
387	std	r5, 0(r11);			\
388						\
389	ld	r0, LRSAVE(r1);			\
390	mtlr	r0;				\
391	blr
392
393#define LV1_2_IN_3_OUT(API_NAME, API_NUMBER)	\
394_GLOBAL(_##API_NAME)				\
395						\
396	mflr	r0;				\
397	std	r0, LRSAVE(r1);			\
398						\
399	std     r5, -8(r1);			\
400	std	r6, -16(r1);			\
401	std	r7, -24(r1);			\
402	stdu    r1, -STACK_FRAME_MIN_SIZE-24(r1); \
403						\
404	li      r11, API_NUMBER;		\
405	lv1call;				\
406						\
407	addi	r1, r1, STACK_FRAME_MIN_SIZE+24; \
408	ld	r11, -8(r1);			\
409	std	r4, 0(r11);			\
410	ld	r11, -16(r1);			\
411	std	r5, 0(r11);			\
412	ld	r11, -24(r1);			\
413	std	r6, 0(r11);			\
414						\
415	ld	r0, LRSAVE(r1);			\
416	mtlr	r0;				\
417	blr
418
419#define LV1_2_IN_4_OUT(API_NAME, API_NUMBER)	\
420_GLOBAL(_##API_NAME)				\
421						\
422	mflr	r0;				\
423	std	r0, LRSAVE(r1);			\
424						\
425	std     r5, -8(r1);			\
426	std	r6, -16(r1);			\
427	std	r7, -24(r1);			\
428	std	r8, -32(r1);			\
429	stdu    r1, -STACK_FRAME_MIN_SIZE-32(r1); \
430						\
431	li      r11, API_NUMBER;		\
432	lv1call;				\
433						\
434	addi	r1, r1, STACK_FRAME_MIN_SIZE+32;\
435	ld	r11, -8(r1);			\
436	std	r4, 0(r11);			\
437	ld	r11, -16(r1);			\
438	std	r5, 0(r11);			\
439	ld	r11, -24(r1);			\
440	std	r6, 0(r11);			\
441	ld	r11, -32(r1);			\
442	std	r7, 0(r11);			\
443						\
444	ld	r0, LRSAVE(r1);			\
445	mtlr	r0;				\
446	blr
447
448#define LV1_2_IN_5_OUT(API_NAME, API_NUMBER)	\
449_GLOBAL(_##API_NAME)				\
450						\
451	mflr	r0;				\
452	std	r0, LRSAVE(r1);			\
453						\
454	std     r5, -8(r1);			\
455	std	r6, -16(r1);			\
456	std	r7, -24(r1);			\
457	std	r8, -32(r1);			\
458	std	r9, -40(r1);			\
459	stdu    r1, -STACK_FRAME_MIN_SIZE-40(r1); \
460						\
461	li      r11, API_NUMBER;		\
462	lv1call;				\
463						\
464	addi	r1, r1, STACK_FRAME_MIN_SIZE+40; \
465	ld	r11, -8(r1);			\
466	std	r4, 0(r11);			\
467	ld	r11, -16(r1);			\
468	std	r5, 0(r11);			\
469	ld	r11, -24(r1);			\
470	std	r6, 0(r11);			\
471	ld	r11, -32(r1);			\
472	std	r7, 0(r11);			\
473	ld	r11, -40(r1);			\
474	std	r8, 0(r11);			\
475						\
476	ld	r0, LRSAVE(r1);			\
477	mtlr	r0;				\
478	blr
479
480#define LV1_3_IN_1_OUT(API_NAME, API_NUMBER)	\
481_GLOBAL(_##API_NAME)				\
482						\
483	mflr	r0;				\
484	std	r0, LRSAVE(r1);			\
485						\
486	std	r6, -8(r1);			\
487	stdu    r1, -STACK_FRAME_MIN_SIZE-8(r1); \
488						\
489	li      r11, API_NUMBER;		\
490	lv1call;				\
491						\
492	addi	r1, r1, STACK_FRAME_MIN_SIZE+8;	\
493	ld	r11, -8(r1);			\
494	std	r4, 0(r11);			\
495						\
496	ld	r0, LRSAVE(r1);			\
497	mtlr	r0;				\
498	blr
499
500#define LV1_3_IN_2_OUT(API_NAME, API_NUMBER)	\
501_GLOBAL(_##API_NAME)				\
502						\
503	mflr	r0;				\
504	std	r0, LRSAVE(r1);			\
505						\
506	std     r6, -8(r1);			\
507	std	r7, -16(r1);			\
508	stdu    r1, -STACK_FRAME_MIN_SIZE-16(r1); \
509						\
510	li      r11, API_NUMBER;		\
511	lv1call;				\
512						\
513	addi	r1, r1, STACK_FRAME_MIN_SIZE+16; \
514	ld	r11, -8(r1);			\
515	std	r4, 0(r11);			\
516	ld	r11, -16(r1);			\
517	std	r5, 0(r11);			\
518						\
519	ld	r0, LRSAVE(r1);			\
520	mtlr	r0;				\
521	blr
522
523#define LV1_3_IN_3_OUT(API_NAME, API_NUMBER)	\
524_GLOBAL(_##API_NAME)				\
525						\
526	mflr	r0;				\
527	std	r0, LRSAVE(r1);			\
528						\
529	std     r6, -8(r1);			\
530	std	r7, -16(r1);			\
531	std	r8, -24(r1);			\
532	stdu    r1, -STACK_FRAME_MIN_SIZE-24(r1); \
533						\
534	li      r11, API_NUMBER;		\
535	lv1call;				\
536						\
537	addi	r1, r1, STACK_FRAME_MIN_SIZE+24; \
538	ld	r11, -8(r1);			\
539	std	r4, 0(r11);			\
540	ld	r11, -16(r1);			\
541	std	r5, 0(r11);			\
542	ld	r11, -24(r1);			\
543	std	r6, 0(r11);			\
544						\
545	ld	r0, LRSAVE(r1);			\
546	mtlr	r0;				\
547	blr
548
549#define LV1_4_IN_1_OUT(API_NAME, API_NUMBER)	\
550_GLOBAL(_##API_NAME)				\
551						\
552	mflr	r0;				\
553	std	r0, LRSAVE(r1);			\
554						\
555	std	r7, -8(r1);			\
556	stdu    r1, -STACK_FRAME_MIN_SIZE-8(r1); \
557						\
558	li      r11, API_NUMBER;		\
559	lv1call;				\
560						\
561	addi	r1, r1, STACK_FRAME_MIN_SIZE+8;	\
562	ld	r11, -8(r1);			\
563	std	r4, 0(r11);			\
564						\
565	ld	r0, LRSAVE(r1);			\
566	mtlr	r0;				\
567	blr
568
569#define LV1_4_IN_2_OUT(API_NAME, API_NUMBER)	\
570_GLOBAL(_##API_NAME)				\
571						\
572	mflr	r0;				\
573	std	r0, LRSAVE(r1);			\
574						\
575	std     r7, -8(r1);			\
576	std	r8, -16(r1);			\
577	stdu    r1, -STACK_FRAME_MIN_SIZE-16(r1); \
578						\
579	li      r11, API_NUMBER;		\
580	lv1call;				\
581						\
582	addi	r1, r1, STACK_FRAME_MIN_SIZE+16; \
583	ld	r11, -8(r1);			\
584	std	r4, 0(r11);			\
585	ld	r11, -16(r1);			\
586	std	r5, 0(r11);			\
587						\
588	ld	r0, LRSAVE(r1);			\
589	mtlr	r0;				\
590	blr
591
592#define LV1_4_IN_3_OUT(API_NAME, API_NUMBER)	\
593_GLOBAL(_##API_NAME)				\
594						\
595	mflr	r0;				\
596	std	r0, LRSAVE(r1);			\
597						\
598	std     r7, -8(r1);			\
599	std	r8, -16(r1);			\
600	std	r9, -24(r1);			\
601	stdu    r1, -STACK_FRAME_MIN_SIZE-24(r1); \
602						\
603	li      r11, API_NUMBER;		\
604	lv1call;				\
605						\
606	addi	r1, r1, STACK_FRAME_MIN_SIZE+24; \
607	ld	r11, -8(r1);			\
608	std	r4, 0(r11);			\
609	ld	r11, -16(r1);			\
610	std	r5, 0(r11);			\
611	ld	r11, -24(r1);			\
612	std	r6, 0(r11);			\
613						\
614	ld	r0, LRSAVE(r1);			\
615	mtlr	r0;				\
616	blr
617
618#define LV1_5_IN_1_OUT(API_NAME, API_NUMBER)	\
619_GLOBAL(_##API_NAME)				\
620						\
621	mflr	r0;				\
622	std	r0, LRSAVE(r1);			\
623						\
624	std	r8, -8(r1);			\
625	stdu    r1, -STACK_FRAME_MIN_SIZE-8(r1); \
626						\
627	li      r11, API_NUMBER;		\
628	lv1call;				\
629						\
630	addi	r1, r1, STACK_FRAME_MIN_SIZE+8;	\
631	ld	r11, -8(r1);			\
632	std	r4, 0(r11);			\
633						\
634	ld	r0, LRSAVE(r1);			\
635	mtlr	r0;				\
636	blr
637
638#define LV1_5_IN_2_OUT(API_NAME, API_NUMBER)	\
639_GLOBAL(_##API_NAME)				\
640						\
641	mflr	r0;				\
642	std	r0, LRSAVE(r1);			\
643						\
644	std     r8, -8(r1);			\
645	std	r9, -16(r1);			\
646	stdu    r1, -STACK_FRAME_MIN_SIZE-16(r1); \
647						\
648	li      r11, API_NUMBER;		\
649	lv1call;				\
650						\
651	addi	r1, r1, STACK_FRAME_MIN_SIZE+16; \
652	ld	r11, -8(r1);			\
653	std	r4, 0(r11);			\
654	ld	r11, -16(r1);			\
655	std	r5, 0(r11);			\
656						\
657	ld	r0, LRSAVE(r1);			\
658	mtlr	r0;				\
659	blr
660
661#define LV1_5_IN_3_OUT(API_NAME, API_NUMBER)	\
662_GLOBAL(_##API_NAME)				\
663						\
664	mflr	r0;				\
665	std	r0, LRSAVE(r1);			\
666						\
667	std     r8, -8(r1);			\
668	std	r9, -16(r1);			\
669	std	r10, -24(r1);			\
670	stdu    r1, -STACK_FRAME_MIN_SIZE-24(r1); \
671						\
672	li      r11, API_NUMBER;		\
673	lv1call;				\
674						\
675	addi	r1, r1, STACK_FRAME_MIN_SIZE+24; \
676	ld	r11, -8(r1);			\
677	std	r4, 0(r11);			\
678	ld	r11, -16(r1);			\
679	std	r5, 0(r11);			\
680	ld	r11, -24(r1);			\
681	std	r6, 0(r11);			\
682						\
683	ld	r0, LRSAVE(r1);			\
684	mtlr	r0;				\
685	blr
686
687#define LV1_6_IN_1_OUT(API_NAME, API_NUMBER)	\
688_GLOBAL(_##API_NAME)				\
689						\
690	mflr	r0;				\
691	std	r0, LRSAVE(r1);			\
692						\
693	std	r9, -8(r1);			\
694	stdu    r1, -STACK_FRAME_MIN_SIZE-8(r1); \
695						\
696	li      r11, API_NUMBER;		\
697	lv1call;				\
698						\
699	addi	r1, r1, STACK_FRAME_MIN_SIZE+8;	\
700	ld	r11, -8(r1);			\
701	std	r4, 0(r11);			\
702						\
703	ld	r0, LRSAVE(r1);			\
704	mtlr	r0;				\
705	blr
706
707#define LV1_6_IN_2_OUT(API_NAME, API_NUMBER)	\
708_GLOBAL(_##API_NAME)				\
709						\
710	mflr	r0;				\
711	std	r0, LRSAVE(r1);			\
712						\
713	std     r9, -8(r1);			\
714	std	r10, -16(r1);			\
715	stdu    r1, -STACK_FRAME_MIN_SIZE-16(r1); \
716						\
717	li      r11, API_NUMBER;		\
718	lv1call;				\
719						\
720	addi	r1, r1, STACK_FRAME_MIN_SIZE+16; \
721	ld	r11, -8(r1);			\
722	std	r4, 0(r11);			\
723	ld	r11, -16(r1);			\
724	std	r5, 0(r11);			\
725						\
726	ld	r0, LRSAVE(r1);			\
727	mtlr	r0;				\
728	blr
729
730#define LV1_6_IN_3_OUT(API_NAME, API_NUMBER)	\
731_GLOBAL(_##API_NAME)				\
732						\
733	mflr	r0;				\
734	std	r0, LRSAVE(r1);			\
735						\
736	std     r9, -8(r1);			\
737	std	r10, -16(r1);			\
738	stdu    r1, -STACK_FRAME_MIN_SIZE-16(r1); \
739						\
740	li      r11, API_NUMBER;		\
741	lv1call;				\
742						\
743	addi	r1, r1, STACK_FRAME_MIN_SIZE+16; \
744	ld	r11, -8(r1);			\
745	std	r4, 0(r11);			\
746	ld	r11, -16(r1);			\
747	std	r5, 0(r11);			\
748	ld	r11, STK_PARAM_AREA+8*8(r1);	\
749	std	r6, 0(r11);			\
750						\
751	ld	r0, LRSAVE(r1);			\
752	mtlr	r0;				\
753	blr
754
755#define LV1_7_IN_1_OUT(API_NAME, API_NUMBER)	\
756_GLOBAL(_##API_NAME)				\
757						\
758	mflr	r0;				\
759	std	r0, LRSAVE(r1);			\
760						\
761	std	r10, -8(r1);			\
762	stdu    r1, -STACK_FRAME_MIN_SIZE-8(r1); \
763						\
764	li      r11, API_NUMBER;		\
765	lv1call;				\
766						\
767	addi	r1, r1, STACK_FRAME_MIN_SIZE+8;	\
768	ld	r11, -8(r1);			\
769	std	r4, 0(r11);			\
770						\
771	ld	r0, LRSAVE(r1);			\
772	mtlr	r0;				\
773	blr
774
775#define LV1_7_IN_6_OUT(API_NAME, API_NUMBER)	\
776_GLOBAL(_##API_NAME)				\
777						\
778	mflr	r0;				\
779	std	r0, LRSAVE(r1);			\
780						\
781	std	r10, STK_PARAM_AREA+8*7(r1);	\
782	stdu    r1, -STACK_FRAME_MIN_SIZE(r1);	\
783						\
784	li	r11, API_NUMBER;		\
785	lv1call;				\
786						\
787	addi	r1, r1, STACK_FRAME_MIN_SIZE;	\
788	ld	r11, STK_PARAM_AREA+8*7(r1);	\
789	std	r4, 0(r11);			\
790	ld	r11, STK_PARAM_AREA+8*8(r1);	\
791	std	r5, 0(r11);			\
792	ld	r11, STK_PARAM_AREA+8*9(r1);	\
793	std	r6, 0(r11);			\
794	ld	r11, STK_PARAM_AREA+8*10(r1);	\
795	std	r7, 0(r11);			\
796	ld	r11, STK_PARAM_AREA+8*11(r1);	\
797	std	r8, 0(r11);			\
798	ld	r11, STK_PARAM_AREA+8*12(r1);	\
799	std	r9, 0(r11);			\
800						\
801	ld	r0, LRSAVE(r1);			\
802	mtlr	r0;				\
803	blr
804
805#define LV1_8_IN_1_OUT(API_NAME, API_NUMBER)	\
806_GLOBAL(_##API_NAME)				\
807						\
808	mflr	r0;				\
809	std	r0, LRSAVE(r1);			\
810	stdu    r1, -STACK_FRAME_MIN_SIZE(r1);	\
811						\
812	li      r11, API_NUMBER;		\
813	lv1call;				\
814						\
815	addi	r1, r1, STACK_FRAME_MIN_SIZE;	\
816	ld	r11, STK_PARAM_AREA+8*8(r1);	\
817	std	r4, 0(r11);			\
818						\
819	ld	r0, LRSAVE(r1);			\
820	mtlr	r0;				\
821	blr
822
823	.text
824
825/* the lv1 underscored call definitions expand here */
826
827#define LV1_CALL(name, in, out, num) LV1_##in##_IN_##out##_OUT(lv1_##name, num)
828#include <asm/lv1call.h>
829