diff options
Diffstat (limited to 'arch/arm/kernel/head.S')
-rw-r--r-- | arch/arm/kernel/head.S | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index cf495a3084b3..66db0a9bf0bc 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S | |||
@@ -48,9 +48,11 @@ | |||
48 | .endm | 48 | .endm |
49 | 49 | ||
50 | #ifdef CONFIG_XIP_KERNEL | 50 | #ifdef CONFIG_XIP_KERNEL |
51 | #define TEXTADDR XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR) | 51 | #define KERNEL_START XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR) |
52 | #define KERNEL_END _edata_loc | ||
52 | #else | 53 | #else |
53 | #define TEXTADDR KERNEL_RAM_VADDR | 54 | #define KERNEL_START KERNEL_RAM_VADDR |
55 | #define KERNEL_END _end | ||
54 | #endif | 56 | #endif |
55 | 57 | ||
56 | /* | 58 | /* |
@@ -240,16 +242,32 @@ __create_page_tables: | |||
240 | * Now setup the pagetables for our kernel direct | 242 | * Now setup the pagetables for our kernel direct |
241 | * mapped region. | 243 | * mapped region. |
242 | */ | 244 | */ |
243 | add r0, r4, #(TEXTADDR & 0xff000000) >> 18 @ start of kernel | 245 | add r0, r4, #(KERNEL_START & 0xff000000) >> 18 |
244 | str r3, [r0, #(TEXTADDR & 0x00f00000) >> 18]! | 246 | str r3, [r0, #(KERNEL_START & 0x00f00000) >> 18]! |
245 | 247 | ldr r6, =(KERNEL_END - 1) | |
246 | ldr r6, =(_end - PAGE_OFFSET - 1) @ r6 = number of sections | 248 | add r0, r0, #4 |
247 | mov r6, r6, lsr #20 @ needed for kernel minus 1 | 249 | add r6, r4, r6, lsr #18 |
250 | 1: cmp r0, r6 | ||
251 | add r3, r3, #1 << 20 | ||
252 | strls r3, [r0], #4 | ||
253 | bls 1b | ||
248 | 254 | ||
249 | 1: add r3, r3, #1 << 20 | 255 | #ifdef CONFIG_XIP_KERNEL |
250 | str r3, [r0, #4]! | 256 | /* |
251 | subs r6, r6, #1 | 257 | * Map some ram to cover our .data and .bss areas. |
252 | bgt 1b | 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 | ||
253 | 271 | ||
254 | /* | 272 | /* |
255 | * 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. |
@@ -259,22 +277,6 @@ __create_page_tables: | |||
259 | orr r6, r6, #(PHYS_OFFSET & 0x00e00000) | 277 | orr r6, r6, #(PHYS_OFFSET & 0x00e00000) |
260 | str r6, [r0] | 278 | str r6, [r0] |
261 | 279 | ||
262 | #ifdef CONFIG_XIP_KERNEL | ||
263 | /* | ||
264 | * Map some ram to cover our .data and .bss areas. | ||
265 | * Mapping 3MB should be plenty. | ||
266 | */ | ||
267 | sub r3, r4, #PHYS_OFFSET | ||
268 | mov r3, r3, lsr #20 | ||
269 | add r0, r0, r3, lsl #2 | ||
270 | add r6, r6, r3, lsl #20 | ||
271 | str r6, [r0], #4 | ||
272 | add r6, r6, #(1 << 20) | ||
273 | str r6, [r0], #4 | ||
274 | add r6, r6, #(1 << 20) | ||
275 | str r6, [r0] | ||
276 | #endif | ||
277 | |||
278 | #ifdef CONFIG_DEBUG_LL | 280 | #ifdef CONFIG_DEBUG_LL |
279 | ldr r7, [r10, #PROCINFO_IO_MMUFLAGS] @ io_mmuflags | 281 | ldr r7, [r10, #PROCINFO_IO_MMUFLAGS] @ io_mmuflags |
280 | /* | 282 | /* |