summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennert Buytenhek <buytenh@org.rmk.(none)>2006-09-29 21:14:05 +0100
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-09-30 11:30:44 +0100
commit2552fc27ff79b10b9678d92bcaef21df38bb7bb6 (patch)
treec69faf46c3df7f9260f33ea7e562bebee6854766
parent6ae5a6ef0340908fb7065a75231ae9980a910fbe (diff)
downloadlinux-2552fc27ff79b10b9678d92bcaef21df38bb7bb6.tar.gz
linux-2552fc27ff79b10b9678d92bcaef21df38bb7bb6.tar.bz2
linux-2552fc27ff79b10b9678d92bcaef21df38bb7bb6.zip
[ARM] 3809/3: get rid of 4 megabyte kernel image size limit
We currently have a hardcoded 4 megabyte uncompressed kernel image size limit, which is easily exceeded by, for example, enabling some of the various kernel debugging options. When setting up the initial page tables (which is where this 4M limit is hardcoded), it's actually relatively easy to find out the true size of the uncompressed kernel image and create enough page table entries for things to fit, so this patch makes it so. In the decompressor, we also need to know the size of the uncompressed kernel image, to figure out whether there is any chance that uncompressing the kernel might overwrite the compressed kernel image stored elsewhere in memory. We don't have that info at this boot stage, though, so we approximate the size of the uncompressed kernel by taking the compressed kernel image size and allowing for a maximum 4x expansion. Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/boot/compressed/head.S3
-rw-r--r--arch/arm/kernel/head.S18
2 files changed, 11 insertions, 10 deletions
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index e5ab51b9cceb..2568d311be21 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -237,7 +237,8 @@ not_relocated: mov r0, #0
*/
cmp r4, r2
bhs wont_overwrite
- add r0, r4, #4096*1024 @ 4MB largest kernel size
+ sub r3, sp, r5 @ > compressed kernel size
+ add r0, r4, r3, lsl #2 @ allow for 4x expansion
cmp r0, r5
bls wont_overwrite
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 5365d4e5949e..ebc3e74a7947 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -234,18 +234,18 @@ __create_page_tables:
/*
* Now setup the pagetables for our kernel direct
- * mapped region. We round TEXTADDR down to the
- * nearest megabyte boundary. It is assumed that
- * the kernel fits within 4 contigous 1MB sections.
+ * mapped region.
*/
add r0, r4, #(TEXTADDR & 0xff000000) >> 18 @ start of kernel
str r3, [r0, #(TEXTADDR & 0x00f00000) >> 18]!
- add r3, r3, #1 << 20
- str r3, [r0, #4]! @ KERNEL + 1MB
- add r3, r3, #1 << 20
- str r3, [r0, #4]! @ KERNEL + 2MB
- add r3, r3, #1 << 20
- str r3, [r0, #4] @ KERNEL + 3MB
+
+ ldr r6, =(_end - PAGE_OFFSET - 1) @ r6 = number of sections
+ mov r6, r6, lsr #20 @ needed for kernel minus 1
+
+1: add r3, r3, #1 << 20
+ str r3, [r0, #4]!
+ subs r6, r6, #1
+ bgt 1b
/*
* Then map first 1MB of ram in case it contains our boot params.