aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/boot
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2006-01-12 12:17:57 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-01-12 12:17:57 -0500
commitf4619025a51747a3788fd1bb6bdc46e368a889a7 (patch)
tree81b5c860e1e9b08dbf8ba292ae17eb9ac688f23a /arch/arm/boot
parent90303b102353302e84758f245906368907e6a23b (diff)
[ARM] Allow r2 to be passed through the decompressor to the kernel
This is part of a patch from Marc Singer to allow r2 to be passed to the kernel. Marc's original comments follow: This revised R2 (atags pointer) patch incorporates comments from Nico Pitre and Ben Dooks. It modifies the head.S files such that the R2 value set by the bootloader is conveyed to the kernel startup code. The kernel head.S heuristically validates the pointer. It will set R2 to zero if it believes the pointer is invalid. Presently, it requires that the ATAGS list reside in the first 16KiB of physical RAM. Relaxing this contraint may be both desirable as well as tricky. Signed-off-by: Marc Singer <elf@buici.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/boot')
-rw-r--r--arch/arm/boot/compressed/head.S46
1 files changed, 25 insertions, 21 deletions
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 6abafb6f1844..aaa47400eb9c 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -84,7 +84,7 @@
84 kputc #'\n' 84 kputc #'\n'
85 kphex r5, 8 /* decompressed kernel start */ 85 kphex r5, 8 /* decompressed kernel start */
86 kputc #'-' 86 kputc #'-'
87 kphex r8, 8 /* decompressed kernel end */ 87 kphex r9, 8 /* decompressed kernel end */
88 kputc #'>' 88 kputc #'>'
89 kphex r4, 8 /* kernel execution address */ 89 kphex r4, 8 /* kernel execution address */
90 kputc #'\n' 90 kputc #'\n'
@@ -116,7 +116,7 @@ start:
116 .word start @ absolute load/run zImage address 116 .word start @ absolute load/run zImage address
117 .word _edata @ zImage end address 117 .word _edata @ zImage end address
1181: mov r7, r1 @ save architecture ID 1181: mov r7, r1 @ save architecture ID
119 mov r8, #0 @ save r0 119 mov r8, r2 @ save atags pointer
120 120
121#ifndef __ARM_ARCH_2__ 121#ifndef __ARM_ARCH_2__
122 /* 122 /*
@@ -144,7 +144,7 @@ not_angel:
144 144
145 /* 145 /*
146 * some architecture specific code can be inserted 146 * some architecture specific code can be inserted
147 * by the linker here, but it should preserve r7 and r8. 147 * by the linker here, but it should preserve r7, r8, and r9.
148 */ 148 */
149 149
150 .text 150 .text
@@ -249,16 +249,17 @@ not_relocated: mov r0, #0
249 * r5 = decompressed kernel start 249 * r5 = decompressed kernel start
250 * r6 = processor ID 250 * r6 = processor ID
251 * r7 = architecture ID 251 * r7 = architecture ID
252 * r8-r14 = unused 252 * r8 = atags pointer
253 * r9-r14 = corrupted
253 */ 254 */
254 add r1, r5, r0 @ end of decompressed kernel 255 add r1, r5, r0 @ end of decompressed kernel
255 adr r2, reloc_start 256 adr r2, reloc_start
256 ldr r3, LC1 257 ldr r3, LC1
257 add r3, r2, r3 258 add r3, r2, r3
2581: ldmia r2!, {r8 - r13} @ copy relocation code 2591: ldmia r2!, {r9 - r14} @ copy relocation code
259 stmia r1!, {r8 - r13} 260 stmia r1!, {r9 - r14}
260 ldmia r2!, {r8 - r13} 261 ldmia r2!, {r9 - r14}
261 stmia r1!, {r8 - r13} 262 stmia r1!, {r9 - r14}
262 cmp r2, r3 263 cmp r2, r3
263 blo 1b 264 blo 1b
264 265
@@ -308,11 +309,12 @@ params: ldr r0, =params_phys
308 * r4 = kernel execution address 309 * r4 = kernel execution address
309 * r6 = processor ID 310 * r6 = processor ID
310 * r7 = architecture number 311 * r7 = architecture number
311 * r8 = run-time address of "start" 312 * r8 = atags pointer
313 * r9 = run-time address of "start" (???)
312 * On exit, 314 * On exit,
313 * r1, r2, r3, r8, r9, r12 corrupted 315 * r1, r2, r3, r9, r10, r12 corrupted
314 * This routine must preserve: 316 * This routine must preserve:
315 * r4, r5, r6, r7 317 * r4, r5, r6, r7, r8
316 */ 318 */
317 .align 5 319 .align 5
318cache_on: mov r3, #8 @ cache_on function 320cache_on: mov r3, #8 @ cache_on function
@@ -326,15 +328,15 @@ __setup_mmu: sub r3, r4, #16384 @ Page directory size
326 * bits for the RAM area only. 328 * bits for the RAM area only.
327 */ 329 */
328 mov r0, r3 330 mov r0, r3
329 mov r8, r0, lsr #18 331 mov r9, r0, lsr #18
330 mov r8, r8, lsl #18 @ start of RAM 332 mov r9, r9, lsl #18 @ start of RAM
331 add r9, r8, #0x10000000 @ a reasonable RAM size 333 add r10, r9, #0x10000000 @ a reasonable RAM size
332 mov r1, #0x12 334 mov r1, #0x12
333 orr r1, r1, #3 << 10 335 orr r1, r1, #3 << 10
334 add r2, r3, #16384 336 add r2, r3, #16384
3351: cmp r1, r8 @ if virt > start of RAM 3371: cmp r1, r8 @ if virt > start of RAM
336 orrhs r1, r1, #0x0c @ set cacheable, bufferable 338 orrhs r1, r1, #0x0c @ set cacheable, bufferable
337 cmp r1, r9 @ if virt > end of RAM 339 cmp r1, r10 @ if virt > end of RAM
338 bichs r1, r1, #0x0c @ clear cacheable, bufferable 340 bichs r1, r1, #0x0c @ clear cacheable, bufferable
339 str r1, [r0], #4 @ 1:1 mapping 341 str r1, [r0], #4 @ 1:1 mapping
340 add r1, r1, #1048576 342 add r1, r1, #1048576
@@ -403,26 +405,28 @@ __common_cache_on:
403 * r5 = decompressed kernel start 405 * r5 = decompressed kernel start
404 * r6 = processor ID 406 * r6 = processor ID
405 * r7 = architecture ID 407 * r7 = architecture ID
406 * r8-r14 = unused 408 * r8 = atags pointer
409 * r9-r14 = corrupted
407 */ 410 */
408 .align 5 411 .align 5
409reloc_start: add r8, r5, r0 412reloc_start: add r9, r5, r0
410 debug_reloc_start 413 debug_reloc_start
411 mov r1, r4 414 mov r1, r4
4121: 4151:
413 .rept 4 416 .rept 4
414 ldmia r5!, {r0, r2, r3, r9 - r13} @ relocate kernel 417 ldmia r5!, {r0, r2, r3, r10 - r14} @ relocate kernel
415 stmia r1!, {r0, r2, r3, r9 - r13} 418 stmia r1!, {r0, r2, r3, r10 - r14}
416 .endr 419 .endr
417 420
418 cmp r5, r8 421 cmp r5, r9
419 blo 1b 422 blo 1b
420 debug_reloc_end 423 debug_reloc_end
421 424
422call_kernel: bl cache_clean_flush 425call_kernel: bl cache_clean_flush
423 bl cache_off 426 bl cache_off
424 mov r0, #0 427 mov r0, #0 @ must be zero
425 mov r1, r7 @ restore architecture number 428 mov r1, r7 @ restore architecture number
429 mov r2, r8 @ restore atags pointer
426 mov pc, r4 @ call kernel 430 mov pc, r4 @ call kernel
427 431
428/* 432/*