diff options
author | Jesper Nilsson <jesper.nilsson@axis.com> | 2008-01-17 18:21:11 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-01-17 18:38:58 -0500 |
commit | b0e86f0a3b9329bbebadb01ca935208459df18c3 (patch) | |
tree | e5c662538c6c35a76d6a11a1e2d8db550e369e4d | |
parent | efe7cf2dcf4b72c7a9f991466d1f22850232244f (diff) |
CRIS v10: vmlinux.lds.S: ix kernel oops on boot and use common defines
- Move alignment to page size of init data outside ifdef for BLK_DEV_INITRD.
The reservation up to page size of memory after init data was previously
not done if BLK_DEV_INITRD was undefined.
This caused a kernel oops when init memory pages were freed after startup,
data placed in the same page as the last init memory would also be freed
and reused, with disastrous results.
- Use macros for initcalls and .text sections.
- Replace hardcoded page size constant with PAGE_SIZE define.
- Change include/asm-cris/page.h to use the _AC macro to instead
of testing __ASSEMBLY__.
Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Mikael Starvik <mikael.starvik@axis.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/cris/arch-v10/vmlinux.lds.S | 33 | ||||
-rw-r--r-- | include/asm-cris/page.h | 7 |
2 files changed, 17 insertions, 23 deletions
diff --git a/arch/cris/arch-v10/vmlinux.lds.S b/arch/cris/arch-v10/vmlinux.lds.S index 9859d49d088b..97a7876ed681 100644 --- a/arch/cris/arch-v10/vmlinux.lds.S +++ b/arch/cris/arch-v10/vmlinux.lds.S | |||
@@ -9,7 +9,8 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <asm-generic/vmlinux.lds.h> | 11 | #include <asm-generic/vmlinux.lds.h> |
12 | 12 | #include <asm/page.h> | |
13 | |||
13 | jiffies = jiffies_64; | 14 | jiffies = jiffies_64; |
14 | SECTIONS | 15 | SECTIONS |
15 | { | 16 | { |
@@ -23,7 +24,7 @@ SECTIONS | |||
23 | _stext = .; | 24 | _stext = .; |
24 | __stext = .; | 25 | __stext = .; |
25 | .text : { | 26 | .text : { |
26 | *(.text) | 27 | TEXT_TEXT |
27 | SCHED_TEXT | 28 | SCHED_TEXT |
28 | LOCK_TEXT | 29 | LOCK_TEXT |
29 | *(.fixup) | 30 | *(.fixup) |
@@ -49,10 +50,10 @@ SECTIONS | |||
49 | __edata = . ; /* End of data section */ | 50 | __edata = . ; /* End of data section */ |
50 | _edata = . ; | 51 | _edata = . ; |
51 | 52 | ||
52 | . = ALIGN(8192); /* init_task and stack, must be aligned */ | 53 | . = ALIGN(PAGE_SIZE); /* init_task and stack, must be aligned */ |
53 | .data.init_task : { *(.data.init_task) } | 54 | .data.init_task : { *(.data.init_task) } |
54 | 55 | ||
55 | . = ALIGN(8192); /* Init code and data */ | 56 | . = ALIGN(PAGE_SIZE); /* Init code and data */ |
56 | __init_begin = .; | 57 | __init_begin = .; |
57 | .init.text : { | 58 | .init.text : { |
58 | _sinittext = .; | 59 | _sinittext = .; |
@@ -66,13 +67,7 @@ SECTIONS | |||
66 | __setup_end = .; | 67 | __setup_end = .; |
67 | .initcall.init : { | 68 | .initcall.init : { |
68 | __initcall_start = .; | 69 | __initcall_start = .; |
69 | *(.initcall1.init); | 70 | INITCALLS |
70 | *(.initcall2.init); | ||
71 | *(.initcall3.init); | ||
72 | *(.initcall4.init); | ||
73 | *(.initcall5.init); | ||
74 | *(.initcall6.init); | ||
75 | *(.initcall7.init); | ||
76 | __initcall_end = .; | 71 | __initcall_end = .; |
77 | } | 72 | } |
78 | 73 | ||
@@ -88,16 +83,18 @@ SECTIONS | |||
88 | __initramfs_start = .; | 83 | __initramfs_start = .; |
89 | *(.init.ramfs) | 84 | *(.init.ramfs) |
90 | __initramfs_end = .; | 85 | __initramfs_end = .; |
91 | /* We fill to the next page, so we can discard all init | ||
92 | pages without needing to consider what payload might be | ||
93 | appended to the kernel image. */ | ||
94 | FILL (0); | ||
95 | . = ALIGN (8192); | ||
96 | } | 86 | } |
97 | #endif | 87 | #endif |
98 | |||
99 | __vmlinux_end = .; /* last address of the physical file */ | 88 | __vmlinux_end = .; /* last address of the physical file */ |
100 | __init_end = .; | 89 | |
90 | /* | ||
91 | * We fill to the next page, so we can discard all init | ||
92 | * pages without needing to consider what payload might be | ||
93 | * appended to the kernel image. | ||
94 | */ | ||
95 | . = ALIGN(PAGE_SIZE); | ||
96 | |||
97 | __init_end = .; | ||
101 | 98 | ||
102 | __data_end = . ; /* Move to _edata ? */ | 99 | __data_end = . ; /* Move to _edata ? */ |
103 | __bss_start = .; /* BSS */ | 100 | __bss_start = .; /* BSS */ |
diff --git a/include/asm-cris/page.h b/include/asm-cris/page.h index 0648e3153f81..b84353ef6998 100644 --- a/include/asm-cris/page.h +++ b/include/asm-cris/page.h | |||
@@ -4,14 +4,11 @@ | |||
4 | #ifdef __KERNEL__ | 4 | #ifdef __KERNEL__ |
5 | 5 | ||
6 | #include <asm/arch/page.h> | 6 | #include <asm/arch/page.h> |
7 | #include <linux/const.h> | ||
7 | 8 | ||
8 | /* PAGE_SHIFT determines the page size */ | 9 | /* PAGE_SHIFT determines the page size */ |
9 | #define PAGE_SHIFT 13 | 10 | #define PAGE_SHIFT 13 |
10 | #ifndef __ASSEMBLY__ | 11 | #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) |
11 | #define PAGE_SIZE (1UL << PAGE_SHIFT) | ||
12 | #else | ||
13 | #define PAGE_SIZE (1 << PAGE_SHIFT) | ||
14 | #endif | ||
15 | #define PAGE_MASK (~(PAGE_SIZE-1)) | 12 | #define PAGE_MASK (~(PAGE_SIZE-1)) |
16 | 13 | ||
17 | #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) | 14 | #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) |