diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2005-06-25 17:57:47 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-25 19:24:47 -0400 |
commit | ad0d75ebacdbf1004d004803df0ba371c6bdbe2a (patch) | |
tree | 2d571878e907ad503698c1878f7670e0af933af6 /arch | |
parent | 60bad7fadf59313a6359f8828bb0087884ad001a (diff) |
[PATCH] kexec: x86: vmlinux: fix physical addresses
The vmlinux on i386 does not report the correct physical address of
the kernel. Instead in the physical address field it currently
reports the virtual address of the kernel.
This is patch is a bug fix that corrects vmlinux to report the
proper physical addresses.
This is potentially a help for crash dump analysis tools.
This definitiely allows bootloaders that load vmlinux as a standard
ELF executable. Bootloaders directly loading vmlinux become of
practical importance when we consider the kexec on panic case.
Signed-off-by: Eric Biederman <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/i386/kernel/vmlinux.lds.S | 59 |
1 files changed, 38 insertions, 21 deletions
diff --git a/arch/i386/kernel/vmlinux.lds.S b/arch/i386/kernel/vmlinux.lds.S index e0512cc8bea7..e17ab69c1f05 100644 --- a/arch/i386/kernel/vmlinux.lds.S +++ b/arch/i386/kernel/vmlinux.lds.S | |||
@@ -2,20 +2,23 @@ | |||
2 | * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>; | 2 | * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>; |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #define LOAD_OFFSET __PAGE_OFFSET | ||
6 | |||
5 | #include <asm-generic/vmlinux.lds.h> | 7 | #include <asm-generic/vmlinux.lds.h> |
6 | #include <asm/thread_info.h> | 8 | #include <asm/thread_info.h> |
7 | #include <asm/page.h> | 9 | #include <asm/page.h> |
8 | 10 | ||
9 | OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") | 11 | OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") |
10 | OUTPUT_ARCH(i386) | 12 | OUTPUT_ARCH(i386) |
11 | ENTRY(startup_32) | 13 | ENTRY(phys_startup_32) |
12 | jiffies = jiffies_64; | 14 | jiffies = jiffies_64; |
13 | SECTIONS | 15 | SECTIONS |
14 | { | 16 | { |
15 | . = __PAGE_OFFSET + 0x100000; | 17 | . = LOAD_OFFSET + 0x100000; |
18 | phys_startup_32 = startup_32 - LOAD_OFFSET; | ||
16 | /* read-only */ | 19 | /* read-only */ |
17 | _text = .; /* Text and read-only data */ | 20 | _text = .; /* Text and read-only data */ |
18 | .text : { | 21 | .text : AT(ADDR(.text) - LOAD_OFFSET) { |
19 | *(.text) | 22 | *(.text) |
20 | SCHED_TEXT | 23 | SCHED_TEXT |
21 | LOCK_TEXT | 24 | LOCK_TEXT |
@@ -27,49 +30,55 @@ SECTIONS | |||
27 | 30 | ||
28 | . = ALIGN(16); /* Exception table */ | 31 | . = ALIGN(16); /* Exception table */ |
29 | __start___ex_table = .; | 32 | __start___ex_table = .; |
30 | __ex_table : { *(__ex_table) } | 33 | __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { *(__ex_table) } |
31 | __stop___ex_table = .; | 34 | __stop___ex_table = .; |
32 | 35 | ||
33 | RODATA | 36 | RODATA |
34 | 37 | ||
35 | /* writeable */ | 38 | /* writeable */ |
36 | .data : { /* Data */ | 39 | .data : AT(ADDR(.data) - LOAD_OFFSET) { /* Data */ |
37 | *(.data) | 40 | *(.data) |
38 | CONSTRUCTORS | 41 | CONSTRUCTORS |
39 | } | 42 | } |
40 | 43 | ||
41 | . = ALIGN(4096); | 44 | . = ALIGN(4096); |
42 | __nosave_begin = .; | 45 | __nosave_begin = .; |
43 | .data_nosave : { *(.data.nosave) } | 46 | .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { *(.data.nosave) } |
44 | . = ALIGN(4096); | 47 | . = ALIGN(4096); |
45 | __nosave_end = .; | 48 | __nosave_end = .; |
46 | 49 | ||
47 | . = ALIGN(4096); | 50 | . = ALIGN(4096); |
48 | .data.page_aligned : { *(.data.idt) } | 51 | .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) { |
52 | *(.data.idt) | ||
53 | } | ||
49 | 54 | ||
50 | . = ALIGN(32); | 55 | . = ALIGN(32); |
51 | .data.cacheline_aligned : { *(.data.cacheline_aligned) } | 56 | .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) { |
57 | *(.data.cacheline_aligned) | ||
58 | } | ||
52 | 59 | ||
53 | _edata = .; /* End of data section */ | 60 | _edata = .; /* End of data section */ |
54 | 61 | ||
55 | . = ALIGN(THREAD_SIZE); /* init_task */ | 62 | . = ALIGN(THREAD_SIZE); /* init_task */ |
56 | .data.init_task : { *(.data.init_task) } | 63 | .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) { |
64 | *(.data.init_task) | ||
65 | } | ||
57 | 66 | ||
58 | /* will be freed after init */ | 67 | /* will be freed after init */ |
59 | . = ALIGN(4096); /* Init code and data */ | 68 | . = ALIGN(4096); /* Init code and data */ |
60 | __init_begin = .; | 69 | __init_begin = .; |
61 | .init.text : { | 70 | .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { |
62 | _sinittext = .; | 71 | _sinittext = .; |
63 | *(.init.text) | 72 | *(.init.text) |
64 | _einittext = .; | 73 | _einittext = .; |
65 | } | 74 | } |
66 | .init.data : { *(.init.data) } | 75 | .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) } |
67 | . = ALIGN(16); | 76 | . = ALIGN(16); |
68 | __setup_start = .; | 77 | __setup_start = .; |
69 | .init.setup : { *(.init.setup) } | 78 | .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { *(.init.setup) } |
70 | __setup_end = .; | 79 | __setup_end = .; |
71 | __initcall_start = .; | 80 | __initcall_start = .; |
72 | .initcall.init : { | 81 | .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) { |
73 | *(.initcall1.init) | 82 | *(.initcall1.init) |
74 | *(.initcall2.init) | 83 | *(.initcall2.init) |
75 | *(.initcall3.init) | 84 | *(.initcall3.init) |
@@ -80,33 +89,41 @@ SECTIONS | |||
80 | } | 89 | } |
81 | __initcall_end = .; | 90 | __initcall_end = .; |
82 | __con_initcall_start = .; | 91 | __con_initcall_start = .; |
83 | .con_initcall.init : { *(.con_initcall.init) } | 92 | .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) { |
93 | *(.con_initcall.init) | ||
94 | } | ||
84 | __con_initcall_end = .; | 95 | __con_initcall_end = .; |
85 | SECURITY_INIT | 96 | SECURITY_INIT |
86 | . = ALIGN(4); | 97 | . = ALIGN(4); |
87 | __alt_instructions = .; | 98 | __alt_instructions = .; |
88 | .altinstructions : { *(.altinstructions) } | 99 | .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) { |
100 | *(.altinstructions) | ||
101 | } | ||
89 | __alt_instructions_end = .; | 102 | __alt_instructions_end = .; |
90 | .altinstr_replacement : { *(.altinstr_replacement) } | 103 | .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) { |
104 | *(.altinstr_replacement) | ||
105 | } | ||
91 | /* .exit.text is discard at runtime, not link time, to deal with references | 106 | /* .exit.text is discard at runtime, not link time, to deal with references |
92 | from .altinstructions and .eh_frame */ | 107 | from .altinstructions and .eh_frame */ |
93 | .exit.text : { *(.exit.text) } | 108 | .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) } |
94 | .exit.data : { *(.exit.data) } | 109 | .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) } |
95 | . = ALIGN(4096); | 110 | . = ALIGN(4096); |
96 | __initramfs_start = .; | 111 | __initramfs_start = .; |
97 | .init.ramfs : { *(.init.ramfs) } | 112 | .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { *(.init.ramfs) } |
98 | __initramfs_end = .; | 113 | __initramfs_end = .; |
99 | . = ALIGN(32); | 114 | . = ALIGN(32); |
100 | __per_cpu_start = .; | 115 | __per_cpu_start = .; |
101 | .data.percpu : { *(.data.percpu) } | 116 | .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { *(.data.percpu) } |
102 | __per_cpu_end = .; | 117 | __per_cpu_end = .; |
103 | . = ALIGN(4096); | 118 | . = ALIGN(4096); |
104 | __init_end = .; | 119 | __init_end = .; |
105 | /* freed after init ends here */ | 120 | /* freed after init ends here */ |
106 | 121 | ||
107 | __bss_start = .; /* BSS */ | 122 | __bss_start = .; /* BSS */ |
108 | .bss : { | 123 | .bss.page_aligned : AT(ADDR(.bss.page_aligned) - LOAD_OFFSET) { |
109 | *(.bss.page_aligned) | 124 | *(.bss.page_aligned) |
125 | } | ||
126 | .bss : AT(ADDR(.bss) - LOAD_OFFSET) { | ||
110 | *(.bss) | 127 | *(.bss) |
111 | } | 128 | } |
112 | . = ALIGN(4); | 129 | . = ALIGN(4); |