5 #define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
6 #endif /* GCC_VERSION */
8 #if defined(CONFIG_X86)
10 * x86 does not have a dedicated register to store the pointer to
11 * the global_data. Thus the jump table address is stored in a
12 * global variable, but such approach does not allow for execution
13 * from flash memory. The global_data address is passed as argv[-1]
14 * to the application program.
19 #define EXPORT_FUNC(x) \
25 " jmp *(%%ecx, %%eax)\n" \
26 : : "i"(XF_ ## x * sizeof(void *)) : "eax", "ecx");
27 #elif defined(CONFIG_PPC)
29 * r2 holds the pointer to the global_data, r11 is a call-clobbered
32 #define EXPORT_FUNC(x) \
36 " lwz %%r11, %0(%%r2)\n" \
37 " lwz %%r11, %1(%%r11)\n" \
40 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r11");
41 #elif defined(CONFIG_ARM)
44 * x18 holds the pointer to the global_data, x9 is a call-clobbered
47 #define EXPORT_FUNC(x) \
51 " ldr x9, [x18, %0]\n" \
52 " ldr x9, [x9, %1]\n" \
54 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "x9");
57 * r9 holds the pointer to the global_data, ip is a call-clobbered
60 #define EXPORT_FUNC(x) \
64 " ldr ip, [r9, %0]\n" \
65 " ldr pc, [ip, %1]\n" \
66 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "ip");
68 #elif defined(CONFIG_MIPS)
70 * k0 ($26) holds the pointer to the global_data; t9 ($25) is a call-
71 * clobbered register that is also used to set gp ($26). Note that the
72 * jr instruction also executes the instruction immediately following
73 * it; however, GCC/mips generates an additional `nop' after each asm
76 #define EXPORT_FUNC(x) \
80 " lw $25, %0($26)\n" \
81 " lw $25, %1($25)\n" \
83 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "t9");
84 #elif defined(CONFIG_NIOS2)
86 * gp holds the pointer to the global_data, r8 is call-clobbered
88 #define EXPORT_FUNC(x) \
92 " movhi r8, %%hi(%0)\n" \
93 " ori r8, r0, %%lo(%0)\n" \
98 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "gp");
99 #elif defined(CONFIG_M68K)
101 * d7 holds the pointer to the global_data, a0 is a call-clobbered
104 #define EXPORT_FUNC(x) \
108 " move.l %%d7, %%a0\n" \
109 " adda.l %0, %%a0\n" \
110 " move.l (%%a0), %%a0\n" \
111 " adda.l %1, %%a0\n" \
112 " move.l (%%a0), %%a0\n" \
114 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "a0");
115 #elif defined(CONFIG_MICROBLAZE)
117 * r31 holds the pointer to the global_data. r5 is a call-clobbered.
119 #define EXPORT_FUNC(x) \
123 " lwi r5, r31, %0\n" \
124 " lwi r5, r5, %1\n" \
126 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r5");
127 #elif defined(CONFIG_BLACKFIN)
129 * P3 holds the pointer to the global_data, P0 is a call-clobbered
132 #define EXPORT_FUNC(x) \
134 " .globl _" #x "\n_" \
136 " P0 = [P3 + %0]\n" \
137 " P0 = [P0 + %1]\n" \
139 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "P0");
140 #elif defined(CONFIG_AVR32)
142 * r6 holds the pointer to the global_data. r8 is call clobbered.
144 #define EXPORT_FUNC(x) \
146 " .globl\t" #x "\n" \
148 " ld.w r8, r6[%0]\n" \
149 " ld.w pc, r8[%1]\n" \
151 : "i"(offsetof(gd_t, jt)), "i"(XF_ ##x) \
153 #elif defined(CONFIG_SH)
155 * r13 holds the pointer to the global_data. r1 is a call clobbered.
157 #define EXPORT_FUNC(x) \
170 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r1", "r2");
171 #elif defined(CONFIG_SPARC)
173 * g7 holds the pointer to the global_data. g1 is call clobbered.
175 #define EXPORT_FUNC(x) \
177 " .globl\t" #x "\n" \
180 " or %%g1, %%g7, %%g1\n" \
181 " ld [%%g1], %%g1\n" \
182 " ld [%%g1 + %1], %%g1\n" \
185 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "g1" );
186 #elif defined(CONFIG_NDS32)
188 * r16 holds the pointer to the global_data. gp is call clobbered.
189 * not support reduced register (16 GPR).
191 #define EXPORT_FUNC(x) \
195 " lwi $r16, [$gp + (%0)]\n" \
196 " lwi $r16, [$r16 + (%1)]\n" \
198 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "$r16");
199 #elif defined(CONFIG_OPENRISC)
201 * r10 holds the pointer to the global_data, r13 is a call-clobbered
204 #define EXPORT_FUNC(x) \
208 " l.lwz r13, %0(r10)\n" \
209 " l.lwz r13, %1(r13)\n" \
212 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r13");
213 #elif defined(CONFIG_ARC)
215 * r25 holds the pointer to the global_data. r10 is call clobbered.
217 #define EXPORT_FUNC(x) \
222 " ld r10, [r25, %0]\n" \
223 " ld r10, [r10, %1]\n" \
225 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r10");
227 /*" addi $sp, $sp, -24\n" \
230 #error stubs definition missing for this architecture
233 /* This function is necessary to prevent the compiler from
234 * generating prologue/epilogue, preparing stack frame etc.
235 * The stub functions are special, they do not use the stack
236 * frame passed to them, but pass it intact to the actual
237 * implementation. On the other hand, asm() statements with
238 * arguments can be used only inside the functions (gcc limitation)
240 #if GCC_VERSION < 3004
242 #endif /* GCC_VERSION */
243 void __attribute__((unused)) dummy(void)
245 #include <_exports.h>
248 #include <asm/sections.h>
250 void app_startup(char * const *argv)
252 char *cp = __bss_start;
258 #if defined(CONFIG_X86)
259 /* x86 does not have a dedicated register for passing global_data */
260 global_data = (gd_t *)argv[-1];
261 jt = global_data->jt;