3 #include <linux/compiler.h>
5 #if defined(CONFIG_X86)
7 * x86 does not have a dedicated register to store the pointer to
8 * the global_data. Thus the jump table address is stored in a
9 * global variable, but such approach does not allow for execution
10 * from flash memory. The global_data address is passed as argv[-1]
11 * to the application program.
16 #define EXPORT_FUNC(x) \
22 " jmp *(%%ecx, %%eax)\n" \
23 : : "i"(XF_ ## x * sizeof(void *)) : "eax", "ecx");
24 #elif defined(CONFIG_PPC)
26 * r2 holds the pointer to the global_data, r11 is a call-clobbered
29 #define EXPORT_FUNC(x) \
33 " lwz %%r11, %0(%%r2)\n" \
34 " lwz %%r11, %1(%%r11)\n" \
37 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r11");
38 #elif defined(CONFIG_ARM)
41 * x18 holds the pointer to the global_data, x9 is a call-clobbered
44 #define EXPORT_FUNC(x) \
48 " ldr x9, [x18, %0]\n" \
49 " ldr x9, [x9, %1]\n" \
51 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "x9");
54 * r9 holds the pointer to the global_data, ip is a call-clobbered
57 #define EXPORT_FUNC(x) \
61 " ldr ip, [r9, %0]\n" \
62 " ldr pc, [ip, %1]\n" \
63 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "ip");
65 #elif defined(CONFIG_MIPS)
67 * k0 ($26) holds the pointer to the global_data; t9 ($25) is a call-
68 * clobbered register that is also used to set gp ($26). Note that the
69 * jr instruction also executes the instruction immediately following
70 * it; however, GCC/mips generates an additional `nop' after each asm
73 #define EXPORT_FUNC(x) \
77 " lw $25, %0($26)\n" \
78 " lw $25, %1($25)\n" \
80 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "t9");
81 #elif defined(CONFIG_NIOS2)
83 * gp holds the pointer to the global_data, r8 is call-clobbered
85 #define EXPORT_FUNC(x) \
89 " movhi r8, %%hi(%0)\n" \
90 " ori r8, r0, %%lo(%0)\n" \
95 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "gp");
96 #elif defined(CONFIG_M68K)
98 * d7 holds the pointer to the global_data, a0 is a call-clobbered
101 #define EXPORT_FUNC(x) \
105 " move.l %%d7, %%a0\n" \
106 " adda.l %0, %%a0\n" \
107 " move.l (%%a0), %%a0\n" \
108 " adda.l %1, %%a0\n" \
109 " move.l (%%a0), %%a0\n" \
111 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "a0");
112 #elif defined(CONFIG_MICROBLAZE)
114 * r31 holds the pointer to the global_data. r5 is a call-clobbered.
116 #define EXPORT_FUNC(x) \
120 " lwi r5, r31, %0\n" \
121 " lwi r5, r5, %1\n" \
123 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r5");
124 #elif defined(CONFIG_BLACKFIN)
126 * P3 holds the pointer to the global_data, P0 is a call-clobbered
129 #define EXPORT_FUNC(x) \
131 " .globl _" #x "\n_" \
133 " P0 = [P3 + %0]\n" \
134 " P0 = [P0 + %1]\n" \
136 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "P0");
137 #elif defined(CONFIG_AVR32)
139 * r6 holds the pointer to the global_data. r8 is call clobbered.
141 #define EXPORT_FUNC(x) \
143 " .globl\t" #x "\n" \
145 " ld.w r8, r6[%0]\n" \
146 " ld.w pc, r8[%1]\n" \
148 : "i"(offsetof(gd_t, jt)), "i"(XF_ ##x) \
150 #elif defined(CONFIG_SH)
152 * r13 holds the pointer to the global_data. r1 is a call clobbered.
154 #define EXPORT_FUNC(x) \
167 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r1", "r2");
168 #elif defined(CONFIG_SPARC)
170 * g7 holds the pointer to the global_data. g1 is call clobbered.
172 #define EXPORT_FUNC(x) \
174 " .globl\t" #x "\n" \
177 " or %%g1, %%g7, %%g1\n" \
178 " ld [%%g1], %%g1\n" \
179 " ld [%%g1 + %1], %%g1\n" \
182 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "g1" );
183 #elif defined(CONFIG_NDS32)
185 * r16 holds the pointer to the global_data. gp is call clobbered.
186 * not support reduced register (16 GPR).
188 #define EXPORT_FUNC(x) \
192 " lwi $r16, [$gp + (%0)]\n" \
193 " lwi $r16, [$r16 + (%1)]\n" \
195 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "$r16");
196 #elif defined(CONFIG_OPENRISC)
198 * r10 holds the pointer to the global_data, r13 is a call-clobbered
201 #define EXPORT_FUNC(x) \
205 " l.lwz r13, %0(r10)\n" \
206 " l.lwz r13, %1(r13)\n" \
209 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r13");
210 #elif defined(CONFIG_ARC)
212 * r25 holds the pointer to the global_data. r10 is call clobbered.
214 #define EXPORT_FUNC(x) \
219 " ld r10, [r25, %0]\n" \
220 " ld r10, [r10, %1]\n" \
222 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r10");
224 /*" addi $sp, $sp, -24\n" \
227 #error stubs definition missing for this architecture
230 /* This function is necessary to prevent the compiler from
231 * generating prologue/epilogue, preparing stack frame etc.
232 * The stub functions are special, they do not use the stack
233 * frame passed to them, but pass it intact to the actual
234 * implementation. On the other hand, asm() statements with
235 * arguments can be used only inside the functions (gcc limitation)
237 #if GCC_VERSION < 30400
239 #endif /* GCC_VERSION */
240 void __attribute__((unused)) dummy(void)
242 #include <_exports.h>
245 #include <asm/sections.h>
247 void app_startup(char * const *argv)
249 char *cp = __bss_start;
255 #if defined(CONFIG_X86)
256 /* x86 does not have a dedicated register for passing global_data */
257 global_data = (gd_t *)argv[-1];
258 jt = global_data->jt;