From: Nicolas Pitre Date: Wed, 21 Feb 2007 14:32:28 +0000 (+0100) Subject: [ARM] 4226/1: initial .data and .bss mappings of XIP kernel should be TEXT_OFFSET X-Git-Tag: v2.6.21-rc2~28^2~4 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec3622d963522432a873cc1b6f66fed6fceddc18;p=linux-2.6 [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 --- diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index c5f0c52660..66db0a9bf0 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 /*