5 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
8 NOTE: This file must compile *without* any other header !
10 Desc: machine.h include file for Linux/m68k (and others?)
14 /* We want register args, and LVOs */
15 #define UseRegisterArgs 1
16 #define EnableSetFunction 1
18 We want full AmigaOS compatibility. When calling obtainsemaphore,
19 obtainsemaphoreshared, releasesemaphore, getcc, permit, forbid,
20 enable, disable and getcc *all* Registers need to be preserved.
21 But due to the gnu c-compiler we only have to preserve d0,d1,a0,a1.
22 UseExecstubs has to be defined when UseRegisterArgs is used!
26 #define UseExecstubs 1
29 /* Linux/m68k gcc has no register args capabilities */
30 #define AROS_COMPILER_NO_REGARGS
32 /* Information generated by machine.c */
33 #define AROS_STACK_GROWS_DOWNWARDS 1 /* Stack direction */
34 #define AROS_BIG_ENDIAN 1 /* Big or little endian */
35 #define AROS_SIZEOFULONG 4 /* Size of an ULONG */
36 #define AROS_WORDALIGN 2 /* Alignment for WORD */
37 #define AROS_LONGALIGN 2 /* Alignment for LONG */
38 #define AROS_PTRALIGN 2 /* Alignment for PTR */
39 #define AROS_IPTRALIGN 2 /* Alignment for IPTR */
40 #define AROS_DOUBLEALIGN 2 /* Alignment for double */
41 #define AROS_WORSTALIGN 8 /* Worst case alignment */
43 #define AROS_GET_SYSBASE extern struct ExecBase * SysBase;
44 #define AROS_GET_DOSBASE extern struct DosLibrary * DOSBase;
45 #define AROS_GET_SYSBASE_OK extern struct ExecBase * SysBase;
47 /* do we need a function attribute to get parameters on the stack? */
50 register unsigned char * AROS_GET_SP
asm("%sp");
53 How much do I have to add to sp to get the address of the first
59 Retain binary compatibility with AmigaOS.
60 Comment this out if you want APTRs.
62 #define AROS_BSTR_TYPE long
63 #define AROS_BPTR_TYPE long
64 #define MKBADDR(a) (((LONG)(a)) >> 2)
65 #define BADDR(a) ((APTR)((ULONG)(a) << 2))
67 /* For debugging only: Pass errnos from the emulated OS. dos/Fault() will
69 #undef PassThroughErrnos
70 #define PassThroughErrnos 0x40000000
72 /* Linux/m68k seems to set bit 31 in all memory allocations, so
73 default AllocEntry() checking goes wrong. */
75 #define AROS_ALLOCENTRY_FAILED(memType) \
76 ((struct MemList *)NULL)
77 #define AROS_CHECK_ALLOCENTRY(memList) \
78 ((APTR)(memList) != NULL)
80 /* It works now because of a nice trick :) */
81 #define AROS_ALLOCENTRY_FAILED(memType) \
82 ((struct MemList *)((IPTR)(memType) | 0x80ul<<(sizeof(APTR)-1)*8))
83 #define AROS_CHECK_ALLOCENTRY(memList) \
84 (!((IPTR)(memList) & 0x80ul<<(sizeof(APTR)-1)*8))
88 One entry in a libraries' jumptable. For assembler compatibility, the
89 field jmp should contain the code for an absolute jmp to a 32bit
90 address. There are also a couple of macros which you should use to
91 access the vector table from C.
100 #define __AROS_ASMJMP 0x4EF9
101 #define __AROS_SET_VEC(v,a) (*(ULONG*)(v)->vec=(ULONG)(a))
103 #define __AROS_GET_VEC(v) ((APTR)(*(ULONG*)(v)->vec))
105 /* Use these to acces a vector table */
106 #define LIB_VECTSIZE (sizeof (struct JumpVec))
107 #define __AROS_GETJUMPVEC(lib,n) ((struct JumpVec *)(((UBYTE *)lib)-(n*LIB_VECTSIZE)))
108 #define __AROS_GETVECADDR(lib,n) (__AROS_GET_VEC(__AROS_GETJUMPVEC(lib,n)))
109 #define __AROS_SETVECADDR(lib,n,addr) (__AROS_SET_VEC(__AROS_GETJUMPVEC(lib,n),(APTR)(addr)))
110 #define __AROS_INITVEC(lib,n) __AROS_GETJUMPVEC(lib,n)->jmp = __AROS_ASMJMP, \
111 __AROS_SETVECADDR(lib,n,_aros_not_implemented)
114 Find the next valid alignment for a structure if the next x bytes must
117 #define AROS_ALIGN(x) (((x)+AROS_WORSTALIGN-1)&-AROS_WORSTALIGN)
120 extern void _aros_not_implemented (char *X
);
122 /* How much stack do we need ? Lots :-) */
123 #define AROS_STACKSIZE 20000
125 /* How to map function arguments to CPU registers */
144 /* What to do with the library base in header, prototype and call */
145 #define __AROS_LH_BASE(basetype,basename) basetype basename
146 #define __AROS_LP_BASE(basetype,basename) basetype
147 #define __AROS_LC_BASE(basetype,basename) basename
148 #define __AROS_LD_BASE(basetype,basename) basetype
150 /* How to transform an argument in header, prototype and call */
151 #define __AROS_LHA(type,name,reg) type name
152 #define __AROS_LPA(type,name,reg) type
153 #define __AROS_LCA(type,name,reg) name
154 #define __AROS_LDA(type,name,reg) type
155 #define __AROS_UFHA(type,name,reg) type name
156 #define __AROS_UFPA(type,name,reg) type
157 #define __AROS_UFCA(type,name,reg) name
158 #define __AROS_UFDA(type,name,reg) type
159 #define __AROS_LHAQUAD(type,name,reg1,reg2) type name
160 #define __AROS_LPAQUAD(type,name,reg1,reg2) type
161 #define __AROS_LCAQUAD(type,name,reg1,reg2) name
163 /* Prefix for library function in header, prototype and call */
164 #define __AROS_LH_PREFIX /* eps */
165 #define __AROS_LP_PREFIX /* eps */
166 #define __AROS_LC_PREFIX /* eps */
167 #define __AROS_LD_PREFIX /* eps */
168 #define __AROS_UFH_PREFIX /* eps */
169 #define __AROS_UFP_PREFIX /* eps */
170 #define __AROS_UFC_PREFIX /* eps */
171 #define __AROS_UFD_PREFIX /* eps */
173 /* if this is defined, all AROS_LP*-macros will expand to nothing. */
174 #define __AROS_USE_MACROS_FOR_LIBCALL
177 /* We need to redefine all the macros for use with Linux/m68k gcc */
179 #define AROS_SLIB_ENTRY_S(n,s) #s "_" #n
181 #define AROS_SLIB_ENTRY_U(n,s) _ ## s ## _ ## n
183 #define __ASM_PREFIX(name,system) \
184 __asm__(".text\n\t.align 2\n\t"\
185 ".globl "## AROS_SLIB_ENTRY_S(name,system) ##"\n\t"\
186 ".type\t"## AROS_SLIB_ENTRY_S(name,system) ##",@function\n"\
187 AROS_SLIB_ENTRY_S(name,system) ##":\n\t"\
188 "move.l %a6,-(%sp)\n\t"
191 #define __ASM_PREFIXI(name,system) \
192 __asm__(".text\n\t.align 2\n\t"\
193 ".globl "## AROS_SLIB_ENTRY_S(name,system) ##"\n\t"\
194 ".type\t"## AROS_SLIB_ENTRY_S(name,system) ##",@function\n"\
195 AROS_SLIB_ENTRY_S(name,system) ##":\n\t"
198 #define __ASM_ARG(type, name, reg) \
199 "move.l "## reg ##",-(%sp)\n\t"
201 #define __ASM_ARGQUAD1(type, name, reg1, reg2) \
202 "move.l "## reg2 ##",-(%sp)\n\t"
203 #define __ASM_ARGQUAD2(type, name, reg1, reg2) \
204 "move.l "## reg1 ##",-(%sp)\n\t"
207 #define __ASM_POSTFIX(type,name,system,argc) \
208 "bsr.l _"## AROS_SLIB_ENTRY_S(name,system) ##"@PLTPC\n\t"\
209 "add.w #4*" #argc "+4,%sp\n\t"\
211 ".size "## AROS_SLIB_ENTRY_S(name,system) ##",.-"\
212 ## AROS_SLIB_ENTRY_S(name,system) );\
213 __AROS_LH_PREFIX static type AROS_SLIB_ENTRY(name,_##system)(
215 #define __ASM_POSTFIX(type,name,system,argc) \
216 "jbsr _"## AROS_SLIB_ENTRY_S(name,system) ##"\n\t"\
217 "add.w #4*" #argc "+4,%sp\n\t"\
219 ".size "## AROS_SLIB_ENTRY_S(name,system) ##",.-"\
220 ## AROS_SLIB_ENTRY_S(name,system) );\
221 __AROS_LH_PREFIX static type AROS_SLIB_ENTRY(name,_##system)(
225 #define __ASM_POSTFIXI(type,name,system,argc) \
226 "bsr.l _"## AROS_SLIB_ENTRY_S(name,system) ##"@PLTPC\n\t"\
227 "add.w #4*" #argc ",%sp\n\t"\
229 ".size "## AROS_SLIB_ENTRY_S(name,system) ##",.-"\
230 ## AROS_SLIB_ENTRY_S(name,system) );\
231 __AROS_LH_PREFIX static type AROS_SLIB_ENTRY(name,_##system)(
233 #define __ASM_POSTFIXI(type,name,system,argc) \
234 "jbsr _"## AROS_SLIB_ENTRY_S(name,system) ##"\n\t"\
235 "add.w #4*" #argc ",%sp\n\t"\
237 ".size "## AROS_SLIB_ENTRY_S(name,system) ##",.-"\
238 ## AROS_SLIB_ENTRY_S(name,system) );\
239 __AROS_LH_PREFIX static type AROS_SLIB_ENTRY(name,_##system)(
242 #define AROS_LHQUAD1(t,n,a1,bt,bn,o,s) \
243 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
245 __AROS_LP_BASE(bt,bn)) __attribute__((unused));\
249 __ASM_POSTFIX(t,n,s,2)\
251 __AROS_LH_BASE(bt,bn))
253 #define AROS_LHQUAD2(t,n,a1,a2,bt,bn,o,s) \
254 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
257 __AROS_LP_BASE(bt,bn)) __attribute__((unused));\
263 __ASM_POSTFIX(t,n,s,4)\
266 __AROS_LH_BASE(bt,bn))
268 #define AROS_LH0(t,n,bt,bn,o,s) \
269 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
270 __AROS_LP_BASE(bt,bn)) __attribute__((unused));\
272 __ASM_POSTFIX(t,n,s,0)\
273 __AROS_LH_BASE(bt,bn))
275 #define AROS_LH1(t,n,a1,bt,bn,o,s) \
276 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
278 __AROS_LP_BASE(bt,bn)) __attribute__((unused));\
281 __ASM_POSTFIX(t,n,s,1)\
283 __AROS_LH_BASE(bt,bn))
285 #define AROS_LH2(t,n,a1,a2,bt,bn,o,s) \
286 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
289 __AROS_LP_BASE(bt,bn)) __attribute__((unused));\
293 __ASM_POSTFIX(t,n,s,2)\
296 __AROS_LH_BASE(bt,bn))
298 #define AROS_LH3(t,n,a1,a2,a3,bt,bn,o,s) \
299 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
303 __AROS_LP_BASE(bt,bn)) __attribute__((unused));\
308 __ASM_POSTFIX(t,n,s,3)\
312 __AROS_LH_BASE(bt,bn))
314 #define AROS_LH4(t,n,a1,a2,a3,a4,bt,bn,o,s) \
315 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
320 __AROS_LP_BASE(bt,bn)) __attribute__((unused));\
326 __ASM_POSTFIX(t,n,s,4)\
331 __AROS_LH_BASE(bt,bn))
333 #define AROS_LH5(t,n,a1,a2,a3,a4,a5,bt,bn,o,s) \
334 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
340 __AROS_LP_BASE(bt,bn)) __attribute__((unused));\
347 __ASM_POSTFIX(t,n,s,5)\
353 __AROS_LH_BASE(bt,bn))
355 #define AROS_LH6(t,n,a1,a2,a3,a4,a5,a6,bt,bn,o,s) \
356 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
363 __AROS_LP_BASE(bt,bn)) __attribute__((unused));\
371 __ASM_POSTFIX(t,n,s,6)\
378 __AROS_LH_BASE(bt,bn))
380 #define AROS_LH7(t,n,a1,a2,a3,a4,a5,a6,a7,bt,bn,o,s) \
381 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
389 __AROS_LP_BASE(bt,bn)) __attribute__((unused));\
398 __ASM_POSTFIX(t,n,s,7)\
406 __AROS_LH_BASE(bt,bn))
408 #define AROS_LH8(t,n,a1,a2,a3,a4,a5,a6,a7,a8,bt,bn,o,s) \
409 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
418 __AROS_LP_BASE(bt,bn)) __attribute__((unused));\
428 __ASM_POSTFIX(t,n,s,8)\
437 __AROS_LH_BASE(bt,bn))
439 #define AROS_LH9(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,bt,bn,o,s) \
440 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
450 __AROS_LP_BASE(bt,bn)) __attribute__((unused));\
461 __ASM_POSTFIX(t,n,s,9)\
471 __AROS_LH_BASE(bt,bn))
473 #define AROS_LH10(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,bt,bn,o,s) \
474 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
485 __AROS_LP_BASE(bt,bn)) __attribute__((unused));\
497 __ASM_POSTFIX(t,n,s,10)\
508 __AROS_LH_BASE(bt,bn))
510 #define AROS_LH11(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,bt,bn,o,s) \
511 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
523 __AROS_LP_BASE(bt,bn)) __attribute__((unused));\
536 __ASM_POSTFIX(t,n,s,11)\
548 __AROS_LH_BASE(bt,bn))
550 #define AROS_LH12(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,bt,bn,o,s) \
551 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
564 __AROS_LP_BASE(bt,bn)) __attribute__((unused));\
578 __ASM_POSTFIX(t,n,s,12)\
591 __AROS_LH_BASE(bt,bn))
593 #define AROS_LH13(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,bt,bn,o,s) \
594 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
608 __AROS_LP_BASE(bt,bn)) __attribute__((unused));\
623 __ASM_POSTFIX(t,n,s,13)\
637 __AROS_LH_BASE(bt,bn))
639 #define AROS_LH14(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,bt,bn,o,s) \
640 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
655 __AROS_LP_BASE(bt,bn)) __attribute__((unused));\
671 __ASM_POSTFIX(t,n,s,14)\
686 __AROS_LH_BASE(bt,bn))
688 #define AROS_LH15(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,bt,bn,o,s) \
689 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
705 __AROS_LP_BASE(bt,bn)) __attribute__((unused));\
722 __ASM_POSTFIX(t,n,s,15)\
738 __AROS_LH_BASE(bt,bn))
740 /* Library functions which don't need the libbase */
741 #define AROS_LH0I(t,n,bt,bn,o,s) \
742 __AROS_LH_PREFIX t AROS_SLIB_ENTRY(n,s)(void)
744 #define AROS_LH1I(t,n,a1,bt,bn,o,s) \
745 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
746 __AROS_LPA(a1)) __attribute__((unused));\
749 __ASM_POSTFIXI(t,n,s,1)\
752 #define AROS_LH2I(t,n,a1,a2,bt,bn,o,s) \
753 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
755 __AROS_LPA(a2)) __attribute__((unused));\
759 __ASM_POSTFIXI(t,n,s,2)\
763 #define AROS_LH3I(t,n,a1,a2,a3,bt,bn,o,s) \
764 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
767 __AROS_LPA(a3)) __attribute__((unused));\
772 __ASM_POSTFIXI(t,n,s,3)\
777 #define AROS_LH4I(t,n,a1,a2,a3,a4,bt,bn,o,s) \
778 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
782 __AROS_LPA(a4)) __attribute__((unused));\
788 __ASM_POSTFIXI(t,n,s,4)\
794 #define AROS_LH5I(t,n,a1,a2,a3,a4,a5,bt,bn,o,s) \
795 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
800 __AROS_LPA(a5)) __attribute__((unused));\
807 __ASM_POSTFIXI(t,n,s,5)\
814 #define AROS_LH6I(t,n,a1,a2,a3,a4,a5,a6,bt,bn,o,s) \
815 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
821 __AROS_LPA(a6)) __attribute__((unused));\
829 __ASM_POSTFIXI(t,n,s,6)\
837 #define AROS_LH7I(t,n,a1,a2,a3,a4,a5,a6,a7,bt,bn,o,s) \
838 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
845 __AROS_LPA(a7)) __attribute__((unused));\
854 __ASM_POSTFIXI(t,n,s,7)\
863 #define AROS_LH8I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,bt,bn,o,s) \
864 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
872 __AROS_LPA(a8)) __attribute__((unused));\
882 __ASM_POSTFIXI(t,n,s,8)\
892 #define AROS_LH9I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,bt,bn,o,s) \
893 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
902 __AROS_LPA(a9)) __attribute__((unused));\
913 __ASM_POSTFIXI(t,n,s,9)\
924 #define AROS_LH10I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,bt,bn,o,s) \
925 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
935 __AROS_LPA(a10)) __attribute__((unused));\
947 __ASM_POSTFIXI(t,n,s,10)\
959 #define AROS_LH11I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,bt,bn,o,s) \
960 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
971 __AROS_LPA(a11)) __attribute__((unused));\
984 __ASM_POSTFIXI(t,n,s,11)\
997 #define AROS_LH12I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,bt,bn,o,s) \
998 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
1010 __AROS_LPA(a12)) __attribute__((unused));\
1024 __ASM_POSTFIXI(t,n,s,12)\
1038 #define AROS_LH13I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,bt,bn,o,s) \
1039 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
1052 __AROS_LPA(a13)) __attribute__((unused));\
1067 __ASM_POSTFIXI(t,n,s,13)\
1082 #define AROS_LH14I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,bt,bn,o,s) \
1083 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
1097 __AROS_LPA(a14)) __attribute__((unused));\
1113 __ASM_POSTFIXI(t,n,s,14)\
1129 #define AROS_LH15I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,bt,bn,o,s) \
1130 __AROS_LP_PREFIX static t AROS_SLIB_ENTRY_U(n,s)(\
1145 __AROS_LPA(a15)) __attribute__((unused));\
1162 __ASM_POSTFIXI(t,n,s,15)\
1181 Taken from an old version of AROS:
1182 This is one way to call a function with registerized parameters and gcc:
1183 I build a define that defines normal function calls into one of those
1184 LC0()-Makros for expansion directly into the source code.
1186 They work as follows:
1187 First I copy the arguments of the function into normal variables.
1188 Second I copy those variables into the appropriate registers.
1189 (I cannot write them directly into those registers because this locks
1190 the register and one of the arguments may be a function call that needs it.)
1191 Third I call the assembler function with registers as arguments.
1192 Fourth I return the result. (The casting of the long is necessary to make
1195 Prototype stylish Macros are also possible (using __inline functions instead
1196 of defines) but they need more system ressources to compile, more complicated
1197 Makefiles (gcc cannot inline without optimization) and cannot use local
1201 /****************************************************/
1202 #define __LC0(type,name,basetype,basename,offset,system) \
1205 long _##name##_re; \
1206 __asm __volatile("move.l %%a6,-(%%sp)\n\t" \
1207 "move.l %1,%%a6\n\t" \
1208 "jsr %%a6@(-6*"#offset":W)\n\t" \
1209 "move.l (%%sp)+,%%a6\n\t" \
1211 :"=g"(_##name##_re) \
1213 :D0,D1,A0,A1,"memory","cc"); \
1214 (type)_##name##_re; \
1218 #define __LC1(t,n,t1,n1,r1,bt,bn,o,s) \
1220 t1 _##n##_n1 = (n1); \
1223 register t1 _n1 __asm(r1) = _##n##_n1; \
1224 __asm __volatile("move.l %%a6,-(%%sp)\n\t" \
1225 "move.l %1,%%a6\n\t" \
1226 "jsr %%a6@(-6*"#o":W)\n\t" \
1227 "move.l (%%sp)+,%%a6\n\t" \
1230 :"g"(bn), "r"(_n1) \
1231 :A0,A1,D0,D1,"memory","cc"); \
1236 #define __LC2(t,name,t1,n1,r1,t2,n2,r2,bt,bn,o,s) \
1238 t1 _##name##_n1 = (n1); \
1239 t2 _##name##_n2 = (n2); \
1241 long _##name##_re; \
1242 register t1 _n1 __asm(r1) = _##name##_n1; \
1243 register t2 _n2 __asm(r2) = _##name##_n2; \
1244 __asm __volatile("move.l %%a6,-(%%sp)\n\t" \
1245 "move.l %1,%%a6\n\t" \
1246 "jsr %%a6@(-6*"#o":W)\n\t" \
1247 "move.l (%%sp)+,%%a6\n\t" \
1249 :"=g"(_##name##_re) \
1250 :"g"(bn), "r"(_n1), "r"(_n2) \
1251 :D0,D1,A0,A1,"memory","cc"); \
1256 #define __LC3(t,name,t1,n1,r1,t2,n2,r2,t3,n3,r3,bt,bn,o,s) \
1258 t1 _##name##_n1 = (n1); \
1259 t2 _##name##_n2 = (n2); \
1260 t3 _##name##_n3 = (n3); \
1262 long _##name##_re; \
1263 register t1 _n1 __asm(r1) = _##name##_n1; \
1264 register t2 _n2 __asm(r2) = _##name##_n2; \
1265 register t3 _n3 __asm(r3) = _##name##_n3; \
1266 __asm __volatile("move.l %%a6,-(%%sp)\n\t" \
1267 "move.l %1,%%a6\n\t" \
1268 "jsr %%a6@(-6*"#o":W)\n\t" \
1269 "move.l (%%sp)+,%%a6\n\t" \
1271 :"=g"(_##name##_re) \
1272 :"g"(bn), "r"(_n1), "r"(_n2), "r"(_n3) \
1273 :A0,A1,D0,D1,"memory","cc"); \
1278 #define __LC4(t,name,t1,n1,r1,t2,n2,r2,t3,n3,r3,t4,n4,r4,bt,bn,o,s) \
1280 t1 _##name##_n1 = (n1); \
1281 t2 _##name##_n2 = (n2); \
1282 t3 _##name##_n3 = (n3); \
1283 t4 _##name##_n4 = (n4); \
1285 long _##name##_re; \
1286 register t1 _n1 __asm(r1) = _##name##_n1; \
1287 register t2 _n2 __asm(r2) = _##name##_n2; \
1288 register t3 _n3 __asm(r3) = _##name##_n3; \
1289 register t4 _n4 __asm(r4) = _##name##_n4; \
1290 __asm __volatile("move.l %%a6,-(%%sp)\n\t" \
1291 "move.l %1,%%a6\n\t" \
1292 "jsr %%a6@(-6*"#o":W)\n\t" \
1293 "move.l (%%sp)+,%%a6\n\t" \
1295 :"=g"(_##name##_re) \
1296 :"g"(bn), "r"(_n1), "r"(_n2), "r"(_n3), \
1298 :A0,A1,D0,D1,"memory","cc"); \
1303 #define __LC5(t,name,t1,n1,r1,t2,n2,r2,t3,n3,r3,t4,n4,r4,t5,n5,r5,bt,bn,o,s) \
1305 t1 _##name##_n1 = (n1); \
1306 t2 _##name##_n2 = (n2); \
1307 t3 _##name##_n3 = (n3); \
1308 t4 _##name##_n4 = (n4); \
1309 t5 _##name##_n5 = (n5); \
1311 long _##name##_re; \
1312 register t1 _n1 __asm(r1) = _##name##_n1; \
1313 register t2 _n2 __asm(r2) = _##name##_n2; \
1314 register t3 _n3 __asm(r3) = _##name##_n3; \
1315 register t4 _n4 __asm(r4) = _##name##_n4; \
1316 register t5 _n5 __asm(r5) = _##name##_n5; \
1317 __asm __volatile("move.l %%a6,-(%%sp)\n\t" \
1318 "move.l %1,%%a6\n\t" \
1319 "jsr %%a6@(-6*"#o":W)\n\t" \
1320 "move.l (%%sp)+,%%a6\n\t" \
1322 :"=g"(_##name##_re) \
1323 :"g"(bn), "r"(_n1), "r"(_n2), "r"(_n3), \
1324 "r"(_n4), "r"(_n5) \
1325 :A0,A1,D0,D1,"memory","cc"); \
1330 #define __LC6(t,name,t1,n1,r1,t2,n2,r2,t3,n3,r3,t4,n4,r4,t5,n5,r5,t6,n6,r6,bt,bn,o,s) \
1332 t1 _##name##_n1 = (n1); \
1333 t2 _##name##_n2 = (n2); \
1334 t3 _##name##_n3 = (n3); \
1335 t4 _##name##_n4 = (n4); \
1336 t5 _##name##_n5 = (n5); \
1337 t6 _##name##_n6 = (n6); \
1339 long _##name##_re; \
1340 register t1 _n1 __asm(r1) = _##name##_n1; \
1341 register t2 _n2 __asm(r2) = _##name##_n2; \
1342 register t3 _n3 __asm(r3) = _##name##_n3; \
1343 register t4 _n4 __asm(r4) = _##name##_n4; \
1344 register t5 _n5 __asm(r5) = _##name##_n5; \
1345 register t6 _n6 __asm(r6) = _##name##_n6; \
1346 __asm __volatile("move.l %%a6,-(%%sp)\n\t" \
1347 "move.l %1,%%a6\n\t" \
1348 "jsr %%a6@(-6*"#o":W)\n\t" \
1349 "move.l (%%sp)+,%%a6\n\t" \
1351 :"=g"(_##name##_re) \
1352 :"g"(bn), "r"(_n1), "r"(_n2), "r"(_n3), \
1353 "r"(_n4), "r"(_n5), "r"(_n6) \
1354 :A0,A1,D0,D1,"memory","cc"); \
1359 #define __LC7(t,name,t1,n1,r1,t2,n2,r2,t3,n3,r3,t4,n4,r4,t5,n5,r5,t6,n6,r6,t7,n7,r7,bt,bn,o,s) \
1361 t1 _##name##_n1 = (n1); \
1362 t2 _##name##_n2 = (n2); \
1363 t3 _##name##_n3 = (n3); \
1364 t4 _##name##_n4 = (n4); \
1365 t5 _##name##_n5 = (n5); \
1366 t6 _##name##_n6 = (n6); \
1367 t7 _##name##_n7 = (n7); \
1369 long _##name##_re; \
1370 register t1 _n1 __asm(r1) = _##name##_n1; \
1371 register t2 _n2 __asm(r2) = _##name##_n2; \
1372 register t3 _n3 __asm(r3) = _##name##_n3; \
1373 register t4 _n4 __asm(r4) = _##name##_n4; \
1374 register t5 _n5 __asm(r5) = _##name##_n5; \
1375 register t6 _n6 __asm(r6) = _##name##_n6; \
1376 register t7 _n7 __asm(r7) = _##name##_n7; \
1377 __asm __volatile("move.l %%a6,-(%%sp)\n\t" \
1378 "move.l %1,%%a6\n\t" \
1379 "jsr %%a6@(-6*"#o":W)\n\t" \
1380 "move.l (%%sp)+,%%a6\n\t" \
1382 :"=g"(_##name##_re) \
1383 :"g"(bn), "r"(_n1), "r"(_n2), "r"(_n3), \
1384 "r"(_n4), "r"(_n5), "r"(_n6), "r"(_n7) \
1385 :A0,A1,D0,D1,"memory","cc"); \
1390 #define __LC8(t,name,t1,n1,r1,t2,n2,r2,t3,n3,r3,t4,n4,r4,t5,n5,r5,t6,n6,r6,t7,n7,r7,t8,n8,r8,bt,bn,o,s) \
1392 t1 _##name##_n1 = (n1); \
1393 t2 _##name##_n2 = (n2); \
1394 t3 _##name##_n3 = (n3); \
1395 t4 _##name##_n4 = (n4); \
1396 t5 _##name##_n5 = (n5); \
1397 t6 _##name##_n6 = (n6); \
1398 t7 _##name##_n7 = (n7); \
1399 t8 _##name##_n8 = (n8); \
1401 long _##name##_re; \
1402 register t1 _n1 __asm(r1) = _##name##_n1; \
1403 register t2 _n2 __asm(r2) = _##name##_n2; \
1404 register t3 _n3 __asm(r3) = _##name##_n3; \
1405 register t4 _n4 __asm(r4) = _##name##_n4; \
1406 register t5 _n5 __asm(r5) = _##name##_n5; \
1407 register t6 _n6 __asm(r6) = _##name##_n6; \
1408 register t7 _n7 __asm(r7) = _##name##_n7; \
1409 register t8 _n8 __asm(r8) = _##name##_n8; \
1410 __asm __volatile("move.l %%a6,-(%%sp)\n\t" \
1411 "move.l %1,%%a6\n\t" \
1412 "jsr %%a6@(-6*"#o":W)\n\t" \
1413 "move.l (%%sp)+,%%a6\n\t" \
1415 :"=g"(_##name##_re) \
1416 :"g"(bn), "r"(_n1), "r"(_n2), "r"(_n3), \
1417 "r"(_n4), "r"(_n5), "r"(_n6), "r"(_n7),\
1419 :A0,A1,D0,D1,"memory","cc"); \
1424 #define __LC9(t,name,t1,n1,r1,t2,n2,r2,t3,n3,r3,t4,n4,r4,t5,n5,r5,t6,n6,r6,t7,n7,r7,t8,n8,r8,t9,n9,r9,bt,bn,o,s) \
1426 t1 _##name##_n1 = (n1); \
1427 t2 _##name##_n2 = (n2); \
1428 t3 _##name##_n3 = (n3); \
1429 t4 _##name##_n4 = (n4); \
1430 t5 _##name##_n5 = (n5); \
1431 t6 _##name##_n6 = (n6); \
1432 t7 _##name##_n7 = (n7); \
1433 t8 _##name##_n8 = (n8); \
1434 t9 _##name##_n9 = (n9); \
1436 long _##name##_re; \
1437 register t1 _n1 __asm(r1) = _##name##_n1; \
1438 register t2 _n2 __asm(r2) = _##name##_n2; \
1439 register t3 _n3 __asm(r3) = _##name##_n3; \
1440 register t4 _n4 __asm(r4) = _##name##_n4; \
1441 register t5 _n5 __asm(r5) = _##name##_n5; \
1442 register t6 _n6 __asm(r6) = _##name##_n6; \
1443 register t7 _n7 __asm(r7) = _##name##_n7; \
1444 register t8 _n8 __asm(r8) = _##name##_n8; \
1445 register t9 _n9 __asm(r9) = _##name##_n9; \
1446 __asm __volatile("move.l %%a6,-(%%sp)\n\t" \
1447 "move.l %1,%%a6\n\t" \
1448 "jsr %%a6@(-6*"#o":W)\n\t" \
1449 "move.l (%%sp)+,%%a6" \
1450 :"=g"(_##name##_re) \
1451 :"g"(bn), "r"(_n1), "r"(_n2), "r"(_n3), \
1452 "r"(_n4), "r"(_n5), "r"(_n6), "r"(_n7),\
1453 "r"(_n8), "r"(_n9) \
1454 :A0,A1,D0,D1,"memory","cc"); \
1459 #define __LC10(t,name,t1,n1,r1,t2,n2,r2,t3,n3,r3,t4,n4,r4,t5,n5,r5,t6,n6,r6,t7,n7,r7,t8,n8,r8,t9,n9,r9,t10,n10,r10,bt,bn,o,s) \
1461 t1 _##name##_n1 = (n1); \
1462 t2 _##name##_n2 = (n2); \
1463 t3 _##name##_n3 = (n3); \
1464 t4 _##name##_n4 = (n4); \
1465 t5 _##name##_n5 = (n5); \
1466 t6 _##name##_n6 = (n6); \
1467 t7 _##name##_n7 = (n7); \
1468 t8 _##name##_n8 = (n8); \
1469 t9 _##name##_n9 = (n9); \
1470 t10 _##name##_n10 = (n10); \
1472 long _##name##_re; \
1473 register t1 _n1 __asm(r1) = _##name##_n1; \
1474 register t2 _n2 __asm(r2) = _##name##_n2; \
1475 register t3 _n3 __asm(r3) = _##name##_n3; \
1476 register t4 _n4 __asm(r4) = _##name##_n4; \
1477 register t5 _n5 __asm(r5) = _##name##_n5; \
1478 register t6 _n6 __asm(r6) = _##name##_n6; \
1479 register t7 _n7 __asm(r7) = _##name##_n7; \
1480 register t8 _n8 __asm(r8) = _##name##_n8; \
1481 register t9 _n9 __asm(r9) = _##name##_n9; \
1482 register t10 _n10 __asm(r10) = _##name##_n10; \
1483 __asm __volatile("move.l %%a6,-(%%sp)\n\t" \
1484 "move.l %1,%%a6\n\t" \
1485 "jsr %%a6@(-6*"#o":W)\n\t" \
1486 "move.l (%%sp)+,%%a6" \
1487 :"=g"(_##name##_re) \
1488 :"g"(bn), "r"(_n1), "r"(_n2), "r"(_n3), \
1489 "r"(_n4), "r"(_n5), "r"(_n6), "r"(_n7),\
1490 "r"(_n8), "r"(_n9), "r"(_n10) \
1491 :A0,A1,D0,D1,"memory","cc"); \
1496 #define __LC11(t,name,t1,n1,r1,t2,n2,r2,t3,n3,r3,t4,n4,r4,t5,n5,r5,t6,n6,r6,t7,n7,r7,t8,n8,r8,t9,n9,r9,t10,n10,r10,t11,n11,r11,bt,bn,o,s) \
1498 t1 _##name##_n1 = (n1); \
1499 t2 _##name##_n2 = (n2); \
1500 t3 _##name##_n3 = (n3); \
1501 t4 _##name##_n4 = (n4); \
1502 t5 _##name##_n5 = (n5); \
1503 t6 _##name##_n6 = (n6); \
1504 t7 _##name##_n7 = (n7); \
1505 t8 _##name##_n8 = (n8); \
1506 t9 _##name##_n9 = (n9); \
1507 t10 _##name##_n10 = (n10); \
1508 t11 _##name##_n11 = (n11); \
1510 long _##name##_re; \
1511 register t1 _n1 __asm(r1) = _##name##_n1; \
1512 register t2 _n2 __asm(r2) = _##name##_n2; \
1513 register t3 _n3 __asm(r3) = _##name##_n3; \
1514 register t4 _n4 __asm(r4) = _##name##_n4; \
1515 register t5 _n5 __asm(r5) = _##name##_n5; \
1516 register t6 _n6 __asm(r6) = _##name##_n6; \
1517 register t7 _n7 __asm(r7) = _##name##_n7; \
1518 register t8 _n8 __asm(r8) = _##name##_n8; \
1519 register t9 _n9 __asm(r9) = _##name##_n9; \
1520 register t10 _n10 __asm(r10) = _##name##_n10; \
1521 register t11 _n11 __asm(r11) = _##name##_n11; \
1522 __asm __volatile("move.l %%a6,-(%%sp)\n\t" \
1523 "move.l %1,%%a6\n\t" \
1524 "jsr %%a6@(-6*"#o":W)\n\t" \
1525 "move.l (%%sp)+,%%a6" \
1526 :"=g"(_##name##_re) \
1527 :"g"(bn), "r"(_n1), "r"(_n2), "r"(_n3), \
1528 "r"(_n4), "r"(_n5), "r"(_n6), "r"(_n7),\
1529 "r"(_n8), "r"(_n9), "r"(_n10), \
1531 :A0,A1,D0,D1,"memory","cc"); \
1536 /****************************************************/
1538 #define __LCQUAD1(t,n,t1,n1,r11,r12,bt,bn,o,s) \
1540 t1 _##n##_n1 = (n1); \
1543 register t1 _n1 __asm(r11) = _##n##_n1; \
1544 __asm __volatile("move.l %%a6,-(%%sp)\n\t" \
1545 "move.l %2,%%a6\n\t" \
1546 "jsr %%a6@(-6*"#o":W)\n\t" \
1547 "move.l (%%sp)+,%%a6\n\t" \
1548 "movem.l %%d0-%%d1,%0\n\t" \
1551 :A0,A1,D0,D1,"memory","cc"); \
1556 #define __LCQUAD2(t,name,t1,n1,r11,r12,t2,n2,r21,r22,bt,bn,o,s) \
1558 t1 _##name##_n1 = (n1); \
1559 t2 _##name##_n2 = (n2); \
1562 register t1 _n1 __asm(r11) = _##name##_n1; \
1563 register t2 _n2 __asm(r21) = _##name##_n2; \
1564 __asm __volatile("move.l %%a6,-(%%sp)\n\t" \
1565 "move.l %3,%%a6\n\t" \
1566 "jsr %%a6@(-6*"#o":W)\n\t" \
1567 "move.l (%%sp)+,%%a6\n\t" \
1568 "movem.l %%d0-%%d1,%0\n\t" \
1569 :"=m"(_##name##_re) \
1570 :"r"(_n1),"r"(_n2),"g"(bn) \
1571 :D0,D1,A0,A1,"memory","cc"); \
1576 /****************************************************/
1577 #define AROS_LCQUAD1(t,n,a1,bt,bn,o,s) __LCQUAD1(t,n,a1,bt,bn,o,s)
1578 #define AROS_LCQUAD2(t,n,a1,a2,bt,bn,o,s) __LCQUAD2(t,n,a1,a2,bt,bn,o,s)
1580 #define AROS_LC0(t,n,bt,bn,o,s) __LC0(t,n,bt,bn,o,s)
1581 #define AROS_LC0I(t,n,bt,bn,o,s) __LC0(t,n,bt,bn,o,s)
1582 #define AROS_LC1(t,n,a1,bt,bn,o,s) __LC1(t,n,a1,bt,bn,o,s)
1583 #define AROS_LC1I(t,n,a1,bt,bn,o,s) __LC1(t,n,a1,bt,bn,o,s)
1584 #define AROS_LC2(t,n,a1,a2,bt,bn,o,s) __LC2(t,n,a1,a2,bt,bn,o,s)
1585 #define AROS_LC2I(t,n,a1,a2,bt,bn,o,s) __LC2(t,n,a1,a2,bt,bn,o,s)
1586 #define AROS_LC3(t,n,a1,a2,a3,bt,bn,o,s) __LC3(t,n,a1,a2,a3,bt,bn,o,s)
1587 #define AROS_LC3I(t,n,a1,a2,a3,bt,bn,o,s) __LC3(t,n,a1,a2,a3,bt,bn,o,s)
1588 #define AROS_LC4(t,n,a1,a2,a3,a4,bt,bn,o,s) __LC4(t,n,a1,a2,a3,a4,bt,bn,o,s)
1589 #define AROS_LC4I(t,n,a1,a2,a3,a4,bt,bn,o,s) __LC4(t,n,a1,a2,a3,a4,bt,bn,o,s)
1590 #define AROS_LC5(t,n,a1,a2,a3,a4,a5,bt,bn,o,s) __LC5(t,n,a1,a2,a3,a4,a5,bt,bn,o,s)
1591 #define AROS_LC5I(t,n,a1,a2,a3,a4,a5,bt,bn,o,s) __LC5(t,n,a1,a2,a3,a4,a5,bt,bn,o,s)
1592 #define AROS_LC6(t,n,a1,a2,a3,a4,a5,a6,bt,bn,o,s) \
1593 __LC6(t,n,a1,a2,a3,a4,a5,a6,bt,bn,o,s)
1594 #define AROS_LC6I(t,n,a1,a2,a3,a4,a5,a6,bt,bn,o,s) \
1595 __LC6(t,n,a1,a2,a3,a4,a5,a6,bt,bn,o,s)
1596 #define AROS_LC7(t,n,a1,a2,a3,a4,a5,a6,a7,bt,bn,o,s) \
1597 __LC7(t,n,a1,a2,a3,a4,a5,a6,a7,bt,bn,o,s)
1598 #define AROS_LC7I(t,n,a1,a2,a3,a4,a5,a6,a7,bt,bn,o,s) \
1599 __LC7(t,n,a1,a2,a3,a4,a5,a6,a7,bt,bn,o,s)
1600 #define AROS_LC8(t,n,a1,a2,a3,a4,a5,a6,a7,a8,bt,bn,o,s) \
1601 __LC8(t,n,a1,a2,a3,a4,a5,a6,a7,a8,bt,bn,o,s)
1602 #define AROS_LC8I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,bt,bn,o,s) \
1603 __LC8(t,n,a1,a2,a3,a4,a5,a6,a7,a8,bt,bn,o,s)
1605 #define AROS_LC9(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,bt,bn,o,s) \
1606 __LC9(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,bt,bn,o,s)
1607 #define AROS_LC9I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,bt,bn,o,s) \
1608 __LC9(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,bt,bn,o,s)
1609 #define AROS_LC10(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,bt,bn,o,s) \
1610 __LC10(t,n,a1,a2,a3,a4,a5,a7,a7,a8,a9,a10,bt,bn,o,s)
1611 #define AROS_LC10I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,bt,bn,o,s) \
1612 __LC10(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,bt,bn,o,s)
1613 #define AROS_LC11(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,bt,bn,o,s) \
1614 __LC11(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,bt,bn,o,s)
1615 #define AROS_LC11I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,bt,bn,o,s) \
1616 __LC11(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,bt,bn,o,s)
1620 /* AROS_LC9 and higher just don't work with gcc. gcc complains
1621 about too many registers being used. So we have to fall back
1622 to stubs for this kind of calls.
1624 #define AROS_LC9(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,bt,bn,o,s) \
1635 __AROS_LC_BASE(bt,bn))
1637 #define AROS_LC10(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,bt,bn,o,s) \
1649 __AROS_LC_BASE(bt,bn))
1651 #define AROS_LC11(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,bt,bn,o,s) \
1664 __AROS_LC_BASE(bt,bn))
1667 #define AROS_LVO_CALL0(returntype,basetype,basename,offset,system) \
1668 __LC0(returntype,,basetype,basename,offset,system)
1670 #define AROS_LVO_CALL1(t,a1,bt,bn,o,s) \
1671 __LC1(t,,a1,bt,bn,o,s)
1673 #define AROS_LVO_CALL1NR(a1,bt,bn,o,s) \
1674 __LC1(void,,a1,bt,bn,o,s)
1676 #define AROS_LVO_CALL2(t,a1,a2,bt,bn,o,s) \
1677 __LC2(t,,a1,a2,bt,bn,o,s)
1679 #define AROS_LVO_CALL3(t,a1,a2,a3,bt,bn,o,s) \
1680 __LC3(t,,a1,a2,a3,bt,bn,o,s)
1682 #define AROS_LVO_CALL3NR(a1,a2,a3,bt,bn,o,s) \
1683 __LC3(void,,a1,a2,a3,bt,bn,o,s)
1685 #define AROS_LVO_CALL4(t,a1,a2,a3,a4,bt,bn,o,s) \
1686 __LC4(t,,a1,a2,a3,a4,bt,bn,o,s)
1688 /*****************************************************************/
1690 /* Macros for user functions */
1692 #define AROS_UF_ENTRY_U(n) _ ## n
1694 #define __ASM_PREFIX_U(name) \
1695 __asm__(".text\n\t.align 2\n"\
1696 ".globl " #name "\n\t"\
1697 ".type\t" #name ",@function\n"\
1700 #define __ASM_PREFIX_US(name) \
1701 __asm__(".text\n\t.align 2\n\t"\
1702 ".type\t" #name ",@function\n"\
1706 #define __ASM_POSTFIX_U(type,name,argc) \
1707 "bsr.l _" #name "@PLTPC\n\t"\
1708 "add.w #4*" #argc ",%sp\n\t"\
1710 ".size " #name ",.-" #name);\
1711 __AROS_UFH_PREFIX static type _##name (
1713 #define __ASM_POSTFIX_U(type,name,argc) \
1714 "jbsr _" #name "\n\t"\
1715 "add.w #4*" #argc ",%sp\n\t"\
1717 ".size " #name ",.-" #name);\
1718 __AROS_UFH_PREFIX static type _##name (
1721 /* Function headers for user functions */
1723 #define AROS_UFH0(t,n) \
1726 #define AROS_UFH1(t,n,a1) \
1728 __AROS_UFP_PREFIX static t AROS_UF_ENTRY_U(n)(\
1729 __AROS_UFPA(a1)) __attribute__((unused));\
1732 __ASM_POSTFIX_U(t,n,1)\
1735 #define AROS_UFH2(t,n,a1,a2) \
1737 __AROS_UFP_PREFIX static t AROS_UF_ENTRY_U(n)(\
1739 __AROS_UFPA(a2)) __attribute__((unused));\
1743 __ASM_POSTFIX_U(t,n,2)\
1747 #define AROS_UFH3(t,n,a1,a2,a3) \
1749 __AROS_UFP_PREFIX static t AROS_UF_ENTRY_U(n)(\
1752 __AROS_UFPA(a3)) __attribute__((unused));\
1757 __ASM_POSTFIX_U(t,n,3)\
1762 #define AROS_UFH3S(t,n,a1,a2,a3) \
1764 __AROS_UFP_PREFIX static t AROS_UF_ENTRY_U(n)(\
1767 __AROS_UFPA(a3)) __attribute__((unused));\
1772 __ASM_POSTFIX_U(t,n,3)\
1777 #define AROS_UFH4(t,n,a1,a2,a3,a4) \
1779 __AROS_UFP_PREFIX static t AROS_UF_ENTRY_U(n)(\
1783 __AROS_UFPA(a4)) __attribute__((unused));\
1789 __ASM_POSTFIX_U(t,n,4)\
1795 #define AROS_UFH5(t,n,a1,a2,a3,a4,a5) \
1797 __AROS_UFP_PREFIX static t AROS_UF_ENTRY_U(n)(\
1802 __AROS_UFPA(a5)) __attribute__((unused));\
1809 __ASM_POSTFIX_U(t,n,5)\
1816 #define AROS_UFH5S(t,n,a1,a2,a3,a4,a5) \
1818 __AROS_UFP_PREFIX static t AROS_UF_ENTRY_U(n)(\
1823 __AROS_UFPA(a5)) __attribute__((unused));\
1830 __ASM_POSTFIX_U(t,n,5)\
1837 #define AROS_UFH6(t,n,a1,a2,a3,a4,a5,a6) \
1839 __AROS_UFP_PREFIX static t AROS_UF_ENTRY_U(n)(\
1845 __AROS_UFPA(a6)) __attribute__((unused));\
1853 __ASM_POSTFIX_U(t,n,6)\
1861 #define AROS_UFH7(t,n,a1,a2,a3,a4,a5,a6,a7) \
1863 __AROS_UFP_PREFIX static t AROS_UF_ENTRY_U(n)(\
1870 __AROS_UFPA(a7)) __attribute__((unused));\
1879 __ASM_POSTFIX_U(t,n,7)\
1888 #define AROS_UFH8(t,n,a1,a2,a3,a4,a5,a6,a7,a8) \
1890 __AROS_UFP_PREFIX static t AROS_UF_ENTRY_U(n)(\
1898 __AROS_UFPA(a8)) __attribute__((unused));\
1908 __ASM_POSTFIX_U(t,n,8)\
1918 #define AROS_UFH9(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9) \
1920 __AROS_UFP_PREFIX static t AROS_UF_ENTRY_U(n)(\
1929 __AROS_UFPA(a9)) __attribute__((unused));\
1940 __ASM_POSTFIX_U(t,n,9)\
1951 #define AROS_UFH10(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) \
1953 __AROS_UFP_PREFIX static t AROS_UF_ENTRY_U(n)(\
1963 __AROS_UFPA(a10)) __attribute__((unused));\
1975 __ASM_POSTFIX_U(t,n,10)\
1987 #define AROS_UFH11(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) \
1989 __AROS_UFP_PREFIX static t AROS_UF_ENTRY_U(n)(\
2000 __AROS_UFPA(a11)) __attribute__((unused));\
2013 __ASM_POSTFIX_U(t,n,11)\
2026 #define AROS_UFH12(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12) \
2028 __AROS_UFP_PREFIX static t AROS_UF_ENTRY_U(n)(\
2040 __AROS_UFPA(a12)) __attribute__((unused));\
2054 __ASM_POSTFIX_U(t,n,12)\
2068 #define AROS_UFH13(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13) \
2070 __AROS_UFP_PREFIX static t AROS_UF_ENTRY_U(n)(\
2083 __AROS_UFPA(a13)) __attribute__((unused));\
2098 __ASM_POSTFIX_U(t,n,13)\
2113 #define AROS_UFH14(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14) \
2115 __AROS_UFP_PREFIX static t AROS_UF_ENTRY_U(n)(\
2129 __AROS_UFPA(a14)) __attribute__((unused));\
2145 __ASM_POSTFIX_U(t,n,14)\
2161 #define AROS_UFH15(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15) \
2163 __AROS_UFP_PREFIX static t AROS_UF_ENTRY_U(n)(\
2178 __AROS_UFPA(a15)) __attribute__((unused));\
2195 __ASM_POSTFIX_U(t,n,15)\
2212 /* Call a user function */
2214 #define AROS_UFC0(t,n) \
2215 (((__AROS_UFC_PREFIX t(*)(void))n)())
2216 #define __UFC1(t,n,t1,n1,r1) \
2218 long _n1 = (long)(n1);\
2220 __asm__ __volatile__(\
2221 "move.l %%a5,-(%%sp)\n\t"\
2222 "move.l %%a6,-(%%sp)\n\t"\
2223 "move.l %2,%"##r1##"\n\t"\
2225 "move.l (%%sp)+,%%a6\n\t"\
2226 "move.l (%%sp)+,%%a5\n\t"\
2230 :A0,A1,D0,D1,r1,"cc","memory");\
2233 #define AROS_UFC1(t,n,a1) __UFC1(t,n,a1)
2234 #define __UFC2(t,n,t1,n1,r1,t2,n2,r2) \
2236 long _n1 = (long)(n1);\
2237 long _n2 = (long)(n2);\
2239 __asm__ __volatile__(\
2240 "move.l %%a5,-(%%sp)\n\t"\
2241 "move.l %%a6,-(%%sp)\n\t"\
2242 "move.l %2,%"##r1##"\n\t"\
2243 "move.l %3,%"##r2##"\n\t"\
2245 "move.l (%%sp)+,%%a6\n\t"\
2246 "move.l (%%sp)+,%%a5\n\t"\
2249 :"ad"(n),"g"(_n1),"g"(_n2)\
2250 :A0,A1,D0,D1,r1,r2,"cc","memory");\
2253 #define AROS_UFC2(t,n,a1,a2) __UFC2(t,n,a1,a2)
2254 #define __UFC3(t,n,t1,n1,r1,t2,n2,r2,t3,n3,r3) \
2256 long _n1 = (long)(n1);\
2257 long _n2 = (long)(n2);\
2258 long _n3 = (long)(n3);\
2260 __asm__ __volatile__(\
2261 "move.l %%a5,-(%%sp)\n\t"\
2262 "move.l %%a6,-(%%sp)\n\t"\
2263 "move.l %2,%"##r1##"\n\t"\
2264 "move.l %3,%"##r2##"\n\t"\
2265 "move.l %4,%"##r3##"\n\t"\
2267 "move.l (%%sp)+,%%a6\n\t"\
2268 "move.l (%%sp)+,%%a5\n\t"\
2271 :"ad"(n),"g"(_n1),"g"(_n2),"g"(_n3)\
2272 :A0,A1,D0,D1,r1,r2,r3,"cc","memory");\
2275 #define AROS_UFC3(t,n,a1,a2,a3) __UFC3(t,n,a1,a2,a3)
2276 #define __UFC3R(t,n,t1,n1,r1,t2,n2,r2,t3,n3,r3,p,ss) \
2278 long _n1 = (long)(n1);\
2279 long _n2 = (long)(n2);\
2280 long _n3 = (long)(n3);\
2282 __asm__ __volatile__(\
2283 "movem.l %%d2-%%d7/%%a2-%%a6,-(%%sp)\n\t"\
2284 "move.l %3,%"##r1##"\n\t"\
2285 "move.l %4,%"##r2##"\n\t"\
2286 "move.l %5,%"##r3##"\n\t"\
2287 "move.l %%sp,-(%%sp)\n\t"\
2288 "move.l %6,-(%%sp)\n\t"\
2289 "move.l %%sp,%1\n\t"\
2291 "movea.l 4(%%sp),%%sp\n\t"\
2292 "movem.l (%%sp)+,%%d2-%%d7/%%a2-%%a6\n\t"\
2294 :"=g"(_re),"=m"(*(APTR *)p)\
2295 :"ad"(n),"g"(_n1),"g"(_n2),"g"(_n3),"g"(ss)\
2296 :A0,A1,D0,D1,r1,r2,r3,"cc","memory");\
2299 #define AROS_UFC3R(t,n,a1,a2,a3,p,ss) __UFC3R(t,n,a1,a2,a3,p,ss)
2300 #define __UFC4(t,n,t1,n1,r1,t2,n2,r2,t3,n3,r3,t4,n4,r4) \
2302 long _n1 = (long)(n1);\
2303 long _n2 = (long)(n2);\
2304 long _n3 = (long)(n3);\
2305 long _n4 = (long)(n4);\
2307 __asm__ __volatile__(\
2308 "move.l %%a5,-(%%sp)\n\t"\
2309 "move.l %%a6,-(%%sp)\n\t"\
2310 "move.l %2,%"##r1##"\n\t"\
2311 "move.l %3,%"##r2##"\n\t"\
2312 "move.l %4,%"##r3##"\n\t"\
2313 "move.l %5,%"##r4##"\n\t"\
2315 "move.l (%%sp)+,%%a6\n\t"\
2316 "move.l (%%sp)+,%%a5\n\t"\
2319 :"ad"(n),"g"(_n1),"g"(_n2),"g"(_n3),\
2321 :A0,A1,D0,D1,r1,r2,r3,r4,"cc","memory");\
2324 #define AROS_UFC4(t,n,a1,a2,a3,a4) __UFC4(t,n,a1,a2,a3,a4)
2325 #define __UFC5(t,n,t1,n1,r1,t2,n2,r2,t3,n3,r3,t4,n4,r4,t5,n5,r5) \
2327 long _n1 = (long)(n1);\
2328 long _n2 = (long)(n2);\
2329 long _n3 = (long)(n3);\
2330 long _n4 = (long)(n4);\
2331 long _n5 = (long)(n5);\
2333 __asm__ __volatile__(\
2334 "move.l %%a5,-(%%sp)\n\t"\
2335 "move.l %%a6,-(%%sp)\n\t"\
2336 "move.l %2,%"##r1##"\n\t"\
2337 "move.l %3,%"##r2##"\n\t"\
2338 "move.l %4,%"##r3##"\n\t"\
2339 "move.l %5,%"##r4##"\n\t"\
2340 "move.l %6,%"##r5##"\n\t"\
2342 "move.l (%%sp)+,%%a6\n\t"\
2343 "move.l (%%sp)+,%%a5\n\t"\
2346 :"ad"(n),"g"(_n1),"g"(_n2),"g"(_n3),\
2348 :A0,A1,D0,D1,r1,r2,r3,r4,r5,"cc","memory");\
2351 #define AROS_UFC5(t,n,a1,a2,a3,a4,a5) __UFC5(t,n,a1,a2,a3,a4,a5)
2353 #else /* UseRegisterArgs */
2355 #define AROS_UFC3R(t,n,a1,a2,a3,p,ss) \
2356 (((__AROS_UFC_PREFIX t(*)(\
2366 #endif /* UseRegisterArgs */
2368 #endif /* AROS_MACHINE_H */