2 * linux/arch/arm/kernel/head-nommu.S
4 * Copyright (C) 1994-2002 Russell King
5 * Copyright (C) 2003-2006 Hyok S. Choi
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * Common kernel startup code (non-paged MM)
14 #include <linux/linkage.h>
15 #include <linux/init.h>
17 #include <asm/assembler.h>
18 #include <asm/ptrace.h>
19 #include <asm/asm-offsets.h>
21 #include <asm/thread_info.h>
25 * Kernel startup entry point.
26 * ---------------------------
28 * This is normally called from the decompressor code. The requirements
29 * are: MMU = off, D-cache = off, I-cache = dont care, r0 = 0,
32 * See linux/arch/arm/tools/mach-types for the complete list of machine
39 #ifdef CONFIG_CPU_THUMBONLY
46 THUMB( adr r9, BSYM(1f) ) @ Kernel is always entered in ARM.
47 THUMB( bx r9 ) @ If this is a Thumb-2 kernel,
48 THUMB( .thumb ) @ switch to Thumb now.
52 setmode PSR_F_BIT | PSR_I_BIT | SVC_MODE, r9 @ ensure svc mode
54 #if defined(CONFIG_CPU_CP15)
55 mrc p15, 0, r9, c0, c0 @ get processor id
56 #elif defined(CONFIG_CPU_V7M)
57 ldr r9, =BASEADDR_V7M_SCB
58 ldr r9, [r9, V7M_SCB_CPUID]
60 ldr r9, =CONFIG_PROCESSOR_ID
62 bl __lookup_processor_type @ r5=procinfo r9=cpuid
63 movs r10, r5 @ invalid processor (r5=0)?
64 beq __error_p @ yes, error 'p'
66 ldr r13, =__mmap_switched @ address to jump to after
68 adr lr, BSYM(1f) @ return (PIC) address
69 ARM( add pc, r10, #PROCINFO_INITFUNC )
70 THUMB( add r12, r10, #PROCINFO_INITFUNC )
72 1: b __after_proc_init
77 ENTRY(secondary_startup)
79 * Common entry point for secondary CPUs.
81 * Ensure that we're in SVC mode, and IRQs are disabled. Lookup
82 * the processor type - there is no need to check the machine type
83 * as it has already been validated by the primary processor.
85 setmode PSR_F_BIT | PSR_I_BIT | SVC_MODE, r9
86 #ifndef CONFIG_CPU_CP15
87 ldr r9, =CONFIG_PROCESSOR_ID
89 mrc p15, 0, r9, c0, c0 @ get processor id
91 bl __lookup_processor_type @ r5=procinfo r9=cpuid
92 movs r10, r5 @ invalid processor?
93 beq __error_p @ yes, error 'p'
95 adr r4, __secondary_data
97 adr lr, BSYM(__after_proc_init) @ return address
98 mov r13, r12 @ __secondary_switched address
99 ARM( add pc, r10, #PROCINFO_INITFUNC )
100 THUMB( add r12, r10, #PROCINFO_INITFUNC )
102 ENDPROC(secondary_startup)
104 ENTRY(__secondary_switched)
105 ldr sp, [r7, #8] @ set up the stack pointer
107 b secondary_start_kernel
108 ENDPROC(__secondary_switched)
110 .type __secondary_data, %object
113 .long __secondary_switched
114 #endif /* CONFIG_SMP */
117 * Set the Control Register and Read the process ID.
120 #ifdef CONFIG_CPU_CP15
122 * CP15 system control register value returned in r0 from
123 * the CPU init function.
125 #if defined(CONFIG_ALIGNMENT_TRAP) && __LINUX_ARM_ARCH__ < 6
130 #ifdef CONFIG_CPU_DCACHE_DISABLE
133 #ifdef CONFIG_CPU_BPREDICT_DISABLE
136 #ifdef CONFIG_CPU_ICACHE_DISABLE
139 #ifdef CONFIG_CPU_HIGH_VECTOR
144 mcr p15, 0, r0, c1, c0, 0 @ write control reg
145 #endif /* CONFIG_CPU_CP15 */
147 ENDPROC(__after_proc_init)
150 #include "head-common.S"