4 #define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
5 #endif /* GCC_VERSION */
7 #if defined(CONFIG_I386)
9 * x86 does not have a dedicated register to store the pointer to
10 * the global_data. Thus the jump table address is stored in a
11 * global variable, but such approach does not allow for execution
12 * from flash memory. The global_data address is passed as argv[-1]
13 * to the application program.
18 #define EXPORT_FUNC(x) \
24 " jmp *(%%ecx, %%eax)\n" \
25 : : "i"(XF_ ## x * sizeof(void *)) : "eax", "ecx");
26 #elif defined(CONFIG_PPC)
28 * r2 holds the pointer to the global_data, r11 is a call-clobbered
31 #define EXPORT_FUNC(x) \
35 " lwz %%r11, %0(%%r2)\n" \
36 " lwz %%r11, %1(%%r11)\n" \
39 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r11");
40 #elif defined(CONFIG_ARM)
42 * r8 holds the pointer to the global_data, ip is a call-clobbered
45 #define EXPORT_FUNC(x) \
49 " ldr ip, [r8, %0]\n" \
50 " ldr pc, [ip, %1]\n" \
51 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "ip");
52 #elif defined(CONFIG_MIPS)
54 * k0 ($26) holds the pointer to the global_data; t9 ($25) is a call-
55 * clobbered register that is also used to set gp ($26). Note that the
56 * jr instruction also executes the instruction immediately following
57 * it; however, GCC/mips generates an additional `nop' after each asm
60 #define EXPORT_FUNC(x) \
64 " lw $25, %0($26)\n" \
65 " lw $25, %1($25)\n" \
67 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "t9");
68 #elif defined(CONFIG_NIOS2)
70 * gp holds the pointer to the global_data, r8 is call-clobbered
72 #define EXPORT_FUNC(x) \
76 " movhi r8, %%hi(%0)\n" \
77 " ori r8, r0, %%lo(%0)\n" \
82 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "gp");
83 #elif defined(CONFIG_M68K)
85 * d7 holds the pointer to the global_data, a0 is a call-clobbered
88 #define EXPORT_FUNC(x) \
92 " move.l %%d7, %%a0\n" \
93 " adda.l %0, %%a0\n" \
94 " move.l (%%a0), %%a0\n" \
95 " adda.l %1, %%a0\n" \
96 " move.l (%%a0), %%a0\n" \
98 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "a0");
99 #elif defined(CONFIG_MICROBLAZE)
101 * r31 holds the pointer to the global_data. r5 is a call-clobbered.
103 #define EXPORT_FUNC(x) \
107 " lwi r5, r31, %0\n" \
108 " lwi r5, r5, %1\n" \
110 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r5");
111 #elif defined(CONFIG_BLACKFIN)
113 * P3 holds the pointer to the global_data, P0 is a call-clobbered
116 #define EXPORT_FUNC(x) \
118 " .globl _" #x "\n_" \
120 " P0 = [P3 + %0]\n" \
121 " P0 = [P0 + %1]\n" \
123 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "P0");
124 #elif defined(CONFIG_AVR32)
126 * r6 holds the pointer to the global_data. r8 is call clobbered.
128 #define EXPORT_FUNC(x) \
130 " .globl\t" #x "\n" \
132 " ld.w r8, r6[%0]\n" \
133 " ld.w pc, r8[%1]\n" \
135 : "i"(offsetof(gd_t, jt)), "i"(XF_ ##x) \
137 #elif defined(CONFIG_SH)
139 * r13 holds the pointer to the global_data. r1 is a call clobbered.
141 #define EXPORT_FUNC(x) \
154 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r1", "r2");
155 #elif defined(CONFIG_SPARC)
157 * g7 holds the pointer to the global_data. g1 is call clobbered.
159 #define EXPORT_FUNC(x) \
161 " .globl\t" #x "\n" \
164 " or %%g1, %%g7, %%g1\n" \
165 " ld [%%g1], %%g1\n" \
166 " ld [%%g1 + %1], %%g1\n" \
169 : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "g1" );
172 #error stubs definition missing for this architecture
175 /* This function is necessary to prevent the compiler from
176 * generating prologue/epilogue, preparing stack frame etc.
177 * The stub functions are special, they do not use the stack
178 * frame passed to them, but pass it intact to the actual
179 * implementation. On the other hand, asm() statements with
180 * arguments can be used only inside the functions (gcc limitation)
182 #if GCC_VERSION < 3004
184 #endif /* GCC_VERSION */
185 void __attribute__((unused)) dummy(void)
187 #include <_exports.h>
190 extern unsigned long __bss_start, _end;
192 void app_startup(char * const *argv)
194 unsigned char * cp = (unsigned char *) &__bss_start;
197 while (cp < (unsigned char *)&_end) {
201 #if defined(CONFIG_I386)
202 /* x86 does not have a dedicated register for passing global_data */
203 global_data = (gd_t *)argv[-1];
204 jt = global_data->jt;