.. | .. |
---|
14 | 14 | * Joe Taylor <joe@tensilica.com, joetylr@yahoo.com> |
---|
15 | 15 | */ |
---|
16 | 16 | |
---|
| 17 | +#define RO_EXCEPTION_TABLE_ALIGN 16 |
---|
| 18 | + |
---|
17 | 19 | #include <asm-generic/vmlinux.lds.h> |
---|
18 | 20 | #include <asm/page.h> |
---|
19 | 21 | #include <asm/thread_info.h> |
---|
20 | 22 | |
---|
| 23 | +#include <asm/core.h> |
---|
21 | 24 | #include <asm/vectors.h> |
---|
22 | | -#include <variant/core.h> |
---|
23 | 25 | |
---|
24 | 26 | OUTPUT_ARCH(xtensa) |
---|
25 | 27 | ENTRY(_start) |
---|
.. | .. |
---|
45 | 47 | LONG(sym ## _end); \ |
---|
46 | 48 | LONG(LOADADDR(section)) |
---|
47 | 49 | |
---|
| 50 | +#if !defined(CONFIG_VECTORS_ADDR) && XCHAL_HAVE_VECBASE |
---|
| 51 | +#define MERGED_VECTORS 1 |
---|
| 52 | +#else |
---|
| 53 | +#define MERGED_VECTORS 0 |
---|
| 54 | +#endif |
---|
| 55 | + |
---|
48 | 56 | /* |
---|
49 | | - * Macro to define a section for a vector. When CONFIG_VECTORS_OFFSET is |
---|
50 | | - * defined code for every vector is located with other init data. At startup |
---|
| 57 | + * Macro to define a section for a vector. When MERGED_VECTORS is 0 |
---|
| 58 | + * code for every vector is located with other init data. At startup |
---|
51 | 59 | * time head.S copies code for every vector to its final position according |
---|
52 | 60 | * to description recorded in the corresponding RELOCATE_ENTRY. |
---|
53 | 61 | */ |
---|
54 | 62 | |
---|
55 | | -#ifdef CONFIG_VECTORS_OFFSET |
---|
56 | | -#define SECTION_VECTOR(sym, section, addr, prevsec) \ |
---|
| 63 | +#define SECTION_VECTOR4(sym, section, addr, prevsec) \ |
---|
57 | 64 | section addr : AT(((LOADADDR(prevsec) + SIZEOF(prevsec)) + 3) & ~ 3) \ |
---|
58 | 65 | { \ |
---|
59 | 66 | . = ALIGN(4); \ |
---|
.. | .. |
---|
61 | 68 | *(section) \ |
---|
62 | 69 | sym ## _end = ABSOLUTE(.); \ |
---|
63 | 70 | } |
---|
64 | | -#else |
---|
65 | | -#define SECTION_VECTOR(section, addr) \ |
---|
| 71 | + |
---|
| 72 | +#define SECTION_VECTOR2(section, addr) \ |
---|
66 | 73 | . = addr; \ |
---|
67 | 74 | *(section) |
---|
68 | | -#endif |
---|
69 | 75 | |
---|
70 | 76 | /* |
---|
71 | 77 | * Mapping of input sections to output sections when linking. |
---|
.. | .. |
---|
84 | 90 | /* The HEAD_TEXT section must be the first section! */ |
---|
85 | 91 | HEAD_TEXT |
---|
86 | 92 | |
---|
87 | | -#ifndef CONFIG_VECTORS_OFFSET |
---|
88 | | - . = ALIGN(PAGE_SIZE); |
---|
89 | | - _vecbase = .; |
---|
| 93 | +#if MERGED_VECTORS |
---|
| 94 | + . = ALIGN(PAGE_SIZE); |
---|
| 95 | + _vecbase = .; |
---|
90 | 96 | |
---|
91 | | - SECTION_VECTOR (.WindowVectors.text, WINDOW_VECTORS_VADDR) |
---|
| 97 | + SECTION_VECTOR2 (.WindowVectors.text, WINDOW_VECTORS_VADDR) |
---|
92 | 98 | #if XCHAL_EXCM_LEVEL >= 2 |
---|
93 | | - SECTION_VECTOR (.Level2InterruptVector.text, INTLEVEL2_VECTOR_VADDR) |
---|
| 99 | + SECTION_VECTOR2 (.Level2InterruptVector.text, INTLEVEL2_VECTOR_VADDR) |
---|
94 | 100 | #endif |
---|
95 | 101 | #if XCHAL_EXCM_LEVEL >= 3 |
---|
96 | | - SECTION_VECTOR (.Level3InterruptVector.text, INTLEVEL3_VECTOR_VADDR) |
---|
| 102 | + SECTION_VECTOR2 (.Level3InterruptVector.text, INTLEVEL3_VECTOR_VADDR) |
---|
97 | 103 | #endif |
---|
98 | 104 | #if XCHAL_EXCM_LEVEL >= 4 |
---|
99 | | - SECTION_VECTOR (.Level4InterruptVector.text, INTLEVEL4_VECTOR_VADDR) |
---|
| 105 | + SECTION_VECTOR2 (.Level4InterruptVector.text, INTLEVEL4_VECTOR_VADDR) |
---|
100 | 106 | #endif |
---|
101 | 107 | #if XCHAL_EXCM_LEVEL >= 5 |
---|
102 | | - SECTION_VECTOR (.Level5InterruptVector.text, INTLEVEL5_VECTOR_VADDR) |
---|
| 108 | + SECTION_VECTOR2 (.Level5InterruptVector.text, INTLEVEL5_VECTOR_VADDR) |
---|
103 | 109 | #endif |
---|
104 | 110 | #if XCHAL_EXCM_LEVEL >= 6 |
---|
105 | | - SECTION_VECTOR (.Level6InterruptVector.text, INTLEVEL6_VECTOR_VADDR) |
---|
| 111 | + SECTION_VECTOR2 (.Level6InterruptVector.text, INTLEVEL6_VECTOR_VADDR) |
---|
106 | 112 | #endif |
---|
107 | | - SECTION_VECTOR (.DebugInterruptVector.text, DEBUG_VECTOR_VADDR) |
---|
108 | | - SECTION_VECTOR (.KernelExceptionVector.text, KERNEL_VECTOR_VADDR) |
---|
109 | | - SECTION_VECTOR (.UserExceptionVector.text, USER_VECTOR_VADDR) |
---|
110 | | - SECTION_VECTOR (.DoubleExceptionVector.text, DOUBLEEXC_VECTOR_VADDR) |
---|
| 113 | + SECTION_VECTOR2 (.DebugInterruptVector.text, DEBUG_VECTOR_VADDR) |
---|
| 114 | + SECTION_VECTOR2 (.KernelExceptionVector.text, KERNEL_VECTOR_VADDR) |
---|
| 115 | + SECTION_VECTOR2 (.UserExceptionVector.text, USER_VECTOR_VADDR) |
---|
| 116 | + SECTION_VECTOR2 (.DoubleExceptionVector.text, DOUBLEEXC_VECTOR_VADDR) |
---|
| 117 | + |
---|
| 118 | + *(.exception.text) |
---|
111 | 119 | #endif |
---|
112 | 120 | |
---|
113 | 121 | IRQENTRY_TEXT |
---|
.. | .. |
---|
117 | 125 | SCHED_TEXT |
---|
118 | 126 | CPUIDLE_TEXT |
---|
119 | 127 | LOCK_TEXT |
---|
120 | | - |
---|
| 128 | + *(.fixup) |
---|
121 | 129 | } |
---|
122 | 130 | _etext = .; |
---|
123 | 131 | PROVIDE (etext = .); |
---|
124 | 132 | |
---|
125 | 133 | . = ALIGN(16); |
---|
126 | 134 | |
---|
127 | | - RODATA |
---|
| 135 | + RO_DATA(4096) |
---|
128 | 136 | |
---|
129 | | - /* Relocation table */ |
---|
130 | | - |
---|
131 | | - .fixup : { *(.fixup) } |
---|
132 | | - |
---|
133 | | - EXCEPTION_TABLE(16) |
---|
134 | | - NOTES |
---|
135 | 137 | /* Data section */ |
---|
136 | 138 | |
---|
| 139 | +#ifdef CONFIG_XIP_KERNEL |
---|
| 140 | + INIT_TEXT_SECTION(PAGE_SIZE) |
---|
| 141 | +#else |
---|
137 | 142 | _sdata = .; |
---|
138 | | - RW_DATA_SECTION(XCHAL_ICACHE_LINESIZE, PAGE_SIZE, THREAD_SIZE) |
---|
| 143 | + RW_DATA(XCHAL_ICACHE_LINESIZE, PAGE_SIZE, THREAD_SIZE) |
---|
139 | 144 | _edata = .; |
---|
140 | 145 | |
---|
141 | 146 | /* Initialization code and data: */ |
---|
.. | .. |
---|
147 | 152 | .init.data : |
---|
148 | 153 | { |
---|
149 | 154 | INIT_DATA |
---|
| 155 | + } |
---|
| 156 | +#endif |
---|
| 157 | + |
---|
| 158 | + .init.rodata : |
---|
| 159 | + { |
---|
150 | 160 | . = ALIGN(0x4); |
---|
151 | 161 | __tagtable_begin = .; |
---|
152 | 162 | *(.taglist) |
---|
.. | .. |
---|
155 | 165 | . = ALIGN(16); |
---|
156 | 166 | __boot_reloc_table_start = ABSOLUTE(.); |
---|
157 | 167 | |
---|
158 | | -#ifdef CONFIG_VECTORS_OFFSET |
---|
| 168 | +#if !MERGED_VECTORS |
---|
159 | 169 | RELOCATE_ENTRY(_WindowVectors_text, |
---|
160 | 170 | .WindowVectors.text); |
---|
161 | 171 | #if XCHAL_EXCM_LEVEL >= 2 |
---|
.. | .. |
---|
186 | 196 | .DoubleExceptionVector.text); |
---|
187 | 197 | RELOCATE_ENTRY(_DebugInterruptVector_text, |
---|
188 | 198 | .DebugInterruptVector.text); |
---|
| 199 | + RELOCATE_ENTRY(_exception_text, |
---|
| 200 | + .exception.text); |
---|
| 201 | +#endif |
---|
| 202 | +#ifdef CONFIG_XIP_KERNEL |
---|
| 203 | + RELOCATE_ENTRY(_xip_data, .data); |
---|
| 204 | + RELOCATE_ENTRY(_xip_init_data, .init.data); |
---|
189 | 205 | #endif |
---|
190 | 206 | #if defined(CONFIG_SMP) |
---|
191 | 207 | RELOCATE_ENTRY(_SecondaryResetVector_text, |
---|
192 | 208 | .SecondaryResetVector.text); |
---|
193 | 209 | #endif |
---|
194 | 210 | |
---|
195 | | - |
---|
196 | 211 | __boot_reloc_table_end = ABSOLUTE(.) ; |
---|
197 | 212 | |
---|
198 | 213 | INIT_SETUP(XCHAL_ICACHE_LINESIZE) |
---|
199 | 214 | INIT_CALLS |
---|
200 | 215 | CON_INITCALL |
---|
201 | | - SECURITY_INITCALL |
---|
202 | 216 | INIT_RAM_FS |
---|
203 | 217 | } |
---|
204 | 218 | |
---|
.. | .. |
---|
209 | 223 | . = ALIGN(4); |
---|
210 | 224 | .dummy : { LONG(0) } |
---|
211 | 225 | |
---|
212 | | -#ifdef CONFIG_VECTORS_OFFSET |
---|
| 226 | +#undef LAST |
---|
| 227 | +#define LAST .dummy |
---|
| 228 | + |
---|
| 229 | +#if !MERGED_VECTORS |
---|
213 | 230 | /* The vectors are relocated to the real position at startup time */ |
---|
214 | 231 | |
---|
215 | | - SECTION_VECTOR (_WindowVectors_text, |
---|
| 232 | + SECTION_VECTOR4 (_WindowVectors_text, |
---|
216 | 233 | .WindowVectors.text, |
---|
217 | 234 | WINDOW_VECTORS_VADDR, |
---|
218 | 235 | .dummy) |
---|
219 | | - SECTION_VECTOR (_DebugInterruptVector_text, |
---|
| 236 | + SECTION_VECTOR4 (_DebugInterruptVector_text, |
---|
220 | 237 | .DebugInterruptVector.text, |
---|
221 | 238 | DEBUG_VECTOR_VADDR, |
---|
222 | 239 | .WindowVectors.text) |
---|
223 | 240 | #undef LAST |
---|
224 | 241 | #define LAST .DebugInterruptVector.text |
---|
225 | 242 | #if XCHAL_EXCM_LEVEL >= 2 |
---|
226 | | - SECTION_VECTOR (_Level2InterruptVector_text, |
---|
| 243 | + SECTION_VECTOR4 (_Level2InterruptVector_text, |
---|
227 | 244 | .Level2InterruptVector.text, |
---|
228 | 245 | INTLEVEL2_VECTOR_VADDR, |
---|
229 | 246 | LAST) |
---|
.. | .. |
---|
231 | 248 | # define LAST .Level2InterruptVector.text |
---|
232 | 249 | #endif |
---|
233 | 250 | #if XCHAL_EXCM_LEVEL >= 3 |
---|
234 | | - SECTION_VECTOR (_Level3InterruptVector_text, |
---|
| 251 | + SECTION_VECTOR4 (_Level3InterruptVector_text, |
---|
235 | 252 | .Level3InterruptVector.text, |
---|
236 | 253 | INTLEVEL3_VECTOR_VADDR, |
---|
237 | 254 | LAST) |
---|
.. | .. |
---|
239 | 256 | # define LAST .Level3InterruptVector.text |
---|
240 | 257 | #endif |
---|
241 | 258 | #if XCHAL_EXCM_LEVEL >= 4 |
---|
242 | | - SECTION_VECTOR (_Level4InterruptVector_text, |
---|
| 259 | + SECTION_VECTOR4 (_Level4InterruptVector_text, |
---|
243 | 260 | .Level4InterruptVector.text, |
---|
244 | 261 | INTLEVEL4_VECTOR_VADDR, |
---|
245 | 262 | LAST) |
---|
.. | .. |
---|
247 | 264 | # define LAST .Level4InterruptVector.text |
---|
248 | 265 | #endif |
---|
249 | 266 | #if XCHAL_EXCM_LEVEL >= 5 |
---|
250 | | - SECTION_VECTOR (_Level5InterruptVector_text, |
---|
| 267 | + SECTION_VECTOR4 (_Level5InterruptVector_text, |
---|
251 | 268 | .Level5InterruptVector.text, |
---|
252 | 269 | INTLEVEL5_VECTOR_VADDR, |
---|
253 | 270 | LAST) |
---|
.. | .. |
---|
255 | 272 | # define LAST .Level5InterruptVector.text |
---|
256 | 273 | #endif |
---|
257 | 274 | #if XCHAL_EXCM_LEVEL >= 6 |
---|
258 | | - SECTION_VECTOR (_Level6InterruptVector_text, |
---|
| 275 | + SECTION_VECTOR4 (_Level6InterruptVector_text, |
---|
259 | 276 | .Level6InterruptVector.text, |
---|
260 | 277 | INTLEVEL6_VECTOR_VADDR, |
---|
261 | 278 | LAST) |
---|
262 | 279 | # undef LAST |
---|
263 | 280 | # define LAST .Level6InterruptVector.text |
---|
264 | 281 | #endif |
---|
265 | | - SECTION_VECTOR (_KernelExceptionVector_text, |
---|
| 282 | + SECTION_VECTOR4 (_KernelExceptionVector_text, |
---|
266 | 283 | .KernelExceptionVector.text, |
---|
267 | 284 | KERNEL_VECTOR_VADDR, |
---|
268 | 285 | LAST) |
---|
269 | 286 | #undef LAST |
---|
270 | | - SECTION_VECTOR (_UserExceptionVector_text, |
---|
| 287 | + SECTION_VECTOR4 (_UserExceptionVector_text, |
---|
271 | 288 | .UserExceptionVector.text, |
---|
272 | 289 | USER_VECTOR_VADDR, |
---|
273 | 290 | .KernelExceptionVector.text) |
---|
274 | | - SECTION_VECTOR (_DoubleExceptionVector_text, |
---|
| 291 | + SECTION_VECTOR4 (_DoubleExceptionVector_text, |
---|
275 | 292 | .DoubleExceptionVector.text, |
---|
276 | 293 | DOUBLEEXC_VECTOR_VADDR, |
---|
277 | 294 | .UserExceptionVector.text) |
---|
278 | | - |
---|
279 | | - . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3; |
---|
| 295 | +#define LAST .DoubleExceptionVector.text |
---|
280 | 296 | |
---|
281 | 297 | #endif |
---|
282 | 298 | #if defined(CONFIG_SMP) |
---|
283 | 299 | |
---|
284 | | - SECTION_VECTOR (_SecondaryResetVector_text, |
---|
| 300 | + SECTION_VECTOR4 (_SecondaryResetVector_text, |
---|
285 | 301 | .SecondaryResetVector.text, |
---|
286 | 302 | RESET_VECTOR1_VADDR, |
---|
287 | | - .DoubleExceptionVector.text) |
---|
288 | | - |
---|
289 | | - . = LOADADDR(.SecondaryResetVector.text)+SIZEOF(.SecondaryResetVector.text); |
---|
| 303 | + LAST) |
---|
| 304 | +#undef LAST |
---|
| 305 | +#define LAST .SecondaryResetVector.text |
---|
290 | 306 | |
---|
291 | 307 | #endif |
---|
| 308 | +#if !MERGED_VECTORS |
---|
| 309 | + SECTION_VECTOR4 (_exception_text, |
---|
| 310 | + .exception.text, |
---|
| 311 | + , |
---|
| 312 | + LAST) |
---|
| 313 | +#undef LAST |
---|
| 314 | +#define LAST .exception.text |
---|
292 | 315 | |
---|
| 316 | +#endif |
---|
| 317 | + . = (LOADADDR(LAST) + SIZEOF(LAST) + 3) & ~ 3; |
---|
| 318 | + |
---|
| 319 | + .dummy1 : AT(ADDR(.dummy1)) { LONG(0) } |
---|
293 | 320 | . = ALIGN(PAGE_SIZE); |
---|
294 | 321 | |
---|
| 322 | +#ifndef CONFIG_XIP_KERNEL |
---|
295 | 323 | __init_end = .; |
---|
296 | 324 | |
---|
297 | 325 | BSS_SECTION(0, 8192, 0) |
---|
| 326 | +#endif |
---|
298 | 327 | |
---|
299 | 328 | _end = .; |
---|
300 | 329 | |
---|
301 | | - .xt.lit : { *(.xt.lit) } |
---|
302 | | - .xt.prop : { *(.xt.prop) } |
---|
| 330 | +#ifdef CONFIG_XIP_KERNEL |
---|
| 331 | + . = CONFIG_XIP_DATA_ADDR; |
---|
303 | 332 | |
---|
304 | | - .debug 0 : { *(.debug) } |
---|
305 | | - .line 0 : { *(.line) } |
---|
306 | | - .debug_srcinfo 0 : { *(.debug_srcinfo) } |
---|
307 | | - .debug_sfnames 0 : { *(.debug_sfnames) } |
---|
308 | | - .debug_aranges 0 : { *(.debug_aranges) } |
---|
309 | | - .debug_pubnames 0 : { *(.debug_pubnames) } |
---|
310 | | - .debug_info 0 : { *(.debug_info) } |
---|
311 | | - .debug_abbrev 0 : { *(.debug_abbrev) } |
---|
312 | | - .debug_line 0 : { *(.debug_line) } |
---|
313 | | - .debug_frame 0 : { *(.debug_frame) } |
---|
314 | | - .debug_str 0 : { *(.debug_str) } |
---|
315 | | - .debug_loc 0 : { *(.debug_loc) } |
---|
316 | | - .debug_macinfo 0 : { *(.debug_macinfo) } |
---|
317 | | - .debug_weaknames 0 : { *(.debug_weaknames) } |
---|
318 | | - .debug_funcnames 0 : { *(.debug_funcnames) } |
---|
319 | | - .debug_typenames 0 : { *(.debug_typenames) } |
---|
320 | | - .debug_varnames 0 : { *(.debug_varnames) } |
---|
| 333 | + _xip_start = .; |
---|
321 | 334 | |
---|
322 | | - .xt.insn 0 : |
---|
| 335 | +#undef LOAD_OFFSET |
---|
| 336 | +#define LOAD_OFFSET \ |
---|
| 337 | + (CONFIG_XIP_DATA_ADDR - (LOADADDR(.dummy1) + SIZEOF(.dummy1) + 3) & ~ 3) |
---|
| 338 | + |
---|
| 339 | + _xip_data_start = .; |
---|
| 340 | + _sdata = .; |
---|
| 341 | + RW_DATA(XCHAL_ICACHE_LINESIZE, PAGE_SIZE, THREAD_SIZE) |
---|
| 342 | + _edata = .; |
---|
| 343 | + _xip_data_end = .; |
---|
| 344 | + |
---|
| 345 | + /* Initialization data: */ |
---|
| 346 | + |
---|
| 347 | + STRUCT_ALIGN(); |
---|
| 348 | + |
---|
| 349 | + _xip_init_data_start = .; |
---|
| 350 | + __init_begin = .; |
---|
| 351 | + .init.data : |
---|
323 | 352 | { |
---|
324 | | - *(.xt.insn) |
---|
325 | | - *(.gnu.linkonce.x*) |
---|
| 353 | + INIT_DATA |
---|
326 | 354 | } |
---|
| 355 | + _xip_init_data_end = .; |
---|
| 356 | + __init_end = .; |
---|
| 357 | + BSS_SECTION(0, 8192, 0) |
---|
327 | 358 | |
---|
328 | | - .xt.lit 0 : |
---|
329 | | - { |
---|
330 | | - *(.xt.lit) |
---|
331 | | - *(.gnu.linkonce.p*) |
---|
332 | | - } |
---|
| 359 | + _xip_end = .; |
---|
| 360 | + |
---|
| 361 | +#undef LOAD_OFFSET |
---|
| 362 | +#endif |
---|
| 363 | + |
---|
| 364 | + DWARF_DEBUG |
---|
| 365 | + |
---|
| 366 | + .xt.prop 0 : { KEEP(*(.xt.prop .xt.prop.* .gnu.linkonce.prop.*)) } |
---|
| 367 | + .xt.insn 0 : { KEEP(*(.xt.insn .xt.insn.* .gnu.linkonce.x*)) } |
---|
| 368 | + .xt.lit 0 : { KEEP(*(.xt.lit .xt.lit.* .gnu.linkonce.p*)) } |
---|
333 | 369 | |
---|
334 | 370 | /* Sections to be discarded */ |
---|
335 | 371 | DISCARDS |
---|