2 * Copyright (C) 1993 AmiTCP/IP Group, <amitcp-group@hut.fi>
3 * Helsinki University of Technology, Finland.
5 * Copyright (C) 2005 Neil Cafferkey
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
27 * RAF1...RAF7 gives consistent way to make function take arguments in
28 * registers. currently __GNUC__ and __SASC supported.
33 #define RAF1(funname, type1, arg1, reg1) \
34 __asm funname(register __##reg1 type1 arg1) \
37 #define RAF2(funname,type1, arg1, reg1,type2, arg2, reg2) \
38 __asm funname(register __##reg1 type1 arg1, \
39 register __##reg2 type2 arg2) \
42 #define RAF3(funname, type1, arg1, reg1, type2, arg2, reg2, type3, arg3, reg3)\
43 __asm funname(register __##reg1 type1 arg1, \
44 register __##reg2 type2 arg2, \
45 register __##reg3 type3 arg3) \
48 #define RAF4(funname, type1, arg1, reg1, type2, arg2, reg2, type3, arg3, reg3, type4, arg4, reg4) \
49 __asm funname(register __##reg1 type1 arg1, \
50 register __##reg2 type2 arg2, \
51 register __##reg3 type3 arg3, \
52 register __##reg4 type4 arg4) \
55 #define RAF5(funname, type1, arg1, reg1, type2, arg2, reg2, type3, arg3, reg3, type4, arg4, reg4, type5, arg5, reg5) \
56 __asm funname(register __##reg1 type1 arg1, \
57 register __##reg2 type2 arg2, \
58 register __##reg3 type3 arg3, \
59 register __##reg4 type4 arg4, \
60 register __##reg5 type5 arg5) \
63 #define RAF6(funname, type1, arg1, reg1, type2, arg2, reg2, type3, arg3, reg3, type4, arg4, reg4, type5, arg5, reg5, type6, arg6, reg6) \
64 __asm funname(register __##reg1 type1 arg1, \
65 register __##reg2 type2 arg2, \
66 register __##reg3 type3 arg3, \
67 register __##reg4 type4 arg4, \
68 register __##reg5 type5 arg5, \
69 register __##reg6 type6 arg6) \
72 #define RAF7(funname, type1, arg1, reg1, type2, arg2, reg2, type3, arg3, reg3, type4, arg4, reg4, type5, arg5, reg5, type6, arg6, reg6, type7, arg7, reg7) \
73 __asm funname(register __##reg1 type1 arg1, \
74 register __##reg2 type2 arg2, \
75 register __##reg3 type3 arg3, \
76 register __##reg4 type4 arg4, \
77 register __##reg5 type5 arg5, \
78 register __##reg6 type6 arg6, \
79 register __##reg7 type7 arg7) \
84 #define RAF1(funname,type1, arg1, reg1) \
87 register type1 reg1 __asm(#reg1); \
90 #define RAF2(funname, type1, arg1, reg1, type2, arg2, reg2) \
93 register type1 reg1 __asm(#reg1); \
95 register type2 reg2 __asm(#reg2); \
99 #define RAF2(funname, type1, arg1, reg1, type2, arg2, reg2) \
100 funname(type1 arg1 __asm(#reg1), type2 arg2 __asm(#reg2)) \
104 #define RAF3(funname, type1, arg1, reg1, type2, arg2, reg2, type3, arg3, reg3)\
107 register type1 reg1 __asm(#reg1); \
109 register type2 reg2 __asm(#reg2); \
111 register type3 reg3 __asm(#reg3); \
114 #define RAF4(funname, type1, arg1, reg1, type2, arg2, reg2, type3, arg3, reg3, type4, arg4, reg4) \
117 register type1 reg1 __asm(#reg1); \
119 register type2 reg2 __asm(#reg2); \
121 register type3 reg3 __asm(#reg3); \
123 register type4 reg4 __asm(#reg4); \
126 #define RAF5(funname, type1, arg1, reg1, type2, arg2, reg2, type3, arg3, reg3, type4, arg4, reg4, type5, arg5, reg5) \
129 register type1 reg1 __asm(#reg1); \
131 register type2 reg2 __asm(#reg2); \
133 register type3 reg3 __asm(#reg3); \
135 register type4 reg4 __asm(#reg4); \
137 register type5 reg5 __asm(#reg5); \
141 #define RAF6(funname, type1, arg1, reg1, type2, arg2, reg2, type3, arg3, reg3, type4, arg4, reg4, type5, arg5, reg5, type6, arg6, reg6) \
144 register type1 reg1 __asm(#reg1); \
146 register type2 reg2 __asm(#reg2); \
148 register type3 reg3 __asm(#reg3); \
150 register type4 reg4 __asm(#reg4); \
152 register type5 reg5 __asm(#reg5); \
154 register type6 reg6 __asm(#reg6); \
157 #define RAF7(funname, type1, arg1, reg1, type2, arg2, reg2, type3, arg3, reg3, type4, arg4, reg4, type5, arg5, reg5, type6, arg6, reg6, type7, arg7, reg7) \
160 register type1 reg1 __asm(#reg1); \
162 register type2 reg2 __asm(#reg2); \
164 register type3 reg3 __asm(#reg3); \
166 register type4 reg4 __asm(#reg4); \
168 register type5 reg5 __asm(#reg5); \
170 register type6 reg6 __asm(#reg6); \
172 register type7 reg7 __asm(#reg7); \
175 #endif /* __SASC | __GNUC__ */
177 #endif /* !defined(AMIGA_RAF_H) */