]> cvs.zerfleddert.de Git - ms2-kexec/blobdiff - kexec.c
call real kernel_restart_prepare
[ms2-kexec] / kexec.c
diff --git a/kexec.c b/kexec.c
index 8a437da8777c6e7f739eb2c13b8d99513b3e0aa0..e7ea6042b5f9a8fa268609e2bfa3b64a104e6eb2 100644 (file)
--- a/kexec.c
+++ b/kexec.c
@@ -1140,7 +1140,7 @@ void crash_save_cpu(struct pt_regs *regs, int cpu)
                return;
        memset(&prstatus, 0, sizeof(prstatus));
        prstatus.pr_pid = current->pid;
                return;
        memset(&prstatus, 0, sizeof(prstatus));
        prstatus.pr_pid = current->pid;
-       elf_core_copy_regs(&prstatus.pr_reg, regs);
+       elf_core_copy_kernel_regs(&prstatus.pr_reg, regs);
        buf = append_elf_note(buf, KEXEC_CORE_NOTE_NAME, NT_PRSTATUS,
                              &prstatus, sizeof(prstatus));
        final_note(buf);
        buf = append_elf_note(buf, KEXEC_CORE_NOTE_NAME, NT_PRSTATUS,
                              &prstatus, sizeof(prstatus));
        final_note(buf);
@@ -1224,7 +1224,7 @@ static int __init parse_crashkernel_mem(char                      *cmdline,
        } while (*cur++ == ',');
 
        if (*crash_size > 0) {
        } while (*cur++ == ',');
 
        if (*crash_size > 0) {
-               while (*cur != ' ' && *cur != '@')
+               while (*cur && *cur != ' ' && *cur != '@')
                        cur++;
                if (*cur == '@') {
                        cur++;
                        cur++;
                if (*cur == '@') {
                        cur++;
@@ -1383,29 +1383,27 @@ int kernel_kexec(void)
                        goto Restore_console;
                }
                suspend_console();
                        goto Restore_console;
                }
                suspend_console();
-               error = device_suspend(PMSG_FREEZE);
+               error = dpm_suspend_start(PMSG_FREEZE);
                if (error)
                        goto Resume_console;
                if (error)
                        goto Resume_console;
-               error = disable_nonboot_cpus();
-               if (error)
-                       goto Resume_devices;
-               device_pm_lock();
-               local_irq_disable();
-               /* At this point, device_suspend() has been called,
-                * but *not* device_power_down(). We *must*
-                * device_power_down() now.  Otherwise, drivers for
+               /* At this point, dpm_suspend_start() has been called,
+                * but *not* dpm_suspend_noirq(). We *must* call
+                * dpm_suspend_noirq() now.  Otherwise, drivers for
                 * some devices (e.g. interrupt controllers) become
                 * desynchronized with the actual state of the
                 * hardware at resume time, and evil weirdness ensues.
                 */
                 * some devices (e.g. interrupt controllers) become
                 * desynchronized with the actual state of the
                 * hardware at resume time, and evil weirdness ensues.
                 */
-               error = device_power_down(PMSG_FREEZE);
+               error = dpm_suspend_noirq(PMSG_FREEZE);
                if (error)
                if (error)
-                       goto Enable_irqs;
-
+                       goto Resume_devices;
+               error = disable_nonboot_cpus();
+               if (error)
+                       goto Enable_cpus;
+               local_irq_disable();
                /* Suspend system devices */
                error = sysdev_suspend(PMSG_FREEZE);
                if (error)
                /* Suspend system devices */
                error = sysdev_suspend(PMSG_FREEZE);
                if (error)
-                       goto Power_up_devices;
+                       goto Enable_irqs;
        } else
 #endif
        {
        } else
 #endif
        {
@@ -1419,14 +1417,13 @@ int kernel_kexec(void)
 #ifdef CONFIG_KEXEC_JUMP
        if (kexec_image->preserve_context) {
                sysdev_resume();
 #ifdef CONFIG_KEXEC_JUMP
        if (kexec_image->preserve_context) {
                sysdev_resume();
- Power_up_devices:
-               device_power_up(PMSG_RESTORE);
  Enable_irqs:
                local_irq_enable();
  Enable_irqs:
                local_irq_enable();
-               device_pm_unlock();
+ Enable_cpus:
                enable_nonboot_cpus();
                enable_nonboot_cpus();
+               dpm_resume_noirq(PMSG_RESTORE);
  Resume_devices:
  Resume_devices:
-               device_resume(PMSG_RESTORE);
+               dpm_resume_end(PMSG_RESTORE);
  Resume_console:
                resume_console();
                thaw_processes();
  Resume_console:
                resume_console();
                thaw_processes();
@@ -1459,13 +1456,17 @@ unsigned long **find_sys_call_table(void)  {
 
 static int __init kexec_module_init(void)
 {
 
 static int __init kexec_module_init(void)
 {
-//     sys_call_table=(void **)find_sys_call_table();
-//     if(sys_call_table==NULL) {
-//             printk(KERN_ERR "Cannot find the system call address\n"); 
-//             return -1;  // do not load
-//     }
+       sys_call_table=(void **)find_sys_call_table();
+       if(sys_call_table==NULL) {
+               printk(KERN_ERR "Cannot find the system call address\n"); 
+               return -1;  // do not load
+       }
+
+       printk(KERN_INFO "kexec: Found sys_call_table at: %p\n", sys_call_table);
 
 
-       sys_call_table=(void **)0xc003d004;
+       //sys_call_table=(void **)0xc003d004;
+       sys_call_table=(void **)0xc00350c4;
+       printk(KERN_INFO "kexec: Force sys_call_table at: %p\n", sys_call_table);
 
        /* Set kexec_load() syscall. */
        sys_call_table[__NR_kexec_load]=kexec_load;
 
        /* Set kexec_load() syscall. */
        sys_call_table[__NR_kexec_load]=kexec_load;
Impressum, Datenschutz