Mike Partington | 46f387d | 2010-10-27 10:31:09 +0000 | [diff] [blame] | 1 | #include <common.h> |
wdenk | 874ac26 | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 2 | #include <exports.h> |
Masahiro Yamada | 8400275 | 2014-09-04 02:40:59 +0900 | [diff] [blame] | 3 | #include <linux/compiler.h> |
wdenk | 3337af4 | 2004-07-01 20:28:03 +0000 | [diff] [blame] | 4 | |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 5 | #define FO(x) offsetof(struct jt_funcs, x) |
| 6 | |
Graeme Russ | cbfce1d | 2011-04-13 19:43:28 +1000 | [diff] [blame] | 7 | #if defined(CONFIG_X86) |
wdenk | 874ac26 | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 8 | /* |
| 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. |
| 14 | */ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 15 | static struct jt_funcs *jt; |
wdenk | b846356 | 2003-07-26 08:08:08 +0000 | [diff] [blame] | 16 | gd_t *global_data; |
wdenk | 874ac26 | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 17 | |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 18 | #define EXPORT_FUNC(f, a, x, ...) \ |
wdenk | 874ac26 | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 19 | asm volatile ( \ |
| 20 | " .globl " #x "\n" \ |
| 21 | #x ":\n" \ |
| 22 | " movl %0, %%eax\n" \ |
| 23 | " movl jt, %%ecx\n" \ |
| 24 | " jmp *(%%ecx, %%eax)\n" \ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 25 | : : "i"(FO(x)) : "eax", "ecx"); |
wdenk | 874ac26 | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 26 | #elif defined(CONFIG_PPC) |
| 27 | /* |
Wolfgang Denk | 69c0964 | 2008-02-14 22:43:22 +0100 | [diff] [blame] | 28 | * r2 holds the pointer to the global_data, r11 is a call-clobbered |
wdenk | 874ac26 | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 29 | * register |
| 30 | */ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 31 | #define EXPORT_FUNC(f, a, x, ...) \ |
wdenk | 874ac26 | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 32 | asm volatile ( \ |
| 33 | " .globl " #x "\n" \ |
| 34 | #x ":\n" \ |
Wolfgang Denk | 69c0964 | 2008-02-14 22:43:22 +0100 | [diff] [blame] | 35 | " lwz %%r11, %0(%%r2)\n" \ |
wdenk | 874ac26 | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 36 | " lwz %%r11, %1(%%r11)\n" \ |
| 37 | " mtctr %%r11\n" \ |
| 38 | " bctr\n" \ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 39 | : : "i"(offsetof(gd_t, jt)), "i"(FO(x)) : "r11"); |
wdenk | 874ac26 | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 40 | #elif defined(CONFIG_ARM) |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 41 | #ifdef CONFIG_ARM64 |
| 42 | /* |
| 43 | * x18 holds the pointer to the global_data, x9 is a call-clobbered |
| 44 | * register |
| 45 | */ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 46 | #define EXPORT_FUNC(f, a, x, ...) \ |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 47 | asm volatile ( \ |
| 48 | " .globl " #x "\n" \ |
| 49 | #x ":\n" \ |
| 50 | " ldr x9, [x18, %0]\n" \ |
| 51 | " ldr x9, [x9, %1]\n" \ |
| 52 | " br x9\n" \ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 53 | : : "i"(offsetof(gd_t, jt)), "i"(FO(x)) : "x9"); |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 54 | #else |
wdenk | 874ac26 | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 55 | /* |
Jeroen Hofstee | b00867b | 2013-11-21 22:32:51 +0100 | [diff] [blame] | 56 | * r9 holds the pointer to the global_data, ip is a call-clobbered |
wdenk | 874ac26 | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 57 | * register |
| 58 | */ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 59 | #define EXPORT_FUNC(f, a, x, ...) \ |
wdenk | 874ac26 | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 60 | asm volatile ( \ |
| 61 | " .globl " #x "\n" \ |
| 62 | #x ":\n" \ |
Jeroen Hofstee | b00867b | 2013-11-21 22:32:51 +0100 | [diff] [blame] | 63 | " ldr ip, [r9, %0]\n" \ |
wdenk | 874ac26 | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 64 | " ldr pc, [ip, %1]\n" \ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 65 | : : "i"(offsetof(gd_t, jt)), "i"(FO(x)) : "ip"); |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 66 | #endif |
wdenk | 874ac26 | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 67 | #elif defined(CONFIG_MIPS) |
Stanislav Galabov | 26f182d | 2016-02-17 15:23:33 +0200 | [diff] [blame] | 68 | #ifdef CONFIG_CPU_MIPS64 |
wdenk | 874ac26 | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 69 | /* |
| 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 |
| 74 | * statement |
| 75 | */ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 76 | #define EXPORT_FUNC(f, a, x, ...) \ |
wdenk | 874ac26 | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 77 | asm volatile ( \ |
| 78 | " .globl " #x "\n" \ |
| 79 | #x ":\n" \ |
Stanislav Galabov | 26f182d | 2016-02-17 15:23:33 +0200 | [diff] [blame] | 80 | " ld $25, %0($26)\n" \ |
| 81 | " ld $25, %1($25)\n" \ |
| 82 | " jr $25\n" \ |
| 83 | : : "i"(offsetof(gd_t, jt)), "i"(FO(x)) : "t9"); |
| 84 | #else |
| 85 | /* |
| 86 | * k0 ($26) holds the pointer to the global_data; t9 ($25) is a call- |
| 87 | * clobbered register that is also used to set gp ($26). Note that the |
| 88 | * jr instruction also executes the instruction immediately following |
| 89 | * it; however, GCC/mips generates an additional `nop' after each asm |
| 90 | * statement |
| 91 | */ |
| 92 | #define EXPORT_FUNC(f, a, x, ...) \ |
| 93 | asm volatile ( \ |
| 94 | " .globl " #x "\n" \ |
| 95 | #x ":\n" \ |
wdenk | 874ac26 | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 96 | " lw $25, %0($26)\n" \ |
| 97 | " lw $25, %1($25)\n" \ |
| 98 | " jr $25\n" \ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 99 | : : "i"(offsetof(gd_t, jt)), "i"(FO(x)) : "t9"); |
Stanislav Galabov | 26f182d | 2016-02-17 15:23:33 +0200 | [diff] [blame] | 100 | #endif |
wdenk | ef3386f | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 101 | #elif defined(CONFIG_NIOS2) |
| 102 | /* |
Thomas Chou | 8fa3858 | 2010-05-21 11:08:03 +0800 | [diff] [blame] | 103 | * gp holds the pointer to the global_data, r8 is call-clobbered |
wdenk | ef3386f | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 104 | */ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 105 | #define EXPORT_FUNC(f, a, x, ...) \ |
wdenk | ef3386f | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 106 | asm volatile ( \ |
| 107 | " .globl " #x "\n" \ |
| 108 | #x ":\n" \ |
| 109 | " movhi r8, %%hi(%0)\n" \ |
| 110 | " ori r8, r0, %%lo(%0)\n" \ |
Thomas Chou | 8fa3858 | 2010-05-21 11:08:03 +0800 | [diff] [blame] | 111 | " add r8, r8, gp\n" \ |
wdenk | ef3386f | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 112 | " ldw r8, 0(r8)\n" \ |
| 113 | " ldw r8, %1(r8)\n" \ |
| 114 | " jmp r8\n" \ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 115 | : : "i"(offsetof(gd_t, jt)), "i"(FO(x)) : "gp"); |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 116 | #elif defined(CONFIG_M68K) |
| 117 | /* |
| 118 | * d7 holds the pointer to the global_data, a0 is a call-clobbered |
| 119 | * register |
| 120 | */ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 121 | #define EXPORT_FUNC(f, a, x, ...) \ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 122 | asm volatile ( \ |
| 123 | " .globl " #x "\n" \ |
| 124 | #x ":\n" \ |
| 125 | " move.l %%d7, %%a0\n" \ |
| 126 | " adda.l %0, %%a0\n" \ |
| 127 | " move.l (%%a0), %%a0\n" \ |
| 128 | " adda.l %1, %%a0\n" \ |
| 129 | " move.l (%%a0), %%a0\n" \ |
| 130 | " jmp (%%a0)\n" \ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 131 | : : "i"(offsetof(gd_t, jt)), "i"(FO(x)) : "a0"); |
wdenk | 20a6122 | 2004-07-10 23:48:41 +0000 | [diff] [blame] | 132 | #elif defined(CONFIG_MICROBLAZE) |
wdenk | 1249065 | 2004-04-18 21:13:41 +0000 | [diff] [blame] | 133 | /* |
| 134 | * r31 holds the pointer to the global_data. r5 is a call-clobbered. |
| 135 | */ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 136 | #define EXPORT_FUNC(f, a, x, ...) \ |
wdenk | 1249065 | 2004-04-18 21:13:41 +0000 | [diff] [blame] | 137 | asm volatile ( \ |
| 138 | " .globl " #x "\n" \ |
| 139 | #x ":\n" \ |
| 140 | " lwi r5, r31, %0\n" \ |
| 141 | " lwi r5, r5, %1\n" \ |
| 142 | " bra r5\n" \ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 143 | : : "i"(offsetof(gd_t, jt)), "i"(FO(x)) : "r5"); |
Wolfgang Denk | 46d2b52 | 2006-03-12 02:10:00 +0100 | [diff] [blame] | 144 | #elif defined(CONFIG_BLACKFIN) |
| 145 | /* |
Robin Getz | 2773d5f | 2009-08-17 15:23:02 +0000 | [diff] [blame] | 146 | * P3 holds the pointer to the global_data, P0 is a call-clobbered |
Wolfgang Denk | 46d2b52 | 2006-03-12 02:10:00 +0100 | [diff] [blame] | 147 | * register |
| 148 | */ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 149 | #define EXPORT_FUNC(f, a, x, ...) \ |
Wolfgang Denk | 2bad868 | 2006-03-12 02:55:22 +0100 | [diff] [blame] | 150 | asm volatile ( \ |
Wolfgang Denk | 0a5c214 | 2007-12-27 01:52:50 +0100 | [diff] [blame] | 151 | " .globl _" #x "\n_" \ |
Wolfgang Denk | 46d2b52 | 2006-03-12 02:10:00 +0100 | [diff] [blame] | 152 | #x ":\n" \ |
Robin Getz | 2773d5f | 2009-08-17 15:23:02 +0000 | [diff] [blame] | 153 | " P0 = [P3 + %0]\n" \ |
Wolfgang Denk | 46d2b52 | 2006-03-12 02:10:00 +0100 | [diff] [blame] | 154 | " P0 = [P0 + %1]\n" \ |
| 155 | " JUMP (P0)\n" \ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 156 | : : "i"(offsetof(gd_t, jt)), "i"(FO(x)) : "P0"); |
Wolfgang Denk | 83c1585 | 2006-10-24 14:21:16 +0200 | [diff] [blame] | 157 | #elif defined(CONFIG_AVR32) |
| 158 | /* |
| 159 | * r6 holds the pointer to the global_data. r8 is call clobbered. |
| 160 | */ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 161 | #define EXPORT_FUNC(f, a, x, ...) \ |
Wolfgang Denk | 83c1585 | 2006-10-24 14:21:16 +0200 | [diff] [blame] | 162 | asm volatile( \ |
| 163 | " .globl\t" #x "\n" \ |
| 164 | #x ":\n" \ |
| 165 | " ld.w r8, r6[%0]\n" \ |
| 166 | " ld.w pc, r8[%1]\n" \ |
| 167 | : \ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 168 | : "i"(offsetof(gd_t, jt)), "i"(FO(x)) \ |
Wolfgang Denk | 83c1585 | 2006-10-24 14:21:16 +0200 | [diff] [blame] | 169 | : "r8"); |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 170 | #elif defined(CONFIG_SH) |
| 171 | /* |
| 172 | * r13 holds the pointer to the global_data. r1 is a call clobbered. |
| 173 | */ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 174 | #define EXPORT_FUNC(f, a, x, ...) \ |
Wolfgang Denk | 0a5c214 | 2007-12-27 01:52:50 +0100 | [diff] [blame] | 175 | asm volatile ( \ |
| 176 | " .align 2\n" \ |
| 177 | " .globl " #x "\n" \ |
| 178 | #x ":\n" \ |
| 179 | " mov r13, r1\n" \ |
| 180 | " add %0, r1\n" \ |
Nobuhiro Iwamatsu | d1d1850 | 2008-10-09 13:54:33 +0900 | [diff] [blame] | 181 | " mov.l @r1, r2\n" \ |
| 182 | " add %1, r2\n" \ |
| 183 | " mov.l @r2, r1\n" \ |
Wolfgang Denk | 0a5c214 | 2007-12-27 01:52:50 +0100 | [diff] [blame] | 184 | " jmp @r1\n" \ |
| 185 | " nop\n" \ |
| 186 | " nop\n" \ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 187 | : : "i"(offsetof(gd_t, jt)), "i"(FO(x)) : "r1", "r2"); |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 188 | #elif defined(CONFIG_SPARC) |
| 189 | /* |
| 190 | * g7 holds the pointer to the global_data. g1 is call clobbered. |
| 191 | */ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 192 | #define EXPORT_FUNC(f, a, x, ...) \ |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 193 | asm volatile( \ |
| 194 | " .globl\t" #x "\n" \ |
| 195 | #x ":\n" \ |
| 196 | " set %0, %%g1\n" \ |
| 197 | " or %%g1, %%g7, %%g1\n" \ |
| 198 | " ld [%%g1], %%g1\n" \ |
| 199 | " ld [%%g1 + %1], %%g1\n" \ |
Sergey Mironov | aa44cf6 | 2009-09-23 16:47:38 +0400 | [diff] [blame] | 200 | " jmp %%g1\n" \ |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 201 | " nop\n" \ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 202 | : : "i"(offsetof(gd_t, jt)), "i"(FO(x)) : "g1"); |
Macpaul Lin | 394c76a | 2011-10-11 22:33:20 +0000 | [diff] [blame] | 203 | #elif defined(CONFIG_NDS32) |
| 204 | /* |
| 205 | * r16 holds the pointer to the global_data. gp is call clobbered. |
| 206 | * not support reduced register (16 GPR). |
| 207 | */ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 208 | #define EXPORT_FUNC(f, a, x, ...) \ |
Macpaul Lin | 394c76a | 2011-10-11 22:33:20 +0000 | [diff] [blame] | 209 | asm volatile ( \ |
| 210 | " .globl " #x "\n" \ |
| 211 | #x ":\n" \ |
| 212 | " lwi $r16, [$gp + (%0)]\n" \ |
| 213 | " lwi $r16, [$r16 + (%1)]\n" \ |
| 214 | " jr $r16\n" \ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 215 | : : "i"(offsetof(gd_t, jt)), "i"(FO(x)) : "$r16"); |
Stefan Kristiansson | 333c46e | 2011-11-18 19:21:35 +0000 | [diff] [blame] | 216 | #elif defined(CONFIG_OPENRISC) |
| 217 | /* |
| 218 | * r10 holds the pointer to the global_data, r13 is a call-clobbered |
| 219 | * register |
| 220 | */ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 221 | #define EXPORT_FUNC(f, a, x, ...) \ |
Stefan Kristiansson | 333c46e | 2011-11-18 19:21:35 +0000 | [diff] [blame] | 222 | asm volatile ( \ |
| 223 | " .globl " #x "\n" \ |
| 224 | #x ":\n" \ |
| 225 | " l.lwz r13, %0(r10)\n" \ |
| 226 | " l.lwz r13, %1(r13)\n" \ |
| 227 | " l.jr r13\n" \ |
| 228 | " l.nop\n" \ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 229 | : : "i"(offsetof(gd_t, jt)), "i"(FO(x)) : "r13"); |
Alexey Brodkin | cb25a73 | 2014-02-04 12:56:17 +0400 | [diff] [blame] | 230 | #elif defined(CONFIG_ARC) |
| 231 | /* |
| 232 | * r25 holds the pointer to the global_data. r10 is call clobbered. |
| 233 | */ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 234 | #define EXPORT_FUNC(f, a, x, ...) \ |
Alexey Brodkin | cb25a73 | 2014-02-04 12:56:17 +0400 | [diff] [blame] | 235 | asm volatile( \ |
| 236 | " .align 4\n" \ |
| 237 | " .globl " #x "\n" \ |
| 238 | #x ":\n" \ |
| 239 | " ld r10, [r25, %0]\n" \ |
| 240 | " ld r10, [r10, %1]\n" \ |
| 241 | " j [r10]\n" \ |
Martin Dorwig | cb2c286 | 2015-01-26 15:22:54 -0700 | [diff] [blame] | 242 | : : "i"(offsetof(gd_t, jt)), "i"(FO(x)) : "r10"); |
wdenk | 874ac26 | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 243 | #else |
Macpaul Lin | 394c76a | 2011-10-11 22:33:20 +0000 | [diff] [blame] | 244 | /*" addi $sp, $sp, -24\n" \ |
| 245 | " br $r16\n" \*/ |
| 246 | |
wdenk | 874ac26 | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 247 | #error stubs definition missing for this architecture |
| 248 | #endif |
| 249 | |
| 250 | /* This function is necessary to prevent the compiler from |
| 251 | * generating prologue/epilogue, preparing stack frame etc. |
| 252 | * The stub functions are special, they do not use the stack |
| 253 | * frame passed to them, but pass it intact to the actual |
| 254 | * implementation. On the other hand, asm() statements with |
| 255 | * arguments can be used only inside the functions (gcc limitation) |
| 256 | */ |
Masahiro Yamada | 8400275 | 2014-09-04 02:40:59 +0900 | [diff] [blame] | 257 | #if GCC_VERSION < 30400 |
wdenk | 3337af4 | 2004-07-01 20:28:03 +0000 | [diff] [blame] | 258 | static |
| 259 | #endif /* GCC_VERSION */ |
| 260 | void __attribute__((unused)) dummy(void) |
wdenk | 874ac26 | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 261 | { |
| 262 | #include <_exports.h> |
| 263 | } |
| 264 | |
Simon Glass | 5b92820 | 2013-03-05 14:39:39 +0000 | [diff] [blame] | 265 | #include <asm/sections.h> |
wdenk | 2fb7390 | 2004-04-12 16:12:49 +0000 | [diff] [blame] | 266 | |
Wolfgang Denk | 6262d021 | 2010-06-28 22:00:46 +0200 | [diff] [blame] | 267 | void app_startup(char * const *argv) |
wdenk | 874ac26 | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 268 | { |
Simon Glass | 5b92820 | 2013-03-05 14:39:39 +0000 | [diff] [blame] | 269 | char *cp = __bss_start; |
wdenk | 2fb7390 | 2004-04-12 16:12:49 +0000 | [diff] [blame] | 270 | |
| 271 | /* Zero out BSS */ |
Simon Glass | 5b92820 | 2013-03-05 14:39:39 +0000 | [diff] [blame] | 272 | while (cp < _end) |
wdenk | 2fb7390 | 2004-04-12 16:12:49 +0000 | [diff] [blame] | 273 | *cp++ = 0; |
wdenk | 2fb7390 | 2004-04-12 16:12:49 +0000 | [diff] [blame] | 274 | |
Graeme Russ | cbfce1d | 2011-04-13 19:43:28 +1000 | [diff] [blame] | 275 | #if defined(CONFIG_X86) |
wdenk | 874ac26 | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 276 | /* x86 does not have a dedicated register for passing global_data */ |
wdenk | b846356 | 2003-07-26 08:08:08 +0000 | [diff] [blame] | 277 | global_data = (gd_t *)argv[-1]; |
| 278 | jt = global_data->jt; |
wdenk | 874ac26 | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 279 | #endif |
| 280 | } |
| 281 | |
| 282 | #undef EXPORT_FUNC |