1 #ifndef AROS_MORPHOS_CPU_H
2 #define AROS_MORPHOS_CPU_H
4 Copyright � 1995-2010, The AROS Development Team. All rights reserved.
7 NOTE: This file must compile *without* any other header !
9 Desc: cpu.h include file for morphos arch
13 /* Information about size and alignment,
14 * the defines have to be numeric constants */
15 #define AROS_STACK_GROWS_DOWNWARDS 1 /* Stack direction */
16 #define AROS_BIG_ENDIAN 1 /* Big or little endian */
17 #define AROS_SIZEOFULONG 4 /* Size of an ULONG */
18 #define AROS_SIZEOFPTR 4 /* Size of a PTR */
19 #define AROS_WORDALIGN 2 /* Alignment for WORD */
20 #define AROS_LONGALIGN 2 /* Alignment for LONG */
21 #define AROS_QUADALIGN 2 /* Alignment for QUAD */
22 #define AROS_PTRALIGN 2 /* Alignment for PTR */
23 #define AROS_IPTRALIGN 2 /* Alignment for IPTR */
24 #define AROS_DOUBLEALIGN 2 /* Alignment for double */
25 #define AROS_WORSTALIGN 8 /* Worst case alignment */
29 * Some (or maybe even all) PowerPC machines expect the stack to be aligned on 16-byte boundary.
30 * This is the reason number one for AROS_WORSTALIGN=16. The second reason is, the 440 CPU will
31 * generate an alignment exception if floating point data *crosses* the 16-byte boundary.
34 #define AROS_32BIT_TYPE int
35 /* For ABI V1 this should be done in common cpu.h */
36 #define AROS_LARGEST_TYPE long long
38 /* Note that MorphOS ABI DOES have linear varargs as an option */
39 #define __stackparm __attribute__((varargs68k))
41 #define AROS_SLOWSTACKTAGS 1
42 #define AROS_SLOWSTACKMETHODS 1
43 #define AROS_SLOWSTACKHOOKS 1
44 #define AROS_SLOWSTACKFORMAT 1
46 /* types and limits for sig_atomic_t */
47 #define AROS_SIG_ATOMIC_T int
48 #define AROS_SIG_ATOMIC_MIN (-0x7fffffff-1)
49 #define AROS_SIG_ATOMIC_MAX 0x7fffffff
51 #if defined(__GNUC__) && !defined(__clang__)
52 register unsigned char* AROS_GET_SP
__asm__("%sp");
56 An offset value sometimes added to
57 or subtracted from the stack limits.
60 #define SP_OFFSET 0x10
63 One entry in a libraries' jumptable. For assembler compatibility, the
64 field jmp should contain the code for an absolute jmp to a 32bit
65 address. There are also a couple of macros which you should use to
66 access the vector table from C.
70 unsigned long addis
; // simplified: lis 11, a@h
71 unsigned long ori
; // : li 11, a@l
72 unsigned long mtspr
; // : mtctr 11
73 unsigned long jmp
; // bcctr : bctr 11
75 /* browse MPCFPE32B.pdf to understand opcode creation */
76 #define __AROS_SET_FULLJMP(v,a)\
78 struct FullJumpVec *_v = (v); \
79 _v->addis = (15 << 26) | (11 << 21) | ((ULONG)(a) >> 16); \
80 _v->ori = (24 << 26) | (11 << 21) | (11 << 16) | ((ULONG)(a) & 0x0000FFFF);\
81 _v->mtspr = (31 << 26) | (11 << 21) | ( 9 << 16) | (467 << 1); \
82 _v->jmp = (19 << 26) | (20 << 21) | (528 << 1); \
92 #define __AROS_SET_VEC(v,a) (*(ULONG*)(v)->vec=(ULONG)(a))
93 #define __AROS_GET_VEC(v) ((APTR)(*(ULONG*)(v)->vec))
95 /* Use these to acces a vector table */
96 #define LIB_VECTSIZE (sizeof (struct JumpVec))
97 #define __AROS_GETJUMPVEC(lib,n) (&((struct JumpVec *)lib)[-(n)])
98 #define __AROS_GETVECADDR(lib,n) (__AROS_GET_VEC(__AROS_GETJUMPVEC(lib,n)))
99 #define __AROS_SETVECADDR(lib,n,addr) (__AROS_SET_VEC(__AROS_GETJUMPVEC(lib,n),(APTR)(addr)))
100 #define __AROS_INITVEC(lib,n) __AROS_GETJUMPVEC(lib,n)->jmp = TRAP_LIB, \
101 __AROS_SETVECADDR(lib,n,_aros_not_implemented)
104 Code used to generate stub functions.
105 It must be *printed* with a function like printf into
106 a file to be compiled with gcc.
108 - The first parameter is the function name,
109 - The second parameter is the basename,
110 i.e. bname is the address of a pointer to the library base,
111 - The third parameter is the library vector to be called.
113 It's value must be computed by the stub generator with this code:
114 &(__AROS_GETJUMPVEC(0, n+1)->vec), where n is the library vector position in
115 the library vectors list.
118 #define STUBCODE_INIT \
119 "#define EMITSTUB(fname, bname, vec) " \
122 "lis 11,bname@ha; " \
123 "lwz 11,bname@l(11); " \
127 "#define EMITALIAS(fname, alias) " \
128 ".weak alias; .set alias, fname\n"
130 "EMITSTUB(%s, %s, %d) "
132 "EMITALIAS(%s, %s)\n"
134 We want to activate the execstubs and preserve all registers
135 when calling obtainsemaphore, obtainsemaphoreshared, releasesemaphore,
136 getcc, permit, forbid, enable, disable
139 #define UseExecstubs 1
141 /* Macros to test/set failure of AllocEntry() */
142 #define AROS_ALLOCENTRY_FAILED(memType) \
143 ((struct MemList *)((IPTR)(memType) | 0x80ul<<(sizeof(APTR)-1)*8))
144 #define AROS_CHECK_ALLOCENTRY(memList) \
145 (!((IPTR)(memList) & 0x80ul<<(sizeof(APTR)-1)*8))
148 Find the next valid alignment for a structure if the next x bytes must
151 #define AROS_ALIGN(x) (((x)+AROS_WORSTALIGN-1)&-AROS_WORSTALIGN)
154 extern void _aros_not_implemented (char *);
156 /* How much stack do we need ? Lots :-) */
157 #define AROS_STACKSIZE 32768
159 /* How to map function arguments to CPU registers */
161 /* What to do with the library base in header, prototype and call */
162 #define __AROS_LH_BASE(basetype,basename) basetype basename = (basetype)REG_A6
163 #define __AROS_LP_BASE(basetype,basename) basetype __base = basename
164 #define __AROS_LC_BASE(basetype,basename) REG_A6 = (LONG)__base
165 #define __AROS_LD_BASE(basetype,basename) basetype basename
167 /* How to transform an argument in header, opt prototype, call and forced
169 #define __AROS_LHA(type,name,reg) type name = (type) REG_##reg
170 #define __AROS_LPA(type,name,reg) type r##reg = name
171 #define __AROS_LCA(type,name,reg) REG_##reg = (LONG)r##reg
172 #define __AROS_LDA(type,name,reg) type
173 #define __AROS_UFHA(type,name,reg) type name = (type) REG_##reg
174 #define __AROS_UFPA(type,name,reg) type r##reg = name
175 #define __AROS_UFCA(type,name,reg) REG_##reg = (LONG)r##reg
176 #define __AROS_UFDA(type,name,reg) type
177 #define __AROS_LHAQUAD(type,name,reg1,reg2) type name
178 #define __AROS_LPAQUAD(type,name,reg1,reg2) type
179 #define __AROS_LCAQUAD(type,name,reg1,reg2) name
180 #define __AROS_LDAQUAD(type,name,reg1,reg2) type
182 /* Prefix for library function in header, prototype and call */
183 #define __AROS_LH_PREFIX /* eps */
184 #define __AROS_LP_PREFIX /* eps */
185 #define __AROS_LC_PREFIX /* eps */
186 #define __AROS_LD_PREFIX /* eps */
187 #define __AROS_UFH_PREFIX /* eps */
188 #define __AROS_UFP_PREFIX /* eps */
189 #define __AROS_UFC_PREFIX /* eps */
190 #define __AROS_UFD_PREFIX /* eps */
192 #define __UFC3R(_t,_n,t1,n1,r1,t2,n2,r2,t3,n3,r3,p) \
194 long _n1 = (long)(n1);\
195 long _n2 = (long)(n2);\
196 long _n3 = (long)(n3);\
198 __asm__ __volatile__(\
204 "stwu 1,-16(1)\n\t" \
214 : "=r"(_re), "=m"(*(APTR *)p)\
215 : "r"(_n), "r"(_n1), "r"(_n2), "r"(_n3)\
216 : "cc", "memory", "0", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13");\
219 #define AROS_UFC3R(t,n,a1,a2,a3,p,ss) __UFC3R(t,n,a1,a2,a3,p)
221 /* Library prototypes expand to nothing */
222 #define __AROS_CPU_SPECIFIC_LP
224 #define AROS_LPQUAD1(t,n,a1,bt,bn,o,s)
225 #define AROS_LPQUAD2(t,n,a1,a2,bt,bn,o,s)
227 #define AROS_LP0(t,n,bt,bn,o,s)
228 #define AROS_LP1(t,n,a1,bt,bn,o,s)
229 #define AROS_LP2(t,n,a1,a2,bt,bn,o,s)
230 #define AROS_LP3(t,n,a1,a2,a3,bt,bn,o,s)
231 #define AROS_LP4(t,n,a1,a2,a3,a4,bt,bn,o,s)
232 #define AROS_LP5(t,n,a1,a2,a3,a4,a5,bt,bn,o,s)
233 #define AROS_LP6(t,n,a1,a2,a3,a4,a5,a6,bt,bn,o,s)
234 #define AROS_LP7(t,n,a1,a2,a3,a4,a5,a6,a7,bt,bn,o,s)
235 #define AROS_LP8(t,n,a1,a2,a3,a4,a5,a6,a7,a8,bt,bn,o,s)
236 #define AROS_LP9(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,bt,bn,o,s)
237 #define AROS_LP10(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,bt,bn,o,s)
238 #define AROS_LP11(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,bt,bn,o,s)
239 #define AROS_LP12(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,bt,bn,o,s)
240 #define AROS_LP13(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,bt,bn,o,s)
241 #define AROS_LP14(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,bt,bn,o,s)
242 #define AROS_LP15(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,bt,bn,o,s)
244 #define AROS_LP0I(t,n,bt,bn,o,s)
245 #define AROS_LP1I(t,n,a1,bt,bn,o,s)
246 #define AROS_LP2I(t,n,a1,a2,bt,bn,o,s)
247 #define AROS_LP3I(t,n,a1,a2,a3,bt,bn,o,s)
248 #define AROS_LP4I(t,n,a1,a2,a3,a4,bt,bn,o,s)
249 #define AROS_LP5I(t,n,a1,a2,a3,a4,a5,bt,bn,o,s)
250 #define AROS_LP6I(t,n,a1,a2,a3,a4,a5,a6,bt,bn,o,s)
251 #define AROS_LP7I(t,n,a1,a2,a3,a4,a5,a6,a7,bt,bn,o,s)
252 #define AROS_LP8I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,bt,bn,o,s)
253 #define AROS_LP9I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,bt,bn,o,s)
254 #define AROS_LP10I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,bt,bn,o,s)
255 #define AROS_LP11I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,bt,bn,o,s)
256 #define AROS_LP12I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,bt,bn,o,s)
257 #define AROS_LP13I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,bt,bn,o,s)
258 #define AROS_LP14I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,bt,bn,o,s)
259 #define AROS_LP15I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,bt,bn,o,s)
261 /* Library function calls. They are made through m68k emulator. */
262 #define __AROS_CPU_SPECIFIC_LC
264 /* Call a library function which requires the libbase */
265 #define AROS_LC0(t,n,bt,bn,o,s) \
267 __AROS_LP_BASE(bt,bn); \
268 __AROS_LC_BASE(bt,bn); \
269 (t)MyEmulHandle->EmulCallDirectOS(-6 * o); \
272 #define AROS_LC1(t,n,a1,bt,bn,o,s) \
275 __AROS_LP_BASE(bt,bn); \
277 __AROS_LC_BASE(bt,bn); \
278 (t)MyEmulHandle->EmulCallDirectOS(-6 * o); \
280 #define AROS_LC2(t,n,a1,a2,bt,bn,o,s) \
284 __AROS_LP_BASE(bt,bn); \
287 __AROS_LC_BASE(bt,bn); \
288 (t)MyEmulHandle->EmulCallDirectOS(-6 * o); \
290 #define AROS_LC3(t,n,a1,a2,a3,bt,bn,o,s) \
295 __AROS_LP_BASE(bt,bn); \
299 __AROS_LC_BASE(bt,bn); \
300 (t)MyEmulHandle->EmulCallDirectOS(-6 * o); \
302 #define AROS_LC4(t,n,a1,a2,a3,a4,bt,bn,o,s) \
308 __AROS_LP_BASE(bt,bn); \
313 __AROS_LC_BASE(bt,bn); \
314 (t)MyEmulHandle->EmulCallDirectOS(-6 * o); \
316 #define AROS_LC5(t,n,a1,a2,a3,a4,a5,bt,bn,o,s) \
323 __AROS_LP_BASE(bt,bn); \
329 __AROS_LC_BASE(bt,bn); \
330 (t)MyEmulHandle->EmulCallDirectOS(-6 * o); \
332 #define AROS_LC6(t,n,a1,a2,a3,a4,a5,a6,bt,bn,o,s) \
340 __AROS_LP_BASE(bt,bn); \
347 __AROS_LC_BASE(bt,bn); \
348 (t)MyEmulHandle->EmulCallDirectOS(-6 * o); \
350 #define AROS_LC7(t,n,a1,a2,a3,a4,a5,a6,a7,bt,bn,o,s) \
359 __AROS_LP_BASE(bt,bn); \
367 __AROS_LC_BASE(bt,bn); \
368 (t)MyEmulHandle->EmulCallDirectOS(-6 * o); \
370 #define AROS_LC8(t,n,a1,a2,a3,a4,a5,a6,a7,a8,bt,bn,o,s) \
380 __AROS_LP_BASE(bt,bn); \
389 __AROS_LC_BASE(bt,bn); \
390 (t)MyEmulHandle->EmulCallDirectOS(-6 * o); \
392 #define AROS_LC9(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,bt,bn,o,s) \
403 __AROS_LP_BASE(bt,bn); \
413 __AROS_LC_BASE(bt,bn); \
414 (t)MyEmulHandle->EmulCallDirectOS(-6 * o); \
416 #define AROS_LC10(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,bt,bn,o,s) \
428 __AROS_LP_BASE(bt,bn); \
439 __AROS_LC_BASE(bt,bn); \
440 (t)MyEmulHandle->EmulCallDirectOS(-6 * o); \
442 #define AROS_LC11(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,bt,bn,o,s) \
455 __AROS_LP_BASE(bt,bn); \
467 __AROS_LC_BASE(bt,bn); \
468 (t)MyEmulHandle->EmulCallDirectOS(-6 * o); \
470 #define AROS_LC12(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,bt,bn,o,s) \
484 __AROS_LP_BASE(bt,bn); \
497 __AROS_LC_BASE(bt,bn); \
498 (t)MyEmulHandle->EmulCallDirectOS(-6 * o); \
500 #define AROS_LC13(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,bt,bn,o,s) \
515 __AROS_LP_BASE(bt,bn); \
529 __AROS_LC_BASE(bt,bn); \
530 (t)MyEmulHandle->EmulCallDirectOS(-6 * o); \
532 #define AROS_LC14(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,bt,bn,o,s) \
548 __AROS_LP_BASE(bt,bn); \
563 __AROS_LC_BASE(bt,bn); \
564 (t)MyEmulHandle->EmulCallDirectOS(- 6 *o); \
566 #define AROS_LC15(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,bt,bn,o,s) \
583 __AROS_LP_BASE(bt,bn); \
599 __AROS_LC_BASE(bt,bn); \
600 (t)MyEmulHandle->EmulCallDirectOS(-6 * o); \
603 /* Call a library function which doesn't require the libbase */
604 #define AROS_LC0I(t,n,bt,bn,o,s) \
605 AROS_LC0(t,n,bt,bn,o,s)
606 #define AROS_LC1I(t,n,a1,bt,bn,o,s) \
607 AROS_LC1(t,n,a1,bt,bn,o,s)
608 #define AROS_LC2I(t,n,a1,a2,bt,bn,o,s) \
609 AROS_LC2(t,n,a1,a2,bt,bn,o,s)
610 #define AROS_LC3I(t,n,a1,a2,a3,bt,bn,o,s) \
611 AROS_LC3(t,n,a1,a2,a3,bt,bn,o,s)
612 #define AROS_LC4I(t,n,a1,a2,a3,a4,bt,bn,o,s) \
613 AROS_LC4(t,n,a1,a2,a3,a4,bt,bn,o,s)
614 #define AROS_LC5I(t,n,a1,a2,a3,a4,a5,bt,bn,o,s) \
615 AROS_LC5(t,n,a1,a2,a3,a4,a5,bt,bn,o,s)
616 #define AROS_LC6I(t,n,a1,a2,a3,a4,a5,a6,bt,bn,o,s) \
617 AROS_LC6(t,n,a1,a2,a3,a4,a5,a6,bt,bn,o,s)
618 #define AROS_LC7I(t,n,a1,a2,a3,a4,a5,a6,a7,bt,bn,o,s) \
619 AROS_LC7(t,n,a1,a2,a3,a4,a5,a6,a7,bt,bn,o,s)
620 #define AROS_LC8I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,bt,bn,o,s) \
621 AROS_LC8(t,n,a1,a2,a3,a4,a5,a6,a7,a8,bt,bn,o,s)
622 #define AROS_LC9I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,bt,bn,o,s) \
623 AROS_LC9(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,bt,bn,o,s)
624 #define AROS_LC10I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,bt,bn,o,s) \
625 AROS_LC10(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,bt,bn,o,s)
626 #define AROS_LC11I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,bt,bn,o,s) \
627 AROS_LC11(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,bt,bn,o,s)
628 #define AROS_LC12I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,bt,bn,o,s) \
629 AROS_LC12(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,bt,bn,o,s)
630 #define AROS_LC13I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,bt,bn,o,s) \
631 AROS_LC13(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,bt,bn,o,s)
632 #define AROS_LC14I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,bt,bn,o,s) \
633 AROS_LC14(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,bt,bn,o,s)
634 #define AROS_LC15I(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,bt,bn,o,s) \
635 AROS_LC15(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,bt,bn,o,s)
637 /* asmcall stuff follows. Also use m68k emulator traps as entry points. */
638 #define __AROS_CPU_SPECIFIC_ASMCALLS
640 #define AROS_ASMSYMNAME(s) (&s##_Gate)
642 #if !(UseRegisterArgs && defined(AROS_COMPILER_NO_REGARGS))
643 /* Function headers for user functions */
644 #define AROS_UFH0(t,n) \
645 __AROS_UFH_PREFIX t n##_Func (void); \
646 const struct EmulLibEntry n##_Gate = { TRAP_LIB, 0, (void(*))n##_Func }; \
647 __AROS_UFH_PREFIX t n##_Func(void) \
650 #define AROS_UFH1(t,n,a1) \
651 __AROS_UFH_PREFIX t n##_Func (void); \
652 const struct EmulLibEntry n##_Gate = { TRAP_LIB, 0, (void(*))n##_Func }; \
653 __AROS_UFH_PREFIX t n##_Func(void) \
657 #define AROS_UFH2(t,n,a1,a2) \
658 __AROS_UFH_PREFIX t n##_Func (void); \
659 const struct EmulLibEntry n##_Gate = { TRAP_LIB, 0, (void(*))n##_Func }; \
660 __AROS_UFH_PREFIX t n##_Func(void) \
665 #define AROS_UFH3(t,n,a1,a2,a3) \
666 __AROS_UFH_PREFIX t n##_Func (void); \
667 const struct EmulLibEntry n##_Gate = { TRAP_LIB, 0, (void(*))n##_Func }; \
668 __AROS_UFH_PREFIX t n##_Func(void) \
674 #define AROS_UFH3S(t,n,a1,a2,a3) \
675 static __AROS_UFH_PREFIX t n##_Func (void); \
676 static const struct EmulLibEntry n##_Gate = { TRAP_LIB, 0, (void(*))n##_Func }; \
677 static __AROS_UFH_PREFIX t n##_Func(void) \
683 #define AROS_UFH4(t,n,a1,a2,a3,a4) \
684 __AROS_UFH_PREFIX t n##_Func (void); \
685 const struct EmulLibEntry n##_Gate = { TRAP_LIB, 0, (void(*))n##_Func }; \
686 __AROS_UFH_PREFIX t n##_Func(void) \
693 #define AROS_UFH5(t,n,a1,a2,a3,a4,a5) \
694 __AROS_UFH_PREFIX t n##_Func (void); \
695 const struct EmulLibEntry n##_Gate = { TRAP_LIB, 0, (void(*))n##_Func }; \
696 __AROS_UFH_PREFIX t n##_Func(void) \
704 #define AROS_UFH5S(t,n,a1,a2,a3,a4,a5) \
705 __AROS_UFH_PREFIX static t n##_Func (void); \
706 static const struct EmulLibEntry n##_Gate = { TRAP_LIB, 0, (void(*))n##_Func }; \
707 __AROS_UFH_PREFIX static t n##_Func(void) \
715 #define AROS_UFH6(t,n,a1,a2,a3,a4,a5,a6) \
716 __AROS_UFH_PREFIX t n##_Func (void); \
717 const struct EmulLibEntry n##_Gate = { TRAP_LIB, 0, (void(*))n##_Func }; \
718 __AROS_UFH_PREFIX t n##_Func(void) \
727 #define AROS_UFH7(t,n,a1,a2,a3,a4,a5,a6,a7) \
728 __AROS_UFH_PREFIX t n##_Func (void); \
729 const struct EmulLibEntry n##_Gate = { TRAP_LIB, 0, (void(*))n##_Func }; \
730 __AROS_UFH_PREFIX t n##_Func(void) \
740 #define AROS_UFH8(t,n,a1,a2,a3,a4,a5,a6,a7,a8) \
741 __AROS_UFH_PREFIX t n##_Func (void); \
742 const struct EmulLibEntry n##_Gate = { TRAP_LIB, 0, (void(*))n##_Func }; \
743 __AROS_UFH_PREFIX t n##_Func(void) \
754 #define AROS_UFH9(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9) \
755 __AROS_UFH_PREFIX t n##_Func (void); \
756 const struct EmulLibEntry n##_Gate = { TRAP_LIB, 0, (void(*))n##_Func }; \
757 __AROS_UFH_PREFIX t n##_Func(void) \
769 #define AROS_UFH10(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) \
770 __AROS_UFH_PREFIX t n##_Func (void); \
771 const struct EmulLibEntry n##_Gate = { TRAP_LIB, 0, (void(*))n##_Func }; \
772 __AROS_UFH_PREFIX t n##_Func(void) \
785 #define AROS_UFH11(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) \
786 __AROS_UFH_PREFIX t n##_Func (void); \
787 const struct EmulLibEntry n##_Gate = { TRAP_LIB, 0, (void(*))n##_Func }; \
788 __AROS_UFH_PREFIX t n##_Func(void) \
802 #define AROS_UFH12(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12) \
803 __AROS_UFH_PREFIX t n##_Func (void); \
804 const struct EmulLibEntry n##_Gate = { TRAP_LIB, 0, (void(*))n##_Func }; \
805 __AROS_UFH_PREFIX t n##_Func(void) \
820 #define AROS_UFH13(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13) \
821 __AROS_UFH_PREFIX t n##_Func (void); \
822 const struct EmulLibEntry n##_Gate = { TRAP_LIB, 0, (void(*))n##_Func }; \
823 __AROS_UFH_PREFIX t n##_Func(void) \
839 #define AROS_UFH14(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14) \
840 __AROS_UFH_PREFIX t n##_Func (void); \
841 const struct EmulLibEntry n##_Gate = { TRAP_LIB, 0, (void(*))n##_Func }; \
842 __AROS_UFH_PREFIX t n##_Func(void) \
859 #define AROS_UFH15(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15) \
860 __AROS_UFH_PREFIX t n##_Func (void); \
861 const struct EmulLibEntry n##_Gate = { TRAP_LIB, 0, (void(*))n##_Func }; \
862 __AROS_UFH_PREFIX t n##_Func(void) \
880 /* Call a user function */
881 #define AROS_UFC0(t,n) \
882 ((t)MyEmulHandle->EmulCallDirect68k((APTR)(n)))
884 #define AROS_UFC1(t,n,a1) \
888 (t)MyEmulHandle->EmulCallDirect68k((APTR)(n)); \
891 #define AROS_UFC2(t,n,a1,a2) \
897 (t)MyEmulHandle->EmulCallDirect68k((APTR)(n)); \
900 #define AROS_UFC3(t,n,a1,a2,a3) \
908 (t)MyEmulHandle->EmulCallDirect68k((APTR)(n)); \
911 #define AROS_UFC4(t,n,a1,a2,a3,a4) \
921 (t)MyEmulHandle->EmulCallDirect68k((APTR)(n)); \
924 #define AROS_UFC5(t,n,a1,a2,a3,a4,a5) \
936 (t)MyEmulHandle->EmulCallDirect68k((APTR)(n)); \
939 #define AROS_UFC6(t,n,a1,a2,a3,a4,a5,a6) \
953 (t)MyEmulHandle->EmulCallDirect68k((APTR)(n)); \
956 #define AROS_UFC7(t,n,a1,a2,a3,a4,a5,a6,a7) \
972 (t)MyEmulHandle->EmulCallDirect68k((APTR)(n)); \
975 #define AROS_UFC8(t,n,a1,a2,a3,a4,a5,a6,a7,a8) \
993 (t)MyEmulHandle->EmulCallDirect68k((APTR)(n)); \
996 #define AROS_UFC9(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9) \
1016 (t)MyEmulHandle->EmulCallDirect68k((APTR)(n)); \
1019 #define AROS_UFC10(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) \
1041 (t)MyEmulHandle->EmulCallDirect68k((APTR)(n)); \
1044 #define AROS_UFC11(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) \
1068 (t)MyEmulHandle->EmulCallDirect68k((APTR)(n)); \
1071 #define AROS_UFC12(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12) \
1097 (t)MyEmulHandle->EmulCallDirect68k((APTR)(n)); \
1100 #define AROS_UFC13(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13) \
1128 (t)MyEmulHandle->EmulCallDirect68k((APTR)(n)); \
1131 #define AROS_UFC14(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14) \
1161 (t)MyEmulHandle->EmulCallDirect68k((APTR)(n)); \
1164 #define AROS_UFC15(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15) \
1196 (t)MyEmulHandle->EmulCallDirect68k((APTR)(n)); \
1199 #endif /* !(UseRegisterArgs && defined(AROS_COMPILER_NO_REGARGS)) */
1201 /* Prototypes for user functions */
1202 # define AROS_UFP0(t,n) \
1203 extern const struct EmulLibEntry n##_Gate;
1205 # define AROS_UFP1(t,n,a1) \
1206 extern const struct EmulLibEntry n##_Gate;
1208 # define AROS_UFP2(t,n,a1,a2) \
1209 extern const struct EmulLibEntry n##_Gate;
1211 # define AROS_UFP3(t,n,a1,a2,a3) \
1212 extern const struct EmulLibEntry n##_Gate;
1214 # define AROS_UFP3S(t,n,a1,a2,a3) \
1215 extern const struct EmulLibEntry n##_Gate;
1217 # define AROS_UFP4(t,n,a1,a2,a3,a4) \
1218 const struct EmulLibEntry Xj(n,_Gate);
1220 # define AROS_UFP5(t,n,a1,a2,a3,a4,a5) \
1221 extern const struct EmulLibEntry n##_Gate;
1223 # define AROS_UFP5S(t,n,a1,a2,a3,a4,a5) \
1224 extern const struct EmulLibEntry n##_Gate;
1225 # define AROS_UFP6(t,n,a1,a2,a3,a4,a5,a6) \
1226 extern const struct EmulLibEntry n##_Gate;
1228 # define AROS_UFP7(t,n,a1,a2,a3,a4,a5,a6,a7) \
1229 extern const struct EmulLibEntry n##_Gate;
1231 # define AROS_UFP8(t,n,a1,a2,a3,a4,a5,a6,a7,a8) \
1232 extern const struct EmulLibEntry n##_Gate;
1234 # define AROS_UFP9(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9) \
1235 extern const struct EmulLibEntry n##_Gate;
1237 # define AROS_UFP10(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) \
1238 extern const struct EmulLibEntry n##_Gate;
1240 # define AROS_UFP11(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) \
1241 extern const struct EmulLibEntry n##_Gate;
1243 # define AROS_UFP12(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12) \
1244 extern const struct EmulLibEntry n##_Gate;
1246 # define AROS_UFP13(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13) \
1247 extern const struct EmulLibEntry n##_Gate;
1249 # define AROS_UFP14(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14) \
1250 extern const struct EmulLibEntry n##_Gate;
1252 # define AROS_UFP15(t,n,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15) \
1253 extern const struct EmulLibEntry n##_Gate;
1255 #endif /* AROS_MORPHOS_CPU_H */