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!
24 #ifdef UseRegisterArgs
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))
68 One entry in a libraries' jumptable. For assembler compatibility, the
69 field jmp should contain the code for an absolute jmp to a 32bit
70 address. There are also a couple of macros which you should use to
71 access the vector table from C.
80 #define __AROS_ASMJMP 0x4EF9
81 #define __AROS_SET_VEC(v,a) (*(ULONG*)(v)->vec=(ULONG)(a))
84 #define __AROS_GET_VEC(v) ((APTR)(*(ULONG*)(v)->vec)+2)
86 #define __AROS_GET_VEC(v) ((APTR)(*(ULONG*)(v)->vec))
89 /* Use these to acces a vector table */
90 #define LIB_VECTSIZE (sizeof (struct JumpVec))
91 #define __AROS_GETJUMPVEC(lib,n) ((struct JumpVec *)(((UBYTE *)lib)-(n*LIB_VECTSIZE)))
92 #define __AROS_GETVECADDR(lib,n) (__AROS_GET_VEC(__AROS_GETJUMPVEC(lib,n)))
93 #define __AROS_SETVECADDR(lib,n,addr) (__AROS_SET_VEC(__AROS_GETJUMPVEC(lib,n),(APTR)(addr)))
94 #define __AROS_INITVEC(lib,n) __AROS_GETJUMPVEC(lib,n)->jmp = __AROS_ASMJMP, \
95 __AROS_SETVECADDR(lib,n,_aros_not_implemented)
98 Find the next valid alignment for a structure if the next x bytes must
101 #define AROS_ALIGN(x) (((x)+AROS_WORSTALIGN-1)&-AROS_WORSTALIGN)
104 extern void _aros_not_implemented (void);
106 /* How much stack do we need ? Lots :-) */
107 #define AROS_STACKSIZE 100000
110 /* How to map function arguments to CPU registers */
127 #define A6 "%a6" /* This will only work with m68k-linux-gcc when
128 compiling with -O0 and -fomit-frame-pointer */
131 /* What to do with the library base in header, prototype and call */
132 #define __AROS_LH_BASE(basetype,basename) basetype basename
133 #define __AROS_LP_BASE(basetype,basename) void *
134 #define __AROS_LC_BASE(basetype,basename) basename
136 /* How to transform an argument in header, prototype and call */
137 #define __AROS_LHA(type,name,reg) type name
138 #define __AROS_LPA(type,name,reg) type
139 #define __AROS_LCA(type,name,reg) name
140 #define __AROS_UFHA(type,name,reg) type name
141 #define __AROS_UFPA(type,name,reg) type
142 #define __AROS_UFCA(type,name,reg) name
144 /* Prefix for library function in header, prototype and call */
145 #define __AROS_LH_PREFIX /* eps */
146 #define __AROS_LP_PREFIX /* eps */
147 #define __AROS_LC_PREFIX /* eps */
148 #define __AROS_UFH_PREFIX /* eps */
149 #define __AROS_UFP_PREFIX /* eps */
150 #define __AROS_UFC_PREFIX /* eps */
152 /* if this is defined, all AROS_LP*-macros will expand to nothing. */
153 #define __AROS_USE_MACROS_FOR_LIBCALL
156 /* We need to redefine all the macros for use with Linux/m68k gcc */
158 #define AROS_SLIB_ENTRY_S(n,s) #s "_" #n
160 #define __ASM_PREFIX(name,system) \
161 __asm__(".text\n\t.balign 16\n\t"\
162 ".globl "## AROS_SLIB_ENTRY_S(name,system) ##"\n\t"\
163 ".type "## AROS_SLIB_ENTRY_S(name,system) ##",@function\n"\
164 AROS_SLIB_ENTRY_S(name,system) ##":\n\t"\
165 "jbra .AmigaSWInit"## AROS_SLIB_ENTRY_S(name,system) ##"\n\t"\
166 "jbra _"## AROS_SLIB_ENTRY_S(name,system) ##"\n"\
167 ".AmigaSWInit"## AROS_SLIB_ENTRY_S(name,system) ##":\n\t"\
168 "move.l %a6,-(%sp)\n\t"
171 #define __ASM_PREFIXI(name,system) \
172 __asm__(".text\n\t.balign 16\n\t"\
173 ".globl "## AROS_SLIB_ENTRY_S(name,system) ##"\n\t"\
174 ".type "## AROS_SLIB_ENTRY_S(name,system) ##",@function\n"\
175 AROS_SLIB_ENTRY_S(name,system) ##":\n\t"\
176 "jbra .AmigaSWInit"## AROS_SLIB_ENTRY_S(name,system) ##"\n\t"\
177 "jbra _"## AROS_SLIB_ENTRY_S(name,system) ##"\n"\
178 ".AmigaSWInit"## AROS_SLIB_ENTRY_S(name,system) ##":\n\t"\
182 #define __ASM_ARG(type, name, reg) \
183 "move.l "## reg ##",-(%sp)\n\t"
185 #define __ASM_POSTFIX(type,name,system,argc) \
186 "jsr _"## AROS_SLIB_ENTRY_S(name,system) ##"\n\t"\
187 "add.w #4*" #argc "+4,%sp\n\t"\
189 ".size "## AROS_SLIB_ENTRY_S(name,system) ##",.-"\
190 ## AROS_SLIB_ENTRY_S(name,system) );\
191 __AROS_LH_PREFIX type AROS_SLIB_ENTRY(name,_##system)(
194 #define __ASM_POSTFIXI(type,name,system,argc) \
195 "jsr _"## AROS_SLIB_ENTRY_S(name,system) ##"\n\t"\
196 "add.w #4*" #argc ",%sp\n\t"\
198 ".size "## AROS_SLIB_ENTRY_S(name,system) ##",.-"\
199 ## AROS_SLIB_ENTRY_S(name,system) );\
200 __AROS_LH_PREFIX type AROS_SLIB_ENTRY(name,_##system)(
203 #define AROS_LH0(t,n,bt,bn,o,s) \
205 __ASM_POSTFIX(t,n,s,0)\
206 __AROS_LH_BASE(bt,bn))
208 #define AROS_LH1(t,n,a1,bt,bn,o,s) \
211 __ASM_POSTFIX(t,n,s,1)\
213 __AROS_LH_BASE(bt,bn))
215 #define AROS_LH2(t,n,a1,a2,bt,bn,o,s) \
219 __ASM_POSTFIX(t,n,s,2)\
222 __AROS_LH_BASE(bt,bn))
224 #define AROS_LH3(t,n,a1,a2,a3,bt,bn,o,s) \
229 __ASM_POSTFIX(t,n,s,3)\
233 __AROS_LH_BASE(bt,bn))
235 #define AROS_LH4(t,n,a1,a2,a3,a4,bt,bn,o,s) \
241 __ASM_POSTFIX(t,n,s,4)\
246 __AROS_LH_BASE(bt,bn))
248 #define AROS_LH5(t,n,a1,a2,a3,a4,a5,bt,bn,o,s) \
255 __ASM_POSTFIX(t,n,s,5)\
261 __AROS_LH_BASE(bt,bn))
263 #define AROS_LH6(t,n,a1,a2,a3,a4,a5,a6,bt,bn,o,s) \
271 __ASM_POSTFIX(t,n,s,6)\
278 __AROS_LH_BASE(bt,bn))
280 #define AROS_LH7(t,n,a1,a2,a3,a4,a5,a6,a7,bt,bn,o,s) \
289 __ASM_POSTFIX(t,n,s,7)\
297 __AROS_LH_BASE(bt,bn))
299 #define AROS_LH8(t,n,a1,a2,a3,a4,a5,a6,a7,a8,bt,bn,o,s) \
309 __ASM_POSTFIX(t,n,s,8)\
318 __AROS_LH_BASE(bt,bn))
320 #define AROS_LH9(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,bt,bn,o,s) \
331 __ASM_POSTFIX(t,n,s,9)\
341 __AROS_LH_BASE(bt,bn))
343 #define AROS_LH10(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,bt,bn,o,s) \
355 __ASM_POSTFIX(t,n,s,10)\
366 __AROS_LH_BASE(bt,bn))
368 #define AROS_LH11(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,bt,bn,o,s) \
381 __ASM_POSTFIX(t,n,s,11)\
393 __AROS_LH_BASE(bt,bn))
395 #define AROS_LH12(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,bt,bn,o,s) \
409 __ASM_POSTFIX(t,n,s,12)\
422 __AROS_LH_BASE(bt,bn))
424 #define AROS_LH13(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,bt,bn,o,s) \
439 __ASM_POSTFIX(t,n,s,13)\
453 __AROS_LH_BASE(bt,bn))
455 #define AROS_LH14(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,bt,bn,o,s) \
471 __ASM_POSTFIX(t,n,s,14)\
486 __AROS_LH_BASE(bt,bn))
488 #define AROS_LH15(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,bt,bn,o,s) \
505 __ASM_POSTFIX(t,n,s,15)\
521 __AROS_LH_BASE(bt,bn))
523 /* Library functions which don't need the libbase */
524 #define AROS_LH0I(t,n,bt,bn,o,s) \
525 __AROS_LH_PREFIX t AROS_SLIB_ENTRY(n,s)(void)
527 #define AROS_LH1I(t,n,a1,bt,bn,o,s) \
530 __ASM_POSTFIXI(t,n,s,1)\
533 #define AROS_LH2I(t,n,a1,a2,bt,bn,o,s) \
537 __ASM_POSTFIXI(t,n,s,2)\
541 #define AROS_LH3I(t,n,a1,a2,a3,bt,bn,o,s) \
546 __ASM_POSTFIXI(t,n,s,3)\
551 #define AROS_LH4I(t,n,a1,a2,a3,a4,bt,bn,o,s) \
557 __ASM_POSTFIXI(t,n,s,4)\
563 #define AROS_LH5I(t,n,a1,a2,a3,a4,a5,bt,bn,o,s) \
570 __ASM_POSTFIXI(t,n,s,5)\
577 #define AROS_LH6I(t,n,a1,a2,a3,a4,a5,a6,bt,bn,o,s) \
585 __ASM_POSTFIXI(t,n,s,6)\
593 #define AROS_LH7I(t,n,a1,a2,a3,a4,a5,a6,a7,bt,bn,o,s) \
602 __ASM_POSTFIXI(t,n,s,7)\
611 #define AROS_LH8I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,bt,bn,o,s) \
621 __ASM_POSTFIXI(t,n,s,8)\
631 #define AROS_LH9I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,bt,bn,o,s) \
642 __ASM_POSTFIXI(t,n,s,9)\
653 #define AROS_LH10I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,bt,bn,o,s) \
665 __ASM_POSTFIXI(t,n,s,10)\
677 #define AROS_LH11I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,bt,bn,o,s) \
690 __ASM_POSTFIXI(t,n,s,11)\
703 #define AROS_LH12I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,bt,bn,o,s) \
717 __ASM_POSTFIXI(t,n,s,12)\
731 #define AROS_LH13I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,bt,bn,o,s) \
746 __ASM_POSTFIXI(t,n,s,13)\
761 #define AROS_LH14I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,bt,bn,o,s) \
777 __ASM_POSTFIXI(t,n,s,14)\
793 #define AROS_LH15I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,bt,bn,o,s) \
810 __ASM_POSTFIXI(t,n,s,15)\
828 This stuff does NOT work, but I leave it there anyway.
830 Taken from an old version of AROS:
831 This is one way to call a function with registerized parameters and gcc:
832 I build a define that defines normal function calls into one of those
833 LC0()-Makros for expansion directly into the source code.
835 They work as follows:
836 First I copy the arguments of the function into normal variables.
837 Second I copy those variables into the appropriate registers.
838 (I cannot write them directly into those registers because this locks
839 the register and one of the arguments may be a function call that needs it.)
840 Third I call the assembler function with registers as arguments.
841 Fourth I return the result. (The casting of the long is necessary to make
844 Prototype stylish Macros are also possible (using __inline functions instead
845 of defines) but they need more system ressources to compile, more complicated
846 Makefiles (gcc cannot inline without optimization) and cannot use local
850 /****************************************************
851 #define __LC0(type,name,basetype,basename,offset,system) \
854 register long __d0 __asm(D0); \
855 __asm __volatile("move.l %%a6,-(%%sp)\n\t" \
856 "move.l %1,%%a6\n\t" \
857 "jsr %%a6@(-6*"#offset":W)\n\t" \
858 "move.l (%%sp)+,%%a6" \
861 :D0,D1,A0,A1,"memory","cc"); \
866 #define __LC1(t,n,t1,n1,r1,bt,bn,o,s) \
870 register long __d0 __asm(D0); \
871 register long ___n1 __asm(r1) = (long)__n1; \
872 __asm __volatile("move.l %%a6,-(%%sp)\n\t" \
873 "move.l %2,%%a6\n\t" \
874 "jsr %%a6@(-6*"#o":W)\n\t" \
875 "move.l (%%sp)+,%%a6" \
877 :"r"(___n1),"r"(bn) \
878 :A0,A1,D0,D1,"memory","cc"); \
883 #define __LC2(t,n,t1,n1,r1,t2,n2,r2,bt,bn,o,s) \
888 register long __d0 __asm(D0); \
889 register long ___n1 __asm(r1) = (long)__n1; \
890 register long ___n2 __asm(r2) = (long)__n2; \
891 __asm __volatile("move.l %%a6,-(%%sp)\n\t" \
892 "move.l %1,%%a6\n\t" \
893 "jsr %%a6@(-6*"#o":W)\n\t" \
894 "move.l (%%sp)+,%%a6" \
896 :"r"(bn),"r"(___n1),"r"(___n2) \
897 :D0,D1,A0,A1,"memory","cc"); \
902 #define __LC3(t,n,t1,n1,r1,t2,n2,r2,t3,n3,r3,bt,bn,o,s) \
908 register long __d0 __asm(D0); \
909 register long ___n1 __asm(r1) = (long)__n1; \
910 register long ___n2 __asm(r2) = (long)__n2; \
911 register long ___n3 __asm(r3) = (long)__n3; \
912 __asm __volatile("move.l %%a6,-(%%sp)\n\t" \
913 "move.l %4,%%a6\n\t" \
914 "jsr %%a6@(-6*"#o":W)\n\t" \
915 "move.l (%%sp)+,%%a6" \
917 :"r"(___n1),"r"(___n2),"r"(___n3), \
919 :A0,A1,D0,D1,"memory","cc"); \
924 #define __LC4(t,n,t1,n1,r1,t2,n2,r2,t3,n3,r3,t4,n4,r4,bt,bn,o,s) \
931 register long __d0 __asm(D0); \
932 register long ___n1 __asm(r1) = (long)__n1; \
933 register long ___n2 __asm(r2) = (long)__n2; \
934 register long ___n3 __asm(r3) = (long)__n3; \
935 register long ___n4 __asm(r4) = (long)__n4; \
936 __asm __volatile("move.l %%a6,-(%%sp)\n\t" \
937 "move.l %5,%%a6\n\t" \
938 "jsr %%a6@(-6*"#o":W)\n\t" \
939 "move.l (%%sp)+,%%a6" \
941 :"r"(___n1),"r"(___n2),"r"(___n3), \
943 :A0,A1,D0,D1,"memory","cc"); \
948 #define __LC5(t,n,t1,n1,r1,t2,n2,r2,t3,n3,r3,t4,n4,r4,t5,n5,r5,bt,bn,o,s) \
956 register long __d0 __asm(D0); \
957 register long ___n1 __asm(r1) = (long)__n1; \
958 register long ___n2 __asm(r2) = (long)__n2; \
959 register long ___n3 __asm(r3) = (long)__n3; \
960 register long ___n4 __asm(r4) = (long)__n4; \
961 register long ___n5 __asm(r5) = (long)__n5; \
962 __asm __volatile("move.l %%a6,-(%%sp)\n\t" \
963 "move.l %6,%%a6\n\t" \
964 "jsr %%a6@(-6*"#o":W)\n\t" \
965 "move.l (%%sp)+,%%a6" \
967 :"r"(___n1),"r"(___n2),"r"(___n3), \
968 "r"(___n4),"r"(___n5),"r"(bn) \
969 :A0,A1,D0,D1,"memory","cc"); \
974 #define __LC6(t,n,t1,n1,r1,t2,n2,r2,t3,n3,r3,t4,n4,r4,t5,n5,r5,t6,n6,r6,bt,bn,o,s) \
983 register long __d0 __asm(D0); \
984 register long ___n1 __asm(r1) = (long)__n1; \
985 register long ___n2 __asm(r2) = (long)__n2; \
986 register long ___n3 __asm(r3) = (long)__n3; \
987 register long ___n4 __asm(r4) = (long)__n4; \
988 register long ___n5 __asm(r5) = (long)__n5; \
989 register long ___n6 __asm(r6) = (long)__n6; \
990 __asm __volatile("move.l %%a6,-(%%sp)\n\t" \
991 "move.l %7,%%a6\n\t" \
992 "jsr %%a6@(-6*"#o":W)\n\t" \
993 "move.l (%%sp)+,%%a6" \
995 :"r"(___n1),"r"(___n2),"r"(___n3), \
996 "r"(___n4),"r"(___n5),"r"(___n6), \
998 :A0,A1,D0,D1,"memory","cc"); \
1003 #define __LC9(t,n,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) \
1015 register long __d0 __asm(D0); \
1016 register long ___n1 __asm(r1) = (long)__n1; \
1017 register long ___n2 __asm(r2) = (long)__n2; \
1018 register long ___n3 __asm(r3) = (long)__n3; \
1019 register long ___n4 __asm(r4) = (long)__n4; \
1020 register long ___n5 __asm(r5) = (long)__n5; \
1021 register long ___n6 __asm(r6) = (long)__n6; \
1022 register long ___n7 __asm(r7) = (long)__n7; \
1023 register long ___n8 __asm(r8) = (long)__n8; \
1024 register long ___n9 __asm(r9) = (long)__n9; \
1025 __asm __volatile("move.l %%a6,-(%%sp)\n\t" \
1026 "move.l %9,%%a6\n\t" \
1027 "jsr %%a6@(-6*"#o":W)\n\t" \
1028 "move.l (%%sp)+,%%a6" \
1030 :"r"(___n1),"r"(___n2),"r"(___n3), \
1031 "r"(___n4),"r"(___n5),"r"(___n6), \
1032 "r"(___n7),"r"(___n8),"r"(___n9), \
1034 :A0,A1,D0,D1,"memory","cc"); \
1038 ****************************************************/
1040 /****************************************************
1041 #define AROS_LC0(t,n,bt,bn,o,s) __LC0(t,n,bt,bn,o,s)
1042 #define AROS_LC0I(t,n,bt,bn,o,s) __LC0(t,n,bt,bn,o,s)
1043 #define AROS_LC1(t,n,a1,bt,bn,o,s) __LC1(t,n,a1,bt,bn,o,s)
1044 #define AROS_LC1I(t,n,a1,bt,bn,o,s) __LC1(t,n,a1,bt,bn,o,s)
1045 #define AROS_LC2(t,n,a1,a2,bt,bn,o,s) __LC2(t,n,a1,a2,bt,bn,o,s)
1046 #define AROS_LC2I(t,n,a1,a2,bt,bn,o,s) __LC2(t,n,a1,a2,bt,bn,o,s)
1047 #define AROS_LC3(t,n,a1,a2,a3,bt,bn,o,s) __LC3(t,n,a1,a2,a3,bt,bn,o,s)
1048 #define AROS_LC3I(t,n,a1,a2,a3,bt,bn,o,s) __LC3(t,n,a1,a2,a3,bt,bn,o,s)
1049 #define AROS_LC4(t,n,a1,a2,a3,a4,bt,bn,o,s) __LC4(t,n,a1,a2,a3,a4,bt,bn,o,s)
1050 #define AROS_LC4I(t,n,a1,a2,a3,a4,bt,bn,o,s) __LC4(t,n,a1,a2,a3,a4,bt,bn,o,s)
1051 #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)
1052 #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)
1053 #define AROS_LC6(t,n,a1,a2,a3,a4,a5,a6,bt,bn,o,s) \
1054 __LC6(t,n,a1,a2,a3,a4,a5,a6,bt,bn,o,s)
1055 #define AROS_LC6I(t,n,a1,a2,a3,a4,a5,a6,bt,bn,o,s) \
1056 __LC6(t,n,a1,a2,a3,a4,a5,a6,bt,bn,o,s)
1057 #define AROS_LC8(t,n,a1,a2,a3,a4,a5,a6,a7,a8,bt,bn,o,s) \
1058 __LC8(t,n,a1,a2,a3,a4,a5,a6,a7,a8,bt,bn,o,s)
1059 #define AROS_LC8I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,bt,bn,o,s) \
1060 __LC8(t,n,a1,a2,a3,a4,a5,a6,a7,a8,bt,bn,o,s)
1061 #define AROS_LC9(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,bt,bn,o,s) \
1062 __LC9(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,bt,bn,o,s)
1063 #define AROS_LC9I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,bt,bn,o,s) \
1064 __LC9(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,bt,bn,o,s)
1066 #define AROS_LVO_CALL0(returntype,basetype,basename,offset,system) \
1067 __LC0(returntype,,basetype,basename,offset,system)
1069 #define AROS_LVO_CALL1(t,a1,bt,bn,o,s) \
1070 __LC1(t,,a1,bt,bn,o,s)
1072 #define AROS_LVO_CALL1NR(a1,bt,bn,o,s) \
1073 __LC1(void,,a1,bt,bn,o,s)
1075 #define AROS_LVO_CALL2(t,a1,a2,bt,bn,o,s) \
1076 __LC2(t,,a1,a2,bt,bn,o,s)
1078 #define AROS_LVO_CALL3(t,a1,a2,a3,bt,bn,o,s) \
1079 __LC3(t,,a1,a2,a3,bt,bn,o,s)
1081 #define AROS_LVO_CALL3NR(a1,a2,a3,bt,bn,o,s) \
1082 __LC3(void,,a1,a2,a3,bt,bn,o,s)
1084 #define AROS_LVO_CALL4(t,a1,a2,a3,a4,bt,bn,o,s) \
1085 __LC4(t,,a1,a2,a3,a4,bt,bn,o,s)
1087 *****************************************************************/
1091 /* Macros for user functions */
1093 #define __ASM_PREFIX_U(name) \
1094 __asm__(".text\n\t.balign 16\n"\
1095 ".globl " #name "\n\t"\
1096 ".type " #name ",@function\n"\
1099 #define __ASM_POSTFIX_U(type,name,argc) \
1100 "jsr _" #name "\n\t"\
1101 "add.w #4*" #argc ",%sp\n\t"\
1103 ".size " #name ",.-" #name);\
1104 __AROS_UFH_PREFIX type _##name (
1107 /* Function headers for user functions */
1109 #define AROS_UFH0(t,n) \
1112 #define AROS_UFH1(t,n,a1) \
1116 __ASM_POSTFIX_U(t,n,1)\
1119 #define AROS_UFH2(t,n,a1,a2) \
1124 __ASM_POSTFIX_U(t,n,2)\
1128 #define AROS_UFH3(t,n,a1,a2,a3) \
1134 __ASM_POSTFIX_U(t,n,3)\
1139 #define AROS_UFH4(t,n,a1,a2,a3,a4) \
1146 __ASM_POSTFIX_U(t,n,4)\
1152 #define AROS_UFH5(t,n,a1,a2,a3,a4,a5) \
1160 __ASM_POSTFIX_U(t,n,5)\
1167 #define AROS_UFH6(t,n,a1,a2,a3,a4,a5,a6) \
1176 __ASM_POSTFIX_U(t,n,6)\
1184 #define AROS_UFH7(t,n,a1,a2,a3,a4,a5,a6,a7) \
1194 __ASM_POSTFIX_U(t,n,7)\
1203 #define AROS_UFH8(t,n,a1,a2,a3,a4,a5,a6,a7,a8) \
1214 __ASM_POSTFIX_U(t,n,8)\
1224 #define AROS_UFH9(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9) \
1236 __ASM_POSTFIX_U(t,n,9)\
1247 #define AROS_UFH10(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) \
1260 __ASM_POSTFIX_U(t,n,10)\
1272 #define AROS_UFH11(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) \
1286 __ASM_POSTFIX_U(t,n,11)\
1299 #define AROS_UFH12(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12) \
1314 __ASM_POSTFIX_U(t,n,12)\
1328 #define AROS_UFH13(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13) \
1344 __ASM_POSTFIX_U(t,n,13)\
1359 #define AROS_UFH14(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14) \
1376 __ASM_POSTFIX_U(t,n,14)\
1392 #define AROS_UFH15(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15) \
1410 __ASM_POSTFIX_U(t,n,15)\
1427 /* Call a user function */
1429 #define AROS_UFC0(t,n) \
1430 (((__AROS_UFC_PREFIX t(*)(void))n)())
1431 #define __UFC1(t,n,t1,n1,r1) \
1435 register long __d0 __asm__(D0);\
1437 "moveml "## r1 ##"/%d7,-(%sp)\n\t "\
1440 __asm__ __volatile__("move.l %1,%%d7"\
1443 :A0,A1,D0,D1,"cc","memory");\
1445 register t1 ___n1 __asm__(D0) = __n1;\
1447 "move.l %d0,"## r1 ##"\n\t"\
1449 "move.l %d0,-4(%sp)\n\t"\
1450 "moveml (%sp)+,"## r1 ##"/%d7\n\t"\
1451 "move.l -12(%sp),%d0\n\t"\
1457 #define AROS_UFC1(t,n,a1) __UFC1(t,n,a1)
1458 #define __UFC2(t,n,t1,n1,r1,t2,n2,r2) \
1463 register long __d0 __asm__(D0);\
1465 "moveml "## r1 ##"/"## r2 ##"/%d7,-(%sp)\n\t "\
1468 __asm__ __volatile__("move.l %1,%%d7"\
1471 :A0,A1,D0,D1,"cc","memory");\
1473 register t2 ___n2 __asm__(D0) = __n2;\
1475 "move.l %d0,-(%sp)\n\t"\
1479 register t1 ___n1 __asm__(D0) = __n1;\
1481 "move.l %d0,"## r1 ##"\n\t"\
1482 "move.l (%sp)+,"## r2 ##"\n\t"\
1484 "move.l %d0,-4(%sp)\n\t"\
1485 "moveml (%sp)+,"## r1 ##"/"## r2 ##"/%d7\n\t"\
1486 "move.l -16(%sp),%d0\n\t"\
1492 #define AROS_UFC2(t,n,a1,a2) __UFC2(t,n,a1,a2)
1493 #define __UFC3(t,n,t1,n1,r1,t2,n2,r2,t3,n3,r3) \
1499 register long __d0 __asm__(D0);\
1501 "moveml "## r1 ##"/"## r2 ##"/"## r3 ##"/%d7,-(%sp)\n\t"\
1504 __asm__ __volatile__("move.l %1,%%d7"\
1507 :A0,A1,D0,D1,"cc","memory");\
1509 register t3 ___n3 __asm__(D0) = __n3;\
1511 "move.l %d0,-(%sp)\n\t"\
1515 register t2 ___n2 __asm__(D0) = __n2;\
1517 "move.l %d0,-(%sp)\n\t"\
1521 register t1 ___n1 __asm__(D0) = __n1;\
1523 "move.l %d0,"## r1 ##"\n\t"\
1524 "move.l (%sp)+,"## r2 ##"\n\t"\
1525 "move.l (%sp)+,"## r3 ##"\n\t"\
1527 "move.l %d0,-4(%sp)\n\t"\
1528 "moveml (%sp)+,"## r1 ##"/"## r2 ##"/"## r3 ##"/%d7\n\t"\
1529 "move.l -20(%sp),%d0\n\t"\
1535 #define AROS_UFC3(t,n,a1,a2,a3) __UFC3(t,n,a1,a2,a3)
1536 #define __UFC4(t,n,t1,n1,r1,t2,n2,r2,t3,n3,r3,t4,n4,r4) \
1543 register long __d0 __asm__(D0);\
1545 "moveml "## r1 ##"/"## r2 ##"/"## r3 ##"/"## r4 ##"/%d7,-(%sp)\n\t "\
1548 __asm__ __volatile__("move.l %1,%%d7"\
1551 :A0,A1,D0,D1,"cc","memory");\
1553 register t4 ___n4 __asm__(D0) = __n4;\
1555 "move.l %d0,-(%sp)\n\t"\
1559 register t3 ___n3 __asm__(D0) = __n3;\
1561 "move.l %d0,-(%sp)\n\t"\
1565 register t2 ___n2 __asm__(D0) = __n2;\
1567 "move.l %d0,-(%sp)\n\t"\
1571 register t1 ___n1 __asm__(D0) = __n1;\
1573 "move.l %d0,"## r1 ##"\n\t"\
1574 "move.l (%sp)+,"## r2 ##"\n\t"\
1575 "move.l (%sp)+,"## r3 ##"\n\t"\
1576 "move.l (%sp)+,"## r4 ##"\n\t"\
1578 "move.l %d0,-4(%sp)\n\t"\
1579 "moveml (%sp)+,"## r1 ##"/"## r2 ##"/"## r3 ##"/"## r4 ##"/%d7\n\t"\
1580 "move.l -24(%sp),%d0\n\t"\
1586 #define AROS_UFC4(t,n,a1,a2,a3,a4) __UFC4(t,n,a1,a2,a3,a4)
1587 #define __UFC5(t,n,t1,n1,r1,t2,n2,r2,t3,n3,r3,t4,n4,r4,t5,n5,r5) \
1595 register long __d0 __asm__(D0);\
1597 "moveml "## r1 ##"/"## r2 ##"/"## r3 ##"/\
1598 "## r4 ##"/"## r5 ##"/%d7,-(%sp)\n\t"\
1601 __asm__ __volatile__("move.l %1,%%d7"\
1604 :A0,A1,D0,D1,"cc","memory");\
1606 register t5 ___n5 __asm__(D0) = __n5;\
1608 "move.l %d0,-(%sp)\n\t"\
1612 register t4 ___n4 __asm__(D0) = __n4;\
1614 "move.l %d0,-(%sp)\n\t"\
1618 register t3 ___n3 __asm__(D0) = __n3;\
1620 "move.l %d0,-(%sp)\n\t"\
1624 register t2 ___n2 __asm__(D0) = __n2;\
1626 "move.l %d0,-(%sp)\n\t"\
1630 register t1 ___n1 __asm__(D0) = __n1;\
1632 "move.l %d0,"## r1 ##"\n\t"\
1633 "move.l (%sp)+,"## r2 ##"\n\t"\
1634 "move.l (%sp)+,"## r3 ##"\n\t"\
1635 "move.l (%sp)+,"## r4 ##"\n\t"\
1636 "move.l (%sp)+,"## r5 ##"\n\t"\
1638 "move.l %d0,-4(%sp)\n\t"\
1639 "moveml (%sp)+,"## r1 ##"/"## r2 ##"/"\
1640 ## r3 ##"/"## r4 ##"/"\
1642 "move.l -28(%sp),%d0\n\t"\
1648 #define AROS_UFC5(t,n,a1,a2,a3,a4,a5) __UFC5(t,n,a1,a2,a3,a4,a5)
1650 #endif /* UseRegisterArgs */
1652 #endif /* AROS_MACHINE_H */