]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] kdump: Retrieve saved max pfn
authorVivek Goyal <vgoyal@in.ibm.com>
Sat, 25 Jun 2005 21:58:18 +0000 (14:58 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sat, 25 Jun 2005 23:24:52 +0000 (16:24 -0700)
This patch retrieves the max_pfn being used by previous kernel and stores it
in a safe location (saved_max_pfn) before it is overwritten due to user
defined memory map.  This pfn is used to make sure that user does not try to
read the physical memory beyond saved_max_pfn.

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>
arch/i386/kernel/setup.c
include/linux/bootmem.h
mm/bootmem.c

index d88ebdfa6ccd980c233cd206c7440b21af0ea476..8d58a053e12e097fb067a85fb2cab44c06a4517a 100644 (file)
@@ -59,6 +59,9 @@
 #include "setup_arch_pre.h"
 #include <bios_ebda.h>
 
+/* Forward Declaration. */
+void __init find_max_pfn(void);
+
 /* This value is set up by the early boot code to point to the value
    immediately after the boot time page tables.  It contains a *physical*
    address, and must not be in the .bss segment! */
@@ -736,6 +739,15 @@ static void __init parse_cmdline_early (char ** cmdline_p)
                        if (to != command_line)
                                to--;
                        if (!memcmp(from+7, "exactmap", 8)) {
+#ifdef CONFIG_CRASH_DUMP
+                               /* If we are doing a crash dump, we
+                                * still need to know the real mem
+                                * size before original memory map is
+                                * reset.
+                                */
+                               find_max_pfn();
+                               saved_max_pfn = max_pfn;
+#endif
                                from += 8+7;
                                e820.nr_map = 0;
                                userdef = 1;
index 500f451ce0c0012dfe533ddd4f05b2a28db5b78f..82bd8842d11cfe3a01e704aaec3aab947b917c08 100644 (file)
@@ -22,6 +22,10 @@ extern unsigned long min_low_pfn;
  */
 extern unsigned long max_pfn;
 
+#ifdef CONFIG_CRASH_DUMP
+extern unsigned long saved_max_pfn;
+#endif
+
 /*
  * node_bootmem_map is a map pointer - the bits represent all physical 
  * memory pages (including holes) on the node.
index f82f7aebbee31be3b81469a40a070b95e5954f60..45275f1f894776e3343df1dd2c6197807535ef31 100644 (file)
@@ -33,6 +33,14 @@ EXPORT_SYMBOL(max_pfn);              /* This is exported so
                                 * dma_get_required_mask(), which uses
                                 * it, can be an inline function */
 
+#ifdef CONFIG_CRASH_DUMP
+/*
+ * If we have booted due to a crash, max_pfn will be a very low value. We need
+ * to know the amount of memory that the previous kernel used.
+ */
+unsigned long saved_max_pfn;
+#endif
+
 /* return the number of _pages_ that will be allocated for the boot bitmap */
 unsigned long __init bootmem_bootmap_pages (unsigned long pages)
 {