diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-10-04 11:29:35 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-10-08 05:07:33 -0400 |
commit | 17bb5e2c1706c7296eec96e97be0d760e59f282c (patch) | |
tree | ba473b22b04603843e634a0878c8eb159e56899b /arch/arm/kernel | |
parent | a4ae41341fd39af6e25ec9861a6a4dc0c5c58b16 (diff) |
ARM: move __mmap_switched, C-API functions to init section
Move these functions, which are only ever used during boot CPU
initialization, to the init section.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r-- | arch/arm/kernel/head-common.S | 142 |
1 files changed, 72 insertions, 70 deletions
diff --git a/arch/arm/kernel/head-common.S b/arch/arm/kernel/head-common.S index 9f473ef2a64c..24dfa14b0bf9 100644 --- a/arch/arm/kernel/head-common.S +++ b/arch/arm/kernel/head-common.S | |||
@@ -15,54 +15,6 @@ | |||
15 | #define ATAG_CORE_SIZE ((2*4 + 3*4) >> 2) | 15 | #define ATAG_CORE_SIZE ((2*4 + 3*4) >> 2) |
16 | #define ATAG_CORE_SIZE_EMPTY ((2*4) >> 2) | 16 | #define ATAG_CORE_SIZE_EMPTY ((2*4) >> 2) |
17 | 17 | ||
18 | .align 2 | ||
19 | .type __switch_data, %object | ||
20 | __switch_data: | ||
21 | .long __data_loc @ r4 | ||
22 | .long _data @ r5 | ||
23 | .long __bss_start @ r6 | ||
24 | .long _end @ r7 | ||
25 | .long processor_id @ r4 | ||
26 | .long __machine_arch_type @ r5 | ||
27 | .long __atags_pointer @ r6 | ||
28 | .long cr_alignment @ r7 | ||
29 | .long init_thread_union + THREAD_START_SP @ sp | ||
30 | |||
31 | /* | ||
32 | * The following fragment of code is executed with the MMU on in MMU mode, | ||
33 | * and uses absolute addresses; this is not position independent. | ||
34 | * | ||
35 | * r0 = cp#15 control register | ||
36 | * r1 = machine ID | ||
37 | * r2 = atags pointer | ||
38 | * r9 = processor ID | ||
39 | */ | ||
40 | __mmap_switched: | ||
41 | adr r3, __switch_data | ||
42 | |||
43 | ldmia r3!, {r4, r5, r6, r7} | ||
44 | cmp r4, r5 @ Copy data segment if needed | ||
45 | 1: cmpne r5, r6 | ||
46 | ldrne fp, [r4], #4 | ||
47 | strne fp, [r5], #4 | ||
48 | bne 1b | ||
49 | |||
50 | mov fp, #0 @ Clear BSS (and zero fp) | ||
51 | 1: cmp r6, r7 | ||
52 | strcc fp, [r6],#4 | ||
53 | bcc 1b | ||
54 | |||
55 | ARM( ldmia r3, {r4, r5, r6, r7, sp}) | ||
56 | THUMB( ldmia r3, {r4, r5, r6, r7} ) | ||
57 | THUMB( ldr sp, [r3, #16] ) | ||
58 | str r9, [r4] @ Save processor ID | ||
59 | str r1, [r5] @ Save machine type | ||
60 | str r2, [r6] @ Save atags pointer | ||
61 | bic r4, r0, #CR_A @ Clear 'A' bit | ||
62 | stmia r7, {r0, r4} @ Save control register values | ||
63 | b start_kernel | ||
64 | ENDPROC(__mmap_switched) | ||
65 | |||
66 | /* | 18 | /* |
67 | * Exception handling. Something went wrong and we can't proceed. We | 19 | * Exception handling. Something went wrong and we can't proceed. We |
68 | * ought to tell the user, but since we don't have any guarantee that | 20 | * ought to tell the user, but since we don't have any guarantee that |
@@ -144,17 +96,6 @@ ENDPROC(__error) | |||
144 | 96 | ||
145 | 97 | ||
146 | /* | 98 | /* |
147 | * This provides a C-API version of __lookup_processor_type | ||
148 | */ | ||
149 | ENTRY(lookup_processor_type) | ||
150 | stmfd sp!, {r4 - r6, r9, lr} | ||
151 | mov r9, r0 | ||
152 | bl __lookup_processor_type | ||
153 | mov r0, r5 | ||
154 | ldmfd sp!, {r4 - r6, r9, pc} | ||
155 | ENDPROC(lookup_processor_type) | ||
156 | |||
157 | /* | ||
158 | * Look in <asm/procinfo.h> and arch/arm/kernel/arch.[ch] for | 99 | * Look in <asm/procinfo.h> and arch/arm/kernel/arch.[ch] for |
159 | * more information about the __proc_info and __arch_info structures. | 100 | * more information about the __proc_info and __arch_info structures. |
160 | */ | 101 | */ |
@@ -190,17 +131,6 @@ __lookup_machine_type: | |||
190 | 2: mov pc, lr | 131 | 2: mov pc, lr |
191 | ENDPROC(__lookup_machine_type) | 132 | ENDPROC(__lookup_machine_type) |
192 | 133 | ||
193 | /* | ||
194 | * This provides a C-API version of the above function. | ||
195 | */ | ||
196 | ENTRY(lookup_machine_type) | ||
197 | stmfd sp!, {r4 - r6, lr} | ||
198 | mov r1, r0 | ||
199 | bl __lookup_machine_type | ||
200 | mov r0, r5 | ||
201 | ldmfd sp!, {r4 - r6, pc} | ||
202 | ENDPROC(lookup_machine_type) | ||
203 | |||
204 | /* Determine validity of the r2 atags pointer. The heuristic requires | 134 | /* Determine validity of the r2 atags pointer. The heuristic requires |
205 | * that the pointer be aligned, in the first 16k of physical RAM and | 135 | * that the pointer be aligned, in the first 16k of physical RAM and |
206 | * that the ATAG_CORE marker is first and present. Future revisions | 136 | * that the ATAG_CORE marker is first and present. Future revisions |
@@ -233,6 +163,78 @@ __vet_atags: | |||
233 | ENDPROC(__vet_atags) | 163 | ENDPROC(__vet_atags) |
234 | 164 | ||
235 | /* | 165 | /* |
166 | * The following fragment of code is executed with the MMU on in MMU mode, | ||
167 | * and uses absolute addresses; this is not position independent. | ||
168 | * | ||
169 | * r0 = cp#15 control register | ||
170 | * r1 = machine ID | ||
171 | * r2 = atags pointer | ||
172 | * r9 = processor ID | ||
173 | */ | ||
174 | __INIT | ||
175 | __mmap_switched: | ||
176 | adr r3, __mmap_switched_data | ||
177 | |||
178 | ldmia r3!, {r4, r5, r6, r7} | ||
179 | cmp r4, r5 @ Copy data segment if needed | ||
180 | 1: cmpne r5, r6 | ||
181 | ldrne fp, [r4], #4 | ||
182 | strne fp, [r5], #4 | ||
183 | bne 1b | ||
184 | |||
185 | mov fp, #0 @ Clear BSS (and zero fp) | ||
186 | 1: cmp r6, r7 | ||
187 | strcc fp, [r6],#4 | ||
188 | bcc 1b | ||
189 | |||
190 | ARM( ldmia r3, {r4, r5, r6, r7, sp}) | ||
191 | THUMB( ldmia r3, {r4, r5, r6, r7} ) | ||
192 | THUMB( ldr sp, [r3, #16] ) | ||
193 | str r9, [r4] @ Save processor ID | ||
194 | str r1, [r5] @ Save machine type | ||
195 | str r2, [r6] @ Save atags pointer | ||
196 | bic r4, r0, #CR_A @ Clear 'A' bit | ||
197 | stmia r7, {r0, r4} @ Save control register values | ||
198 | b start_kernel | ||
199 | ENDPROC(__mmap_switched) | ||
200 | |||
201 | .align 2 | ||
202 | .type __mmap_switched_data, %object | ||
203 | __mmap_switched_data: | ||
204 | .long __data_loc @ r4 | ||
205 | .long _data @ r5 | ||
206 | .long __bss_start @ r6 | ||
207 | .long _end @ r7 | ||
208 | .long processor_id @ r4 | ||
209 | .long __machine_arch_type @ r5 | ||
210 | .long __atags_pointer @ r6 | ||
211 | .long cr_alignment @ r7 | ||
212 | .long init_thread_union + THREAD_START_SP @ sp | ||
213 | .size __mmap_switched_data, . - __mmap_switched_data | ||
214 | |||
215 | /* | ||
216 | * This provides a C-API version of __lookup_machine_type | ||
217 | */ | ||
218 | ENTRY(lookup_machine_type) | ||
219 | stmfd sp!, {r4 - r6, lr} | ||
220 | mov r1, r0 | ||
221 | bl __lookup_machine_type | ||
222 | mov r0, r5 | ||
223 | ldmfd sp!, {r4 - r6, pc} | ||
224 | ENDPROC(lookup_machine_type) | ||
225 | |||
226 | /* | ||
227 | * This provides a C-API version of __lookup_processor_type | ||
228 | */ | ||
229 | ENTRY(lookup_processor_type) | ||
230 | stmfd sp!, {r4 - r6, r9, lr} | ||
231 | mov r9, r0 | ||
232 | bl __lookup_processor_type | ||
233 | mov r0, r5 | ||
234 | ldmfd sp!, {r4 - r6, r9, pc} | ||
235 | ENDPROC(lookup_processor_type) | ||
236 | |||
237 | /* | ||
236 | * Read processor ID register (CP#15, CR0), and look up in the linker-built | 238 | * Read processor ID register (CP#15, CR0), and look up in the linker-built |
237 | * supported processor list. Note that we can't use the absolute addresses | 239 | * supported processor list. Note that we can't use the absolute addresses |
238 | * for the __proc_info lists since we aren't running with the MMU on | 240 | * for the __proc_info lists since we aren't running with the MMU on |