diff options
author | Vivek Goyal <vgoyal@in.ibm.com> | 2005-09-03 18:56:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@evo.osdl.org> | 2005-09-05 03:06:09 -0400 |
commit | 484b90c4b965d54037ff99b198d84cdf144f8a35 (patch) | |
tree | 559efa2585ee360e610882724500cbe3d5712d98 /arch/i386/kernel/head.S | |
parent | 5fd75ebb1a58c1a3c9e3d9fdf75ce7286b79bb74 (diff) |
[PATCH] kdump: Save parameter segment in protected mode (x86)
o With introduction of kexec as boot-loader, the assumption that parameter
segment will always be loaded at lower address than kernel and will be
addressable by early bootup page tables is no longer valid. In kexec on
panic case parameter segment might well be loaded beyond kernel image and
might not be addressable by early boot page tables.
o This case might hit in the scenario where user has reserved a chunk of
memory for second kernel, for example 16MB to 64MB, and has also built
second kernel for physical memory location 16MB. In this case kexec has no
choice but to load the parameter segment at a higher address than new kernel
image at safe location where new kernel does not stomp it.
o Though problem should automatically go away once relocatable kernel for i386
is in place and kexec can determine the location of new kernel at run time
and load parameter segment at lower address than kernel image. But till then
this patch can go in (assuming it does not break something else).
o This patch moves up the boot parameter saving code. Now boot parameters
are copied out in protected mode before page tables are initialized. This
will ensure that parameter segment is always addressable irrespective of
its physical location.
Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/i386/kernel/head.S')
-rw-r--r-- | arch/i386/kernel/head.S | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/arch/i386/kernel/head.S b/arch/i386/kernel/head.S index 4477bb107098..0480ca9e9e57 100644 --- a/arch/i386/kernel/head.S +++ b/arch/i386/kernel/head.S | |||
@@ -77,6 +77,32 @@ ENTRY(startup_32) | |||
77 | subl %edi,%ecx | 77 | subl %edi,%ecx |
78 | shrl $2,%ecx | 78 | shrl $2,%ecx |
79 | rep ; stosl | 79 | rep ; stosl |
80 | /* | ||
81 | * Copy bootup parameters out of the way. | ||
82 | * Note: %esi still has the pointer to the real-mode data. | ||
83 | * With the kexec as boot loader, parameter segment might be loaded beyond | ||
84 | * kernel image and might not even be addressable by early boot page tables. | ||
85 | * (kexec on panic case). Hence copy out the parameters before initializing | ||
86 | * page tables. | ||
87 | */ | ||
88 | movl $(boot_params - __PAGE_OFFSET),%edi | ||
89 | movl $(PARAM_SIZE/4),%ecx | ||
90 | cld | ||
91 | rep | ||
92 | movsl | ||
93 | movl boot_params - __PAGE_OFFSET + NEW_CL_POINTER,%esi | ||
94 | andl %esi,%esi | ||
95 | jnz 2f # New command line protocol | ||
96 | cmpw $(OLD_CL_MAGIC),OLD_CL_MAGIC_ADDR | ||
97 | jne 1f | ||
98 | movzwl OLD_CL_OFFSET,%esi | ||
99 | addl $(OLD_CL_BASE_ADDR),%esi | ||
100 | 2: | ||
101 | movl $(saved_command_line - __PAGE_OFFSET),%edi | ||
102 | movl $(COMMAND_LINE_SIZE/4),%ecx | ||
103 | rep | ||
104 | movsl | ||
105 | 1: | ||
80 | 106 | ||
81 | /* | 107 | /* |
82 | * Initialize page tables. This creates a PDE and a set of page | 108 | * Initialize page tables. This creates a PDE and a set of page |
@@ -214,28 +240,6 @@ ENTRY(startup_32_smp) | |||
214 | */ | 240 | */ |
215 | call setup_idt | 241 | call setup_idt |
216 | 242 | ||
217 | /* | ||
218 | * Copy bootup parameters out of the way. | ||
219 | * Note: %esi still has the pointer to the real-mode data. | ||
220 | */ | ||
221 | movl $boot_params,%edi | ||
222 | movl $(PARAM_SIZE/4),%ecx | ||
223 | cld | ||
224 | rep | ||
225 | movsl | ||
226 | movl boot_params+NEW_CL_POINTER,%esi | ||
227 | andl %esi,%esi | ||
228 | jnz 2f # New command line protocol | ||
229 | cmpw $(OLD_CL_MAGIC),OLD_CL_MAGIC_ADDR | ||
230 | jne 1f | ||
231 | movzwl OLD_CL_OFFSET,%esi | ||
232 | addl $(OLD_CL_BASE_ADDR),%esi | ||
233 | 2: | ||
234 | movl $saved_command_line,%edi | ||
235 | movl $(COMMAND_LINE_SIZE/4),%ecx | ||
236 | rep | ||
237 | movsl | ||
238 | 1: | ||
239 | checkCPUtype: | 243 | checkCPUtype: |
240 | 244 | ||
241 | movl $-1,X86_CPUID # -1 for no CPUID initially | 245 | movl $-1,X86_CPUID # -1 for no CPUID initially |