2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 /* This program generates the libcall.h macroset for gcc-4.5.1 m68k-elf
7 * WARNING: The header generated by this program is designed
8 * to work with GCC 4.5.1 and GCC 4.6.1 m68k-elf ONLY.
10 * If it breaks, you get to keep both pieces.
17 #define GENCALL_MAX (13 + 1) /* Max number of arguments */
19 /* NOTE: For all 'call' macros, ie AROS_LC5(), the
20 * 'bt' parameter is frequently garbled by
21 * callers who use '#define's like:
23 * #define UtilityBase mydata->utilitybase
25 * this makes a 'bt' parameter of 'struct UtilityBase *'
26 * turn into 'struct mydata->utilitybase *'.
28 * Unhappiness ensues. So, we must use 'void *'
29 * for all 'bt' arguments in the call macros.
32 #define FLAG_BN (1 << 0)
33 #define FLAG_DOUBLE (1 << 1)
34 #define FLAG_NR (1 << 2)
36 void aros_ufp(int id
, int is_static
)
40 printf("#define AROS_UFP%d%s(t,n", id
, is_static
? "S" : "");
41 for (i
= 0; i
< id
; i
++)
42 printf(",a%d", i
+ 1);
44 printf("\t%st n (void)\n", is_static
? "static " : "");
47 void aros_ufh(int id
, int is_static
)
51 printf("#define AROS_UFH%d%s(t,n", id
, is_static
? "S" : "");
52 for (i
= 0; i
< id
; i
++)
53 printf(",a%d", i
+ 1);
55 printf("\t%st n (void) {%s\n", is_static
? "static " : "", (i
==0) ? "" : " \\");
56 for (i
= 0; i
< id
; i
++)
57 printf(" \\\n\t__AROS_UFPA(a%d) __attribute__((unused)) __AROS_UFCA(a%d) = __AROS_ISREG(a%d,__AROS_FP_REG) ? (__AROS_UFPA(a%d))(ULONG)__builtin_frame_address(1) : ({register ULONG __r asm(__AROS_UFSA(a%d));(__AROS_UFPA(a%d))__r;});", i
+1, i
+1, i
+1, i
+1, i
+1, i
+1);
61 static void asm_regs_init(int id
, int flags
, const char *type
, const char *jmp
, const char *addr
)
64 int has_bn
= (flags
& FLAG_BN
);
65 const char *output
= "\"=r\"(_ret0), \"=r\"(_ret1), \"=r\"(_mem0), \"=r\"(_mem1)";
67 printf("\tregister volatile ULONG _ret0 asm(\"%%d0\"); \\\n");
68 printf("\tregister volatile ULONG _ret1 asm(\"%%d1\"); \\\n");
69 printf("\tregister volatile ULONG _mem0 asm(\"%%a0\"); \\\n");
70 printf("\tregister volatile ULONG _mem1 asm(\"%%a1\"); \\\n");
74 for (i
= 0; i
< id
; i
++)
75 printf("\t ULONG _arg%d = (ULONG)__AROS_%sCA(a%d); \\\n",
79 printf("\t ULONG _bn_arg = (ULONG)bn; \\\n");
81 /* Define registers */
82 for (i
= 0; i
< id
; i
++)
83 printf("\t register volatile ULONG __AROS_%sTA(a%d) asm(__AROS_%sSA(a%d)); \\\n",
84 type
, i
+ 1, type
, i
+ 1
87 printf("\t register volatile ULONG _bn asm(\"%%a6\"); \\\n");
89 /* Set registers (non FP) */
90 for (i
= 1; i
<= id
; i
++)
91 printf("\t if (! __AROS_ISREG(a%d,__AROS_FP_REG)) { \\\n"
92 "\t __AROS_%sTA(a%d) = _arg%d; } \\\n",
96 printf("\t if (! __AROS_ISREG(bt,bn,A6,__AROS_FP_REG)) { \\\n"
97 "\t _bn = _bn_arg; } \\\n"
100 /* Set FP register */
101 for (i
= 1; i
<= id
; i
++)
103 printf("\t if ( __AROS_ISREG(a%d,__AROS_FP_REG)) { \\\n"
104 "\t asm volatile (\"move.l %%%%\" __AROS_FP_SREG \",%%%%sp@-\\nmove.l %%4,%%%%\" __AROS_FP_SREG \"\\n%s\\nmove.l %%%%sp@+,%%%%\" __AROS_FP_SREG \"\\n\" : %s : \"r\" (_arg%d), %s \\\n",
105 i
, jmp
, output
, i
, addr
108 for (j
= 0; j
< id
; j
++)
109 printf("\t\t, \"r\" (__AROS_%sTA(a%d)) \\\n", type
, j
+ 1);
110 printf ("\t\t: \"cc\", \"memory\" \\\n");
111 printf("\t ); }\\\n");
115 printf("\t if ( __AROS_ISREG(bt,bn,A6,__AROS_FP_REG)) { \\\n"
116 "\t asm volatile (\"move.l %%%%\" __AROS_FP_SREG \",%%%%sp@-\\nmove.l %%4,%%%%\" __AROS_FP_SREG \"\\n%s\\nmove.l %%%%sp@+,%%%%\" __AROS_FP_SREG \"\\n\" : %s : \"r\" (_bn_arg), %s \\\n", jmp
, output
, addr
119 for (j
= 0; j
< id
; j
++)
120 printf("\t\t, \"r\" (__AROS_%sTA(a%d)) \\\n", type
, j
+ 1);
121 printf ("\t\t: \"cc\", \"memory\" \\\n");
122 printf("\t ); }\\\n");
124 if (has_bn
|| id
> 0)
126 printf("\t if (!(0");
128 printf(" || __AROS_ISREG(bt,bn,A6,__AROS_FP_REG)");
129 for (i
= 0; i
< id
; i
++)
130 printf(" || __AROS_ISREG(a%d,__AROS_FP_REG)", i
+1);
132 "\t asm volatile (\"%s\\n\" : %s : \"i\" (0), %s \\\n", jmp
, output
, addr
135 for (j
= 0; j
< id
; j
++)
136 printf("\t\t, \"r\" (__AROS_%sTA(a%d)) \\\n", type
, j
+ 1);
137 printf ("\t\t: \"cc\", \"memory\" \\\n");
138 printf("\t ); }\\\n");
143 if (flags
& FLAG_NR
) {
147 /* Get the return code
149 * We rely upon the compiler to optimize this to either
150 * as single %d0 for BYTE..LONG, or %d0/%d1 for QUAD/double
152 * Struct returns are not supported.
154 printf("\t(void)_mem0; (void)_mem1; \\\n");
155 printf("\t(sizeof(t) < sizeof(QUAD)) ? (t)(_ret0) :\\\n");
156 printf("\t ({struct { ULONG r0,r1; } rv;\\\n");
157 printf("\t t *t_ptr = (t *)&rv.r0;\\\n");
158 printf("\t rv.r0 = _ret0; rv.r1 = _ret1; *t_ptr; });\\\n");
161 static inline const char *nr(int flags
)
169 static void aros_ufc(int id
, int flags
)
174 printf("#define __AROS_UFC%d%s(t,n", id
, nr(flags
));
175 for (i
= 0; i
< id
; i
++)
176 printf(",a%d", i
+ 1);
178 printf("\t({ APTR _n = (n);\\\n");
179 snprintf(jmp
, sizeof(jmp
),
180 "\tpea.l 6(%%%%pc)\\n"
181 "\tmove.l %%5, -(%%%%sp)\\n"
184 jmp
[sizeof(jmp
)-1]=0;
186 asm_regs_init(i
, flags
, "UF", jmp
, "\"r\" (_n), \"i\" (__LINE__)");
188 printf("#define AROS_UFC%d%s __AROS_UFC%d%s\n", id
, nr(flags
), id
, nr(flags
));
191 void aros_lc(int id
, int flags
)
194 int is_double
= (flags
& FLAG_DOUBLE
);
197 printf("#define __AROS_LC%d%s%s(t,n,", id
, is_double
? "D" : "", nr(flags
));
198 for (i
= 0; i
< id
; i
++)
199 printf("a%d,", i
+ 1);
200 printf("bt,bn,o,s) \\\n");
202 asm_regs_init(id
, flags
, "L", "jsr %c5(%%a6)", "\"i\" (-1 * (o) * LIB_VECTSIZE), \"r\" (_bn)");
204 printf("#define AROS_LC%d%s%s __AROS_LC%d%s%s\n", id
, is_double
? "D" : "", nr(flags
), id
, is_double
? "D" : "", nr(flags
));
207 void aros_lp(int id
, int is_ignored
)
211 printf("#define __AROS_LP%d%s(t,n,", id
, is_ignored
? "I" : "");
212 for (i
= 0; i
< id
; i
++)
213 printf("a%d,", i
+ 1);
214 printf("bt,bn,o,s) \\\n");
216 for (i
= 0; i
< id
; i
++)
217 printf("__AROS_LHA(a%d)%s",
219 ((i
+ 1) == id
) ? "" : ", \\\n\t"
224 printf("#define AROS_LP%d%s __AROS_LP%d%s\n", id
, is_ignored
? "I" : "", id
, is_ignored
? "I" : "");
227 void aros_lh(int id
, int is_ignored
)
231 printf("#define __AROS_LH%d%s(t,n,", id
, is_ignored
? "I" : "");
232 for (i
= 0; i
< id
; i
++)
233 printf("a%d,", i
+ 1);
234 printf("bt,bn,o,s) \\\n");
235 printf("\tt AROS_SLIB_ENTRY(n,s,o) (void) {");
236 for (i
= 0; i
< id
; i
++)
237 printf(" \\\n\t__AROS_LPA(a%d) __attribute__((unused)) __AROS_LCA(a%d) = __AROS_ISREG(a%d,__AROS_FP_REG) ? (__AROS_LPA(a%d))(ULONG)__builtin_frame_address(1) : ({register ULONG __r asm(__AROS_LSA(a%d));(__AROS_LPA(a%d))__r;});", i
+1, i
+1, i
+1, i
+1, i
+1, i
+1);
239 printf(" \\\n\tregister bt __attribute__((unused)) bn = __AROS_ISREG(bn,bt,A6,__AROS_FP_REG) ? (bt)(ULONG)__builtin_frame_address(1) : ({register ULONG __r asm(\"%%a6\");(bt)__r;});");
241 printf("#define AROS_LH%d%s __AROS_LH%d%s\n", id
, is_ignored
? "I" : "", id
, is_ignored
? "I" : "");
244 static void aros_call(int id
, int flags
)
247 printf("#define __AROS_CALL%d%s(t,n,", id
, nr(flags
));
248 for (i
= 0; i
< id
; i
++)
249 printf("a%d,", i
+ 1);
250 printf("bt,bn) \\\n");
251 printf("\tAROS_UFC%d%s(t,n", id
+ 1, nr(flags
));
252 for (i
= 0; i
< id
; i
++)
254 printf(",AROS_UFCA(a%d)", i
+ 1);
256 printf(",AROS_UFCA(bt,bn,A6))\n");
257 printf("#define AROS_CALL%d%s __AROS_CALL%d%s\n", id
, nr(flags
), id
, nr(flags
));
260 static void aros_lvo_call(int id
, int flags
)
263 printf("#define __AROS_LVO_CALL%d%s(t,", id
, nr(flags
));
264 for (i
= 0; i
< id
; i
++)
265 printf("a%d,", i
+ 1);
266 printf("bt,bn,o,s) \\\n");
267 printf("\t__AROS_CALL%d%s(t,__AROS_GETVECADDR(bn,o), \\\n", id
, nr(flags
));
268 for (i
= 0; i
< id
; i
++)
269 printf("\t\tAROS_LCA(a%d), \\\n", i
+ 1);
270 printf("\t\tbt,bn)\n");
271 printf("#define AROS_LVO_CALL%d%s __AROS_LVO_CALL%d%s\n", id
, nr(flags
), id
, nr(flags
));
274 static void aros_ld(int id
, int is_ignored
)
278 printf("#define __AROS_LD%d%s(t,n,", id
, is_ignored
? "I" : "");
279 for (i
= 0; i
< id
; i
++)
280 printf("a%d,", i
+ 1);
281 printf("bt,bn,o,s) \\\n");
282 printf("\t__AROS_LD_PREFIX t AROS_SLIB_ENTRY(n,s,o) (void)\n");
283 printf("#define AROS_LD%d%s __AROS_LD%d%s\n", id
, is_ignored
? "I" : "", id
, is_ignored
? "I" : "");
286 static const char asmextra
[] =
287 "/* Get the register from a triplet */\n"
288 "#define __AROS_UFRA(type,name,reg) reg\n"
290 "/* Temporary variables */\n"
291 "#define __AROS_UFTA(type,name,reg) reg##_tmp\n"
293 "/* Get the register as a string from the triplet */\n"
294 "#define __AROS_UFSA(type,name,reg) \"%\"#reg\n"
297 static const char libextra
[] =
298 "/* Get the register from a triplet */\n"
299 "#define __AROS_LRA(type,name,reg) reg\n"
300 "#define __AROS_LRAQUAD1(type,name,reg1,reg2) reg1\n"
301 "#define __AROS_LRAQUAD2(type,name,reg1,reg2) reg2\n"
303 "/* Temporary variables */\n"
304 "#define __AROS_LTA(type,name,reg) reg##_tmp\n"
305 "#define __AROS_LTAQUAD(type,name,reg1,reg2) reg1##_##reg2##_tmp\n"
306 "#define __AROS_LTAQUAD1(type,name,reg1,reg2) reg1##_tmp\n"
307 "#define __AROS_LTAQUAD2(type,name,reg1,reg2) reg2##_tmp\n"
309 "/* Get the register as a string from the triplet */\n"
310 "#define __AROS_LSA(type,name,reg) \"%\"#reg\n"
311 "#define __AROS_LSAQUAD1(type,name,reg1,reg2) \"%\"#reg1\n"
312 "#define __AROS_LSAQUAD2(type,name,reg1,reg2) \"%\"#reg2\n"
314 "#define __AROS_LHQUAD1(t,n,q1,bt,bn,o,s) \\\n"
315 " __AROS_LH2(t,n, \\\n"
316 " AROS_LHA(ULONG, __AROS_LTAQUAD1(q1), __AROS_LRAQUAD1(q1)), \\\n"
317 " AROS_LHA(ULONG, __AROS_LTAQUAD2(q1), __AROS_LRAQUAD2(q1)), \\\n"
318 " bt, bn, o, s) \\\n"
320 " __AROS_LPAQUAD(q1) val; \\\n"
321 " ULONG reg[2]; \\\n"
322 " } __AROS_LTAQUAD(q1); \\\n"
323 " __AROS_LTAQUAD(q1).reg[0] = __AROS_LTAQUAD1(q1); \\\n"
324 " __AROS_LTAQUAD(q1).reg[1] = __AROS_LTAQUAD2(q1); \\\n"
325 " __AROS_LPAQUAD(q1) __attribute__((unused)) __AROS_LCAQUAD(q1) = __AROS_LTAQUAD(q1).val;\n"
327 "#define AROS_LHQUAD1 __AROS_LHQUAD1\n"
329 "#define __AROS_LHQUAD2(t,n,q1,q2,bt,bn,o,s) \\\n"
330 " __AROS_LH4(t,n, \\\n"
331 " AROS_LHA(ULONG, __AROS_LTAQUAD1(q1), __AROS_LRAQUAD1(q1)), \\\n"
332 " AROS_LHA(ULONG, __AROS_LTAQUAD2(q1), __AROS_LRAQUAD2(q1)), \\\n"
333 " AROS_LHA(ULONG, __AROS_LTAQUAD1(q2), __AROS_LRAQUAD1(q2)), \\\n"
334 " AROS_LHA(ULONG, __AROS_LTAQUAD2(q2), __AROS_LRAQUAD2(q2)), \\\n"
335 " bt, bn, o, s) \\\n"
337 " __AROS_LPAQUAD(q1) val; \\\n"
338 " ULONG reg[2]; \\\n"
339 " } __AROS_LTAQUAD(q1); \\\n"
341 " __AROS_LPAQUAD(q2) val; \\\n"
342 " ULONG reg[2]; \\\n"
343 " } __AROS_LTAQUAD(q2); \\\n"
344 " __AROS_LTAQUAD(q1).reg[0] = __AROS_LTAQUAD1(q1); \\\n"
345 " __AROS_LTAQUAD(q1).reg[1] = __AROS_LTAQUAD2(q1); \\\n"
346 " __AROS_LPAQUAD(q1) __attribute__((unused)) __AROS_LCAQUAD(q1) = __AROS_LTAQUAD(q1).val; \\\n"
347 " __AROS_LTAQUAD(q2).reg[0] = __AROS_LTAQUAD1(q2); \\\n"
348 " __AROS_LTAQUAD(q2).reg[1] = __AROS_LTAQUAD2(q2); \\\n"
349 " __AROS_LPAQUAD(q2) __attribute__((unused)) __AROS_LCAQUAD(q2) = __AROS_LTAQUAD(q2).val;\n"
351 "#define AROS_LHQUAD2 __AROS_LHQUAD2\n"
353 "#define __AROS_LH1QUAD2(t,n,a1,q1,q2,bt,bn,o,s) \\\n"
354 " __AROS_LH5(t,n, \\\n"
355 " AROS_LHA(a1), \\\n"
356 " AROS_LHA(ULONG, __AROS_LTAQUAD1(q1), __AROS_LRAQUAD1(q1)), \\\n"
357 " AROS_LHA(ULONG, __AROS_LTAQUAD2(q1), __AROS_LRAQUAD2(q1)), \\\n"
358 " AROS_LHA(ULONG, __AROS_LTAQUAD1(q2), __AROS_LRAQUAD1(q2)), \\\n"
359 " AROS_LHA(ULONG, __AROS_LTAQUAD2(q2), __AROS_LRAQUAD2(q2)), \\\n"
360 " bt, bn, o, s) \\\n"
362 " __AROS_LPAQUAD(q1) val; \\\n"
363 " ULONG reg[2]; \\\n"
364 " } __AROS_LTAQUAD(q1); \\\n"
366 " __AROS_LPAQUAD(q2) val; \\\n"
367 " ULONG reg[2]; \\\n"
368 " } __AROS_LTAQUAD(q2); \\\n"
369 " __AROS_LTAQUAD(q1).reg[0] = __AROS_LTAQUAD1(q1); \\\n"
370 " __AROS_LTAQUAD(q1).reg[1] = __AROS_LTAQUAD2(q1); \\\n"
371 " __AROS_LPAQUAD(q1) __attribute__((unused)) __AROS_LCAQUAD(q1) = __AROS_LTAQUAD(q1).val; \\\n"
372 " __AROS_LTAQUAD(q2).reg[0] = __AROS_LTAQUAD1(q2); \\\n"
373 " __AROS_LTAQUAD(q2).reg[1] = __AROS_LTAQUAD2(q2); \\\n"
374 " __AROS_LPAQUAD(q2) __attribute__((unused)) __AROS_LCAQUAD(q2) = __AROS_LTAQUAD(q2).val;\n"
376 "#define AROS_LH1QUAD2 __AROS_LH1QUAD2\n"
378 "#define __AROS_LH1QUAD1(t,n,a1,q1,bt,bn,o,s) \\\n"
379 " __AROS_LH3(t,n, \\\n"
380 " AROS_LHA(a1), \\\n"
381 " AROS_LHA(ULONG, __AROS_LTAQUAD1(q1), __AROS_LRAQUAD1(q1)), \\\n"
382 " AROS_LHA(ULONG, __AROS_LTAQUAD2(q1), __AROS_LRAQUAD2(q1)), \\\n"
383 " bt, bn, o, s) \\\n"
385 " __AROS_LPAQUAD(q1) val; \\\n"
386 " ULONG reg[2]; \\\n"
387 " } __AROS_LTAQUAD(q1); \\\n"
388 " __AROS_LTAQUAD(q1).reg[0] = __AROS_LTAQUAD1(q1); \\\n"
389 " __AROS_LTAQUAD(q1).reg[1] = __AROS_LTAQUAD2(q1); \\\n"
390 " __AROS_LPAQUAD(q1) __attribute__((unused)) __AROS_LCAQUAD(q1) = __AROS_LTAQUAD(q1).val;\n"
392 "#define AROS_LH1QUAD1 __AROS_LH1QUAD1\n"
394 "#define __AROS_LH2QUAD1(t,n,a1,a2,q1,bt,bn,o,s) \\\n"
395 " __AROS_LH4(t,n, \\\n"
396 " AROS_LHA(a1), \\\n"
397 " AROS_LHA(a2), \\\n"
398 " AROS_LHA(ULONG, __AROS_LTAQUAD1(q1), __AROS_LRAQUAD1(q1)), \\\n"
399 " AROS_LHA(ULONG, __AROS_LTAQUAD2(q1), __AROS_LRAQUAD2(q1)), \\\n"
400 " bt, bn, o, s) \\\n"
402 " __AROS_LPAQUAD(q1) val; \\\n"
403 " ULONG reg[2]; \\\n"
404 " } __AROS_LTAQUAD(q1); \\\n"
405 " __AROS_LTAQUAD(q1).reg[0] = __AROS_LTAQUAD1(q1); \\\n"
406 " __AROS_LTAQUAD(q1).reg[1] = __AROS_LTAQUAD2(q1); \\\n"
407 " __AROS_LPAQUAD(q1) __attribute__((unused)) __AROS_LCAQUAD(q1) = __AROS_LTAQUAD(q1).val;\n"
409 "#define AROS_LH2QUAD1 __AROS_LH2QUAD1\n"
411 "#define __AROS_LH3QUAD1(t,n,a1,a2,a3,q1,bt,bn,o,s) \\\n"
412 " __AROS_LH5(t,n, \\\n"
413 " AROS_LHA(a1), \\\n"
414 " AROS_LHA(a2), \\\n"
415 " AROS_LHA(a3), \\\n"
416 " AROS_LHA(ULONG, __AROS_LTAQUAD1(q1), __AROS_LRAQUAD1(q1)), \\\n"
417 " AROS_LHA(ULONG, __AROS_LTAQUAD2(q1), __AROS_LRAQUAD2(q1)), \\\n"
418 " bt, bn, o, s) \\\n"
420 " __AROS_LPAQUAD(q1) val; \\\n"
421 " ULONG reg[2]; \\\n"
422 " } __AROS_LTAQUAD(q1); \\\n"
423 " __AROS_LTAQUAD(q1).reg[0] = __AROS_LTAQUAD1(q1); \\\n"
424 " __AROS_LTAQUAD(q1).reg[1] = __AROS_LTAQUAD2(q1); \\\n"
425 " __AROS_LPAQUAD(q1) __attribute__((unused)) __AROS_LCAQUAD(q1) = __AROS_LTAQUAD(q1).val;\n"
427 "#define AROS_LH3QUAD1 __AROS_LH3QUAD1\n"
429 "#define __AROS_LCQUAD1(t,n,q1,bt,bn,o,s) \\\n"
432 " __AROS_LPAQUAD(q1) val; \\\n"
433 " ULONG reg[2]; \\\n"
434 " } _q1 = { .val = __AROS_LCAQUAD(q1) }; \\\n"
435 " __AROS_LC2##t(t, n, \\\n"
436 " AROS_LCA(ULONG, _q1.reg[0], __AROS_LRAQUAD1(q1)), \\\n"
437 " AROS_LCA(ULONG, _q1.reg[1], __AROS_LRAQUAD2(q1)), \\\n"
438 " bt, bn, o, s); \\\n"
441 "#define AROS_LCQUAD1 __AROS_LCQUAD1\n"
443 "#define __AROS_LCQUAD2(t,n,q1,q2,bt,bn,o,s) \\\n"
446 " __AROS_LPAQUAD(q1) val; \\\n"
447 " ULONG reg[2]; \\\n"
448 " } _q1 = { .val = __AROS_LCAQUAD(q1) }; \\\n"
450 " __AROS_LPAQUAD(q2) val; \\\n"
451 " ULONG reg[2]; \\\n"
452 " } _q2 = { .val = __AROS_LCAQUAD(q2) }; \\\n"
453 " __AROS_LC4##t(t, n, \\\n"
454 " AROS_LCA(ULONG, _q1.reg[0], __AROS_LRAQUAD1(q1)), \\\n"
455 " AROS_LCA(ULONG, _q1.reg[1], __AROS_LRAQUAD2(q1)), \\\n"
456 " AROS_LCA(ULONG, _q2.reg[0], __AROS_LRAQUAD1(q2)), \\\n"
457 " AROS_LCA(ULONG, _q2.reg[1], __AROS_LRAQUAD2(q2)), \\\n"
458 " bt, bn, o, s); \\\n"
461 "#define AROS_LCQUAD2 __AROS_LCQUAD2\n"
463 "#define __AROS_LC1QUAD1(t,n,a1,q1,bt,bn,o,s) \\\n"
466 " __AROS_LPAQUAD(q1) val; \\\n"
467 " ULONG reg[2]; \\\n"
468 " } _q1 = { .val = __AROS_LCAQUAD(q1) }; \\\n"
469 " __AROS_LC3##t(t, n, \\\n"
470 " AROS_LCA(a1), \\\n"
471 " AROS_LCA(ULONG, _q1.reg[0], __AROS_LRAQUAD1(q1)), \\\n"
472 " AROS_LCA(ULONG, _q1.reg[1], __AROS_LRAQUAD2(q1)), \\\n"
473 " bt, bn, o, s); \\\n"
476 "#define AROS_LC1QUAD1 __AROS_LC1QUAD1\n"
478 "#define __AROS_LC2QUAD1(t,n,a1,a2,q1,bt,bn,o,s) \\\n"
481 " __AROS_LPAQUAD(q1) val; \\\n"
482 " ULONG reg[2]; \\\n"
483 " } _q1 = { .val = __AROS_LCAQUAD(q1) }; \\\n"
484 " __AROS_LC4##t(t, n, \\\n"
485 " AROS_LCA(a1), \\\n"
486 " AROS_LCA(a2), \\\n"
487 " AROS_LCA(ULONG, _q1.reg[0], __AROS_LRAQUAD1(q1)), \\\n"
488 " AROS_LCA(ULONG, _q1.reg[1], __AROS_LRAQUAD2(q1)), \\\n"
489 " bt, bn, o, s); \\\n"
492 "#define AROS_LC2QUAD1 __AROS_LC2QUAD1\n"
494 "#define __AROS_LC3QUAD1(t,n,a1,a2,a3,q1,bt,bn,o,s) \\\n"
497 " __AROS_LPAQUAD(q1) val; \\\n"
498 " ULONG reg[2]; \\\n"
499 " } _q1 = { .val = __AROS_LCAQUAD(q1) }; \\\n"
500 " __AROS_LC5##t(t, n, \\\n"
501 " AROS_LCA(a1), \\\n"
502 " AROS_LCA(a2), \\\n"
503 " AROS_LCA(a3), \\\n"
504 " AROS_LCA(ULONG, _q1.reg[0], __AROS_LRAQUAD1(q1)), \\\n"
505 " AROS_LCA(ULONG, _q1.reg[1], __AROS_LRAQUAD2(q1)), \\\n"
506 " bt, bn, o, s); \\\n"
509 "#define AROS_LC3QUAD1 __AROS_LC3QUAD1\n"
511 "#define __AROS_LC2double __AROS_LC2D\n"
512 "#define __AROS_LC3double __AROS_LC3D\n"
513 "#define __AROS_LC4double __AROS_LC4D\n"
514 "#define __AROS_LC2LONG __AROS_LC2\n"
515 "#define __AROS_LC3LONG __AROS_LC3\n"
516 "#define __AROS_LC4LONG __AROS_LC4\n"
517 "#define __AROS_LC5LONG __AROS_LC5\n"
519 "# define AROS_LDQUAD1(t,n,q1,bt,bn,o,s) \\\n"
520 " __AROS_LD_PREFIX t AROS_SLIB_ENTRY(n,s,o) ( \\\n"
521 " __AROS_LDAQUAD(q1), __AROS_LD_BASE(bt,bn))\n"
522 "# define AROS_LDQUAD2(t,n,q1,q2,bt,bn,o,s) \\\n"
523 " __AROS_LD_PREFIX t AROS_SLIB_ENTRY(n,s,o) ( \\\n"
524 " __AROS_LDAQUAD(q1), \\\n"
525 " __AROS_LDAQUAD(q2),__AROS_LD_BASE(bt,bn))\n"
527 "#define AROS_LPQUAD1(t,n,q1,bt,bn,o,s) \\\n"
528 " t n (__AROS_LPAQUAD(q1))\n"
529 "#define AROS_LPQUAD2(t,n,q1,q2,bt,bn,o,s) \\\n"
530 " t n (__AROS_LPAQUAD(q1), __AROS_LPAQUAD(q2))\n"
533 int main(int argc
, char **argv
)
540 "Error in arguments\n"
541 "Usage: %s (asmcall|libcall)\n",
547 if (strcmp(argv
[1], "asmcall") == 0)
549 printf("/* AUTOGENERATED by arch/m68k-all/include/gencall.c */\n");
550 printf("/* If you can get this to work for anything other */\n");
551 printf("/* than gcc-4.5.1 m68k-elf, it would be surprising. */\n");
553 printf("#ifndef AROS_M68K_ASMCALL_H\n");
554 printf("#define AROS_M68K_ASMCALL_H\n");
557 printf("#define __AROS_CPU_SPECIFIC_ASMCALLS\n\n");
559 for (i
= 0; i
< GENCALL_MAX
; i
++)
562 for (i
= 0; i
< GENCALL_MAX
; i
++)
565 for (i
= 0; i
< GENCALL_MAX
; i
++)
568 for (i
= 0; i
< GENCALL_MAX
; i
++)
571 for (i
= 0; i
< GENCALL_MAX
; i
++)
574 for (i
= 0; i
< GENCALL_MAX
; i
++)
575 aros_ufc(i
, FLAG_NR
);
577 printf("\n%s\n", asmextra
);
579 printf("#endif /* AROS_M68K_ASMCALL_H */\n");
581 else if (strcmp(argv
[1], "libcall") == 0)
583 printf("/* AUTOGENERATED by arch/m68k-all/include/gencall.c */\n");
584 printf("/* If you can get this to work for anything other */\n");
585 printf("/* than gcc-4.5.1 m68k-elf, it would be surprising. */\n");
587 printf("#ifndef AROS_M68K_LIBCALL_H\n");
588 printf("#define AROS_M68K_LIBCALL_H\n");
590 printf("/* Call a libary function which requires the libbase */\n");
593 printf("#define __AROS_CPU_SPECIFIC_LP\n\n");
595 for (i
= 0; i
< GENCALL_MAX
; i
++)
598 for (i
= 0; i
< GENCALL_MAX
; i
++)
602 printf("#define __AROS_CPU_SPECIFIC_LH\n\n");
604 for (i
= 0; i
< GENCALL_MAX
; i
++)
607 for (i
= 0; i
< GENCALL_MAX
; i
++)
611 printf("#define __AROS_CPU_SPECIFIC_LC\n\n");
613 for (i
= 0; i
< GENCALL_MAX
; i
++) {
618 /* For double return AROS_LC2D..AROS_LC4D */
619 aros_lc(2, FLAG_DOUBLE
);
620 aros_lc(3, FLAG_DOUBLE
);
621 aros_lc(4, FLAG_DOUBLE
);
623 for (i
= 0; i
< GENCALL_MAX
; i
++) {
625 aros_call(i
, FLAG_NR
);
628 for (i
= 0; i
< GENCALL_MAX
; i
++)
631 for (i
= 0; i
< GENCALL_MAX
; i
++)
632 aros_lvo_call(i
, FLAG_NR
);
635 printf("#define __AROS_CPU_SPECIFIC_LD\n\n");
637 for (i
= 0; i
< GENCALL_MAX
; i
++)
640 for (i
= 0; i
< GENCALL_MAX
; i
++)
643 printf("\n%s\n", libextra
);
645 printf("#endif /* AROS_M68K_LIBCALL_H */\n");
650 "Error in arguments\n"
651 "Usage: %s (asmcall|libcall)\n",