diff options
Diffstat (limited to 'kernel/kexec.c')
| -rw-r--r-- | kernel/kexec.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/kernel/kexec.c b/kernel/kexec.c index 2c95848fbce8..bf39d28e4c0e 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | * Version 2. See the file COPYING for more details. | 6 | * Version 2. See the file COPYING for more details. |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #include <linux/capability.h> | ||
| 9 | #include <linux/mm.h> | 10 | #include <linux/mm.h> |
| 10 | #include <linux/file.h> | 11 | #include <linux/file.h> |
| 11 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
| @@ -26,6 +27,9 @@ | |||
| 26 | #include <asm/system.h> | 27 | #include <asm/system.h> |
| 27 | #include <asm/semaphore.h> | 28 | #include <asm/semaphore.h> |
| 28 | 29 | ||
| 30 | /* Per cpu memory for storing cpu states in case of system crash. */ | ||
| 31 | note_buf_t* crash_notes; | ||
| 32 | |||
| 29 | /* Location of the reserved area for the crash kernel */ | 33 | /* Location of the reserved area for the crash kernel */ |
| 30 | struct resource crashk_res = { | 34 | struct resource crashk_res = { |
| 31 | .name = "Crash kernel", | 35 | .name = "Crash kernel", |
| @@ -1054,9 +1058,24 @@ void crash_kexec(struct pt_regs *regs) | |||
| 1054 | if (!locked) { | 1058 | if (!locked) { |
| 1055 | image = xchg(&kexec_crash_image, NULL); | 1059 | image = xchg(&kexec_crash_image, NULL); |
| 1056 | if (image) { | 1060 | if (image) { |
| 1057 | machine_crash_shutdown(regs); | 1061 | struct pt_regs fixed_regs; |
| 1062 | crash_setup_regs(&fixed_regs, regs); | ||
| 1063 | machine_crash_shutdown(&fixed_regs); | ||
| 1058 | machine_kexec(image); | 1064 | machine_kexec(image); |
| 1059 | } | 1065 | } |
| 1060 | xchg(&kexec_lock, 0); | 1066 | xchg(&kexec_lock, 0); |
| 1061 | } | 1067 | } |
| 1062 | } | 1068 | } |
| 1069 | |||
| 1070 | static int __init crash_notes_memory_init(void) | ||
| 1071 | { | ||
| 1072 | /* Allocate memory for saving cpu registers. */ | ||
| 1073 | crash_notes = alloc_percpu(note_buf_t); | ||
| 1074 | if (!crash_notes) { | ||
| 1075 | printk("Kexec: Memory allocation for saving cpu register" | ||
| 1076 | " states failed\n"); | ||
| 1077 | return -ENOMEM; | ||
| 1078 | } | ||
| 1079 | return 0; | ||
| 1080 | } | ||
| 1081 | module_init(crash_notes_memory_init) | ||
