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)
43 * r8 holds the pointer to the global_data, ip is a call-clobbered
46 #define EXPORT_FUNC(x) \
50 " ldr ip, [r8, %0]\n" \
51 " ldr pc, [ip, %1]\n" \
52 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "ip");
53 #elif defined(CONFIG_MIPS)
55 * k0 ($26) holds the pointer to the global_data; t9 ($25) is a call-
56 * clobbered register that is also used to set gp ($26). Note that the
57 * jr instruction also executes the instruction immediately following
58 * it; however, GCC/mips generates an additional `nop' after each asm
61 #define EXPORT_FUNC(x) \
65 " lw $25, %0($26)\n" \
66 " lw $25, %1($25)\n" \
68 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "t9");
69 #elif defined(CONFIG_NIOS2)
71 * gp holds the pointer to the global_data, r8 is call-clobbered
73 #define EXPORT_FUNC(x) \
77 " movhi r8, %%hi(%0)\n" \
78 " ori r8, r0, %%lo(%0)\n" \
83 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "gp");
84 #elif defined(CONFIG_M68K)
86 * d7 holds the pointer to the global_data, a0 is a call-clobbered
89 #define EXPORT_FUNC(x) \
93 " move.l %%d7, %%a0\n" \
94 " adda.l %0, %%a0\n" \
95 " move.l (%%a0), %%a0\n" \
96 " adda.l %1, %%a0\n" \
97 " move.l (%%a0), %%a0\n" \
99 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "a0");
100 #elif defined(CONFIG_MICROBLAZE)
102 * r31 holds the pointer to the global_data. r5 is a call-clobbered.
104 #define EXPORT_FUNC(x) \
108 " lwi r5, r31, %0\n" \
109 " lwi r5, r5, %1\n" \
111 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r5");
112 #elif defined(CONFIG_BLACKFIN)
114 * P3 holds the pointer to the global_data, P0 is a call-clobbered
117 #define EXPORT_FUNC(x) \
119 " .globl _" #x "\n_" \
121 " P0 = [P3 + %0]\n" \
122 " P0 = [P0 + %1]\n" \
124 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "P0");
125 #elif defined(CONFIG_AVR32)
127 * r6 holds the pointer to the global_data. r8 is call clobbered.
129 #define EXPORT_FUNC(x) \
131 " .globl\t" #x "\n" \
133 " ld.w r8, r6[%0]\n" \
134 " ld.w pc, r8[%1]\n" \
136 : "i"(offsetof(gd_t, jt)), "i"(XF_ ##x) \
138 #elif defined(CONFIG_SH)
140 * r13 holds the pointer to the global_data. r1 is a call clobbered.
142 #define EXPORT_FUNC(x) \
155 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r1", "r2");
156 #elif defined(CONFIG_SPARC)
158 * g7 holds the pointer to the global_data. g1 is call clobbered.
160 #define EXPORT_FUNC(x) \
162 " .globl\t" #x "\n" \
165 " or %%g1, %%g7, %%g1\n" \
166 " ld [%%g1], %%g1\n" \
167 " ld [%%g1 + %1], %%g1\n" \
170 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "g1" );
171 #elif defined(CONFIG_NDS32)
173 * r16 holds the pointer to the global_data. gp is call clobbered.
174 * not support reduced register (16 GPR).
176 #define EXPORT_FUNC(x) \
180 " lwi $r16, [$gp + (%0)]\n" \
181 " lwi $r16, [$r16 + (%1)]\n" \
183 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "$r16");
184 #elif defined(CONFIG_OPENRISC)
186 * r10 holds the pointer to the global_data, r13 is a call-clobbered
189 #define EXPORT_FUNC(x) \
193 " l.lwz r13, %0(r10)\n" \
194 " l.lwz r13, %1(r13)\n" \
197 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r13");
199 /*" addi $sp, $sp, -24\n" \
202 #error stubs definition missing for this architecture
205 /* This function is necessary to prevent the compiler from
206 * generating prologue/epilogue, preparing stack frame etc.
207 * The stub functions are special, they do not use the stack
208 * frame passed to them, but pass it intact to the actual
209 * implementation. On the other hand, asm() statements with
210 * arguments can be used only inside the functions (gcc limitation)
212 #if GCC_VERSION < 3004
214 #endif /* GCC_VERSION */
215 void __attribute__((unused)) dummy(void)
217 #include <_exports.h>
220 #include <asm/sections.h>
222 void app_startup(char * const *argv)
224 char *cp = __bss_start;
230 #if defined(CONFIG_X86)
231 /* x86 does not have a dedicated register for passing global_data */
232 global_data = (gd_t *)argv[-1];
233 jt = global_data->jt;