diff options
author | Nicolas Pitre <nico@cam.org> | 2007-02-21 09:32:28 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2007-02-25 11:41:39 -0500 |
commit | ec3622d963522432a873cc1b6f66fed6fceddc18 (patch) | |
tree | 190048563eab2d45ea4e6540192d2384626ba939 | |
parent | e98ff7f6d8164c5636538998fb7d1e08b1fbbddd (diff) |
[ARM] 4226/1: initial .data and .bss mappings of XIP kernel should be TEXT_OFFSET
aware
Since TEXT_OFFSET is meant to determine RAM location for kernel use,
itshould affect .data and .bss initial mapping in the XIP case.
Otherwise a XIP kernel would crash if TEXT_OFFSET gets somewhat larger
than 2MB.
Corresponding code is also moved up a bit to be near the similar .text
mapping code making the whole a bit more straight forward to understand.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/kernel/head.S | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index c5f0c52660b2..66db0a9bf0bc 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S | |||
@@ -252,6 +252,23 @@ __create_page_tables: | |||
252 | strls r3, [r0], #4 | 252 | strls r3, [r0], #4 |
253 | bls 1b | 253 | bls 1b |
254 | 254 | ||
255 | #ifdef CONFIG_XIP_KERNEL | ||
256 | /* | ||
257 | * Map some ram to cover our .data and .bss areas. | ||
258 | */ | ||
259 | orr r3, r7, #(KERNEL_RAM_PADDR & 0xff000000) | ||
260 | orr r3, r3, #(KERNEL_RAM_PADDR & 0x00f00000) | ||
261 | add r0, r4, #(KERNEL_RAM_VADDR & 0xff000000) >> 18 | ||
262 | str r3, [r0, #(KERNEL_RAM_VADDR & 0x00f00000) >> 18]! | ||
263 | ldr r6, =(_end - 1) | ||
264 | add r0, r0, #4 | ||
265 | add r6, r4, r6, lsr #18 | ||
266 | 1: cmp r0, r6 | ||
267 | add r3, r3, #1 << 20 | ||
268 | strls r3, [r0], #4 | ||
269 | bls 1b | ||
270 | #endif | ||
271 | |||
255 | /* | 272 | /* |
256 | * Then map first 1MB of ram in case it contains our boot params. | 273 | * Then map first 1MB of ram in case it contains our boot params. |
257 | */ | 274 | */ |
@@ -260,22 +277,6 @@ __create_page_tables: | |||
260 | orr r6, r6, #(PHYS_OFFSET & 0x00e00000) | 277 | orr r6, r6, #(PHYS_OFFSET & 0x00e00000) |
261 | str r6, [r0] | 278 | str r6, [r0] |
262 | 279 | ||
263 | #ifdef CONFIG_XIP_KERNEL | ||
264 | /* | ||
265 | * Map some ram to cover our .data and .bss areas. | ||
266 | * Mapping 3MB should be plenty. | ||
267 | */ | ||
268 | sub r3, r4, #PHYS_OFFSET | ||
269 | mov r3, r3, lsr #20 | ||
270 | add r0, r0, r3, lsl #2 | ||
271 | add r6, r6, r3, lsl #20 | ||
272 | str r6, [r0], #4 | ||
273 | add r6, r6, #(1 << 20) | ||
274 | str r6, [r0], #4 | ||
275 | add r6, r6, #(1 << 20) | ||
276 | str r6, [r0] | ||
277 | #endif | ||
278 | |||
279 | #ifdef CONFIG_DEBUG_LL | 280 | #ifdef CONFIG_DEBUG_LL |
280 | ldr r7, [r10, #PROCINFO_IO_MMUFLAGS] @ io_mmuflags | 281 | ldr r7, [r10, #PROCINFO_IO_MMUFLAGS] @ io_mmuflags |
281 | /* | 282 | /* |