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_NIOS)
70
* %g7 holds the pointer to the global_data. %g0 is call clobbered.
72
#define EXPORT_FUNC(x) \
77
" movi %%g0, %%lo(%0)\n" \
79
" ld %%g0, [%%g0]\n" \
81
" ld %%g0, [%%g0]\n" \
84
: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x) : "r0");
85
#elif defined(CONFIG_NIOS2)
87
* r15 holds the pointer to the global_data, r8 is call-clobbered
89
#define EXPORT_FUNC(x) \
93
" movhi r8, %%hi(%0)\n" \
94
" ori r8, r0, %%lo(%0)\n" \
95
" add r8, r8, r15\n" \
99
: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r15");
100
#elif defined(CONFIG_M68K)
102
* d7 holds the pointer to the global_data, a0 is a call-clobbered
105
#define EXPORT_FUNC(x) \
109
" move.l %%d7, %%a0\n" \
110
" adda.l %0, %%a0\n" \
111
" move.l (%%a0), %%a0\n" \
112
" adda.l %1, %%a0\n" \
113
" move.l (%%a0), %%a0\n" \
115
: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "a0");
116
#elif defined(CONFIG_MICROBLAZE)
118
* r31 holds the pointer to the global_data. r5 is a call-clobbered.
120
#define EXPORT_FUNC(x) \
124
" lwi r5, r31, %0\n" \
125
" lwi r5, r5, %1\n" \
127
: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r5");
128
#elif defined(CONFIG_BLACKFIN)
130
* P5 holds the pointer to the global_data, P0 is a call-clobbered
133
#define EXPORT_FUNC(x) \
135
" .globl _" #x "\n_" \
137
" P0 = [P5 + %0]\n" \
138
" P0 = [P0 + %1]\n" \
140
: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "P0");
141
#elif defined(CONFIG_AVR32)
143
* r6 holds the pointer to the global_data. r8 is call clobbered.
145
#define EXPORT_FUNC(x) \
147
" .globl\t" #x "\n" \
149
" ld.w r8, r6[%0]\n" \
150
" ld.w pc, r8[%1]\n" \
152
: "i"(offsetof(gd_t, jt)), "i"(XF_ ##x) \
154
#elif defined(CONFIG_SH)
156
* r13 holds the pointer to the global_data. r1 is a call clobbered.
158
#define EXPORT_FUNC(x) \
171
: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r1", "r2");
172
#elif defined(CONFIG_SPARC)
174
* g7 holds the pointer to the global_data. g1 is call clobbered.
176
#define EXPORT_FUNC(x) \
178
" .globl\t" #x "\n" \
181
" or %%g1, %%g7, %%g1\n" \
182
" ld [%%g1], %%g1\n" \
183
" ld [%%g1 + %1], %%g1\n" \
186
: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x) : "g1" );
189
#error stubs definition missing for this architecture
192
/* This function is necessary to prevent the compiler from
193
* generating prologue/epilogue, preparing stack frame etc.
194
* The stub functions are special, they do not use the stack
195
* frame passed to them, but pass it intact to the actual
196
* implementation. On the other hand, asm() statements with
197
* arguments can be used only inside the functions (gcc limitation)
199
#if GCC_VERSION < 3004
201
#endif /* GCC_VERSION */
202
void __attribute__((unused)) dummy(void)
204
#include <_exports.h>
207
extern unsigned long __bss_start, _end;
209
void app_startup(char **argv)
211
unsigned char * cp = (unsigned char *) &__bss_start;
214
while (cp < (unsigned char *)&_end) {
218
#if defined(CONFIG_I386)
219
/* x86 does not have a dedicated register for passing global_data */
220
global_data = (gd_t *)argv[-1];
221
jt = global_data->jt;