aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel/head.S
diff options
context:
space:
mode:
authorHyok S. Choi <hyok.choi@samsung.com>2006-03-27 08:58:25 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-03-27 08:58:25 -0500
commit75d90832d58aa5855972cfc2bdaa94970ccd4aca (patch)
tree3e93ec4714fe4951c67f61787b026fcbc4656f9b /arch/arm/kernel/head.S
parent10c2df65060e1ab57b2f75e0749de0ee9b8f4810 (diff)
[ARM] nommu: start-up code
This patch adds nommu version start-up code head-nommu.S. The common part of the start-up codes is moved to head-common.S. Signed-off-by: Hyok S. Choi <hyok.choi@samsung.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/kernel/head.S')
-rw-r--r--arch/arm/kernel/head.S207
1 files changed, 1 insertions, 206 deletions
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 571d6d584919..d848f3a38924 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -103,49 +103,6 @@ ENTRY(stext)
103 adr lr, __enable_mmu @ return (PIC) address 103 adr lr, __enable_mmu @ return (PIC) address
104 add pc, r10, #PROCINFO_INITFUNC 104 add pc, r10, #PROCINFO_INITFUNC
105 105
106 .type __switch_data, %object
107__switch_data:
108 .long __mmap_switched
109 .long __data_loc @ r4
110 .long __data_start @ r5
111 .long __bss_start @ r6
112 .long _end @ r7
113 .long processor_id @ r4
114 .long __machine_arch_type @ r5
115 .long cr_alignment @ r6
116 .long init_thread_union + THREAD_START_SP @ sp
117
118/*
119 * The following fragment of code is executed with the MMU on, and uses
120 * absolute addresses; this is not position independent.
121 *
122 * r0 = cp#15 control register
123 * r1 = machine ID
124 * r9 = processor ID
125 */
126 .type __mmap_switched, %function
127__mmap_switched:
128 adr r3, __switch_data + 4
129
130 ldmia r3!, {r4, r5, r6, r7}
131 cmp r4, r5 @ Copy data segment if needed
1321: cmpne r5, r6
133 ldrne fp, [r4], #4
134 strne fp, [r5], #4
135 bne 1b
136
137 mov fp, #0 @ Clear BSS (and zero fp)
1381: cmp r6, r7
139 strcc fp, [r6],#4
140 bcc 1b
141
142 ldmia r3, {r4, r5, r6, sp}
143 str r9, [r4] @ Save processor ID
144 str r1, [r5] @ Save machine type
145 bic r4, r0, #CR_A @ Clear 'A' bit
146 stmia r6, {r0, r4} @ Save control register values
147 b start_kernel
148
149#if defined(CONFIG_SMP) 106#if defined(CONFIG_SMP)
150 .type secondary_startup, #function 107 .type secondary_startup, #function
151ENTRY(secondary_startup) 108ENTRY(secondary_startup)
@@ -368,166 +325,4 @@ __create_page_tables:
368 mov pc, lr 325 mov pc, lr
369 .ltorg 326 .ltorg
370 327
371 328#include "head-common.S"
372
373/*
374 * Exception handling. Something went wrong and we can't proceed. We
375 * ought to tell the user, but since we don't have any guarantee that
376 * we're even running on the right architecture, we do virtually nothing.
377 *
378 * If CONFIG_DEBUG_LL is set we try to print out something about the error
379 * and hope for the best (useful if bootloader fails to pass a proper
380 * machine ID for example).
381 */
382
383 .type __error_p, %function
384__error_p:
385#ifdef CONFIG_DEBUG_LL
386 adr r0, str_p1
387 bl printascii
388 b __error
389str_p1: .asciz "\nError: unrecognized/unsupported processor variant.\n"
390 .align
391#endif
392
393 .type __error_a, %function
394__error_a:
395#ifdef CONFIG_DEBUG_LL
396 mov r4, r1 @ preserve machine ID
397 adr r0, str_a1
398 bl printascii
399 mov r0, r4
400 bl printhex8
401 adr r0, str_a2
402 bl printascii
403 adr r3, 3f
404 ldmia r3, {r4, r5, r6} @ get machine desc list
405 sub r4, r3, r4 @ get offset between virt&phys
406 add r5, r5, r4 @ convert virt addresses to
407 add r6, r6, r4 @ physical address space
4081: ldr r0, [r5, #MACHINFO_TYPE] @ get machine type
409 bl printhex8
410 mov r0, #'\t'
411 bl printch
412 ldr r0, [r5, #MACHINFO_NAME] @ get machine name
413 add r0, r0, r4
414 bl printascii
415 mov r0, #'\n'
416 bl printch
417 add r5, r5, #SIZEOF_MACHINE_DESC @ next machine_desc
418 cmp r5, r6
419 blo 1b
420 adr r0, str_a3
421 bl printascii
422 b __error
423str_a1: .asciz "\nError: unrecognized/unsupported machine ID (r1 = 0x"
424str_a2: .asciz ").\n\nAvailable machine support:\n\nID (hex)\tNAME\n"
425str_a3: .asciz "\nPlease check your kernel config and/or bootloader.\n"
426 .align
427#endif
428
429 .type __error, %function
430__error:
431#ifdef CONFIG_ARCH_RPC
432/*
433 * Turn the screen red on a error - RiscPC only.
434 */
435 mov r0, #0x02000000
436 mov r3, #0x11
437 orr r3, r3, r3, lsl #8
438 orr r3, r3, r3, lsl #16
439 str r3, [r0], #4
440 str r3, [r0], #4
441 str r3, [r0], #4
442 str r3, [r0], #4
443#endif
4441: mov r0, r0
445 b 1b
446
447
448/*
449 * Read processor ID register (CP#15, CR0), and look up in the linker-built
450 * supported processor list. Note that we can't use the absolute addresses
451 * for the __proc_info lists since we aren't running with the MMU on
452 * (and therefore, we are not in the correct address space). We have to
453 * calculate the offset.
454 *
455 * r9 = cpuid
456 * Returns:
457 * r3, r4, r6 corrupted
458 * r5 = proc_info pointer in physical address space
459 * r9 = cpuid (preserved)
460 */
461 .type __lookup_processor_type, %function
462__lookup_processor_type:
463 adr r3, 3f
464 ldmda r3, {r5 - r7}
465 sub r3, r3, r7 @ get offset between virt&phys
466 add r5, r5, r3 @ convert virt addresses to
467 add r6, r6, r3 @ physical address space
4681: ldmia r5, {r3, r4} @ value, mask
469 and r4, r4, r9 @ mask wanted bits
470 teq r3, r4
471 beq 2f
472 add r5, r5, #PROC_INFO_SZ @ sizeof(proc_info_list)
473 cmp r5, r6
474 blo 1b
475 mov r5, #0 @ unknown processor
4762: mov pc, lr
477
478/*
479 * This provides a C-API version of the above function.
480 */
481ENTRY(lookup_processor_type)
482 stmfd sp!, {r4 - r7, r9, lr}
483 mov r9, r0
484 bl __lookup_processor_type
485 mov r0, r5
486 ldmfd sp!, {r4 - r7, r9, pc}
487
488/*
489 * Look in include/asm-arm/procinfo.h and arch/arm/kernel/arch.[ch] for
490 * more information about the __proc_info and __arch_info structures.
491 */
492 .long __proc_info_begin
493 .long __proc_info_end
4943: .long .
495 .long __arch_info_begin
496 .long __arch_info_end
497
498/*
499 * Lookup machine architecture in the linker-build list of architectures.
500 * Note that we can't use the absolute addresses for the __arch_info
501 * lists since we aren't running with the MMU on (and therefore, we are
502 * not in the correct address space). We have to calculate the offset.
503 *
504 * r1 = machine architecture number
505 * Returns:
506 * r3, r4, r6 corrupted
507 * r5 = mach_info pointer in physical address space
508 */
509 .type __lookup_machine_type, %function
510__lookup_machine_type:
511 adr r3, 3b
512 ldmia r3, {r4, r5, r6}
513 sub r3, r3, r4 @ get offset between virt&phys
514 add r5, r5, r3 @ convert virt addresses to
515 add r6, r6, r3 @ physical address space
5161: ldr r3, [r5, #MACHINFO_TYPE] @ get machine type
517 teq r3, r1 @ matches loader number?
518 beq 2f @ found
519 add r5, r5, #SIZEOF_MACHINE_DESC @ next machine_desc
520 cmp r5, r6
521 blo 1b
522 mov r5, #0 @ unknown machine
5232: mov pc, lr
524
525/*
526 * This provides a C-API version of the above function.
527 */
528ENTRY(lookup_machine_type)
529 stmfd sp!, {r4 - r6, lr}
530 mov r1, r0
531 bl __lookup_machine_type
532 mov r0, r5
533 ldmfd sp!, {r4 - r6, pc}