From ec3622d963522432a873cc1b6f66fed6fceddc18 Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Wed, 21 Feb 2007 15:32:28 +0100 Subject: [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 Signed-off-by: Russell King --- arch/arm/kernel/head.S | 33 +++++++++++++++++---------------- 1 file 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: strls r3, [r0], #4 bls 1b +#ifdef CONFIG_XIP_KERNEL + /* + * Map some ram to cover our .data and .bss areas. + */ + orr r3, r7, #(KERNEL_RAM_PADDR & 0xff000000) + orr r3, r3, #(KERNEL_RAM_PADDR & 0x00f00000) + add r0, r4, #(KERNEL_RAM_VADDR & 0xff000000) >> 18 + str r3, [r0, #(KERNEL_RAM_VADDR & 0x00f00000) >> 18]! + ldr r6, =(_end - 1) + add r0, r0, #4 + add r6, r4, r6, lsr #18 +1: cmp r0, r6 + add r3, r3, #1 << 20 + strls r3, [r0], #4 + bls 1b +#endif + /* * Then map first 1MB of ram in case it contains our boot params. */ @@ -260,22 +277,6 @@ __create_page_tables: orr r6, r6, #(PHYS_OFFSET & 0x00e00000) str r6, [r0] -#ifdef CONFIG_XIP_KERNEL - /* - * Map some ram to cover our .data and .bss areas. - * Mapping 3MB should be plenty. - */ - sub r3, r4, #PHYS_OFFSET - mov r3, r3, lsr #20 - add r0, r0, r3, lsl #2 - add r6, r6, r3, lsl #20 - str r6, [r0], #4 - add r6, r6, #(1 << 20) - str r6, [r0], #4 - add r6, r6, #(1 << 20) - str r6, [r0] -#endif - #ifdef CONFIG_DEBUG_LL ldr r7, [r10, #PROCINFO_IO_MMUFLAGS] @ io_mmuflags /* -- cgit v1.2.2