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