[PATCH] i386: Fix warning in mpparse.c
[safe/jmp/linux-2.6] / arch / i386 / kernel / machine_kexec.c
index a912fed..66c3dc9 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/mm.h>
 #include <linux/kexec.h>
 #include <linux/delay.h>
+#include <linux/init.h>
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
 #include <asm/tlbflush.h>
@@ -116,13 +117,13 @@ static void load_segments(void)
        __asm__ __volatile__ (
                "\tljmp $"STR(__KERNEL_CS)",$1f\n"
                "\t1:\n"
-               "\tmovl $"STR(__KERNEL_DS)",%eax\n"
-               "\tmovl %eax,%ds\n"
-               "\tmovl %eax,%es\n"
-               "\tmovl %eax,%fs\n"
-               "\tmovl %eax,%gs\n"
-               "\tmovl %eax,%ss\n"
-               );
+               "\tmovl $"STR(__KERNEL_DS)",%%eax\n"
+               "\tmovl %%eax,%%ds\n"
+               "\tmovl %%eax,%%es\n"
+               "\tmovl %%eax,%%fs\n"
+               "\tmovl %%eax,%%gs\n"
+               "\tmovl %%eax,%%ss\n"
+               ::: "eax", "memory");
 #undef STR
 #undef __STR
 }
@@ -133,9 +134,9 @@ typedef asmlinkage NORET_TYPE void (*relocate_new_kernel_t)(
                                        unsigned long start_address,
                                        unsigned int has_pae) ATTRIB_NORET;
 
-const extern unsigned char relocate_new_kernel[];
+extern const unsigned char relocate_new_kernel[];
 extern void relocate_new_kernel_end(void);
-const extern unsigned int relocate_new_kernel_size;
+extern const unsigned int relocate_new_kernel_size;
 
 /*
  * A architecture hook called to validate the
@@ -189,14 +190,11 @@ NORET_TYPE void machine_kexec(struct kimage *image)
        memcpy((void *)reboot_code_buffer, relocate_new_kernel,
                                                relocate_new_kernel_size);
 
-       /* The segment registers are funny things, they are
-        * automatically loaded from a table, in memory wherever you
-        * set them to a specific selector, but this table is never
-        * accessed again you set the segment to a different selector.
-        *
-        * The more common model is are caches where the behide
-        * the scenes work is done, but is also dropped at arbitrary
-        * times.
+       /* The segment registers are funny things, they have both a
+        * visible and an invisible part.  Whenever the visible part is
+        * set to a specific selector, the invisible part is loaded
+        * with from a table in memory.  At no other time is the
+        * descriptor table in memory accessed.
         *
         * I take advantage of this here by force loading the
         * segments, before I zap the gdt with an invalid value.
@@ -212,3 +210,25 @@ NORET_TYPE void machine_kexec(struct kimage *image)
        rnk = (relocate_new_kernel_t) reboot_code_buffer;
        (*rnk)(page_list, reboot_code_buffer, image->start, cpu_has_pae);
 }
+
+/* crashkernel=size@addr specifies the location to reserve for
+ * a crash kernel.  By reserving this memory we guarantee
+ * that linux never sets it up as a DMA target.
+ * Useful for holding code to do something appropriate
+ * after a kernel panic.
+ */
+static int __init parse_crashkernel(char *arg)
+{
+       unsigned long size, base;
+       size = memparse(arg, &arg);
+       if (*arg == '@') {
+               base = memparse(arg+1, &arg);
+               /* FIXME: Do I want a sanity check
+                * to validate the memory range?
+                */
+               crashk_res.start = base;
+               crashk_res.end   = base + size - 1;
+       }
+       return 0;
+}
+early_param("crashkernel", parse_crashkernel);