hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/arch/x86/include/asm/kexec.h
....@@ -21,6 +21,7 @@
2121 #ifndef __ASSEMBLY__
2222
2323 #include <linux/string.h>
24
+#include <linux/kernel.h>
2425
2526 #include <asm/page.h>
2627 #include <asm/ptrace.h>
....@@ -65,26 +66,6 @@
6566 # define KEXEC_ARCH KEXEC_ARCH_X86_64
6667 #endif
6768
68
-/* Memory to backup during crash kdump */
69
-#define KEXEC_BACKUP_SRC_START (0UL)
70
-#define KEXEC_BACKUP_SRC_END (640 * 1024UL - 1) /* 640K */
71
-
72
-/*
73
- * CPU does not save ss and sp on stack if execution is already
74
- * running in kernel mode at the time of NMI occurrence. This code
75
- * fixes it.
76
- */
77
-static inline void crash_fixup_ss_esp(struct pt_regs *newregs,
78
- struct pt_regs *oldregs)
79
-{
80
-#ifdef CONFIG_X86_32
81
- newregs->sp = (unsigned long)&(oldregs->sp);
82
- asm volatile("xorl %%eax, %%eax\n\t"
83
- "movw %%ss, %%ax\n\t"
84
- :"=a"(newregs->ss));
85
-#endif
86
-}
87
-
8869 /*
8970 * This function is responsible for capturing register states if coming
9071 * via panic otherwise just fix up the ss and sp if coming via kernel
....@@ -95,7 +76,6 @@
9576 {
9677 if (oldregs) {
9778 memcpy(newregs, oldregs, sizeof(*newregs));
98
- crash_fixup_ss_esp(newregs, oldregs);
9979 } else {
10080 #ifdef CONFIG_X86_32
10181 asm volatile("movl %%ebx,%0" : "=m"(newregs->bx));
....@@ -132,7 +112,7 @@
132112 asm volatile("movl %%cs, %%eax;" :"=a"(newregs->cs));
133113 asm volatile("pushfq; popq %0" :"=m"(newregs->flags));
134114 #endif
135
- newregs->ip = (unsigned long)current_text_addr();
115
+ newregs->ip = _THIS_IP_;
136116 }
137117 }
138118
....@@ -170,12 +150,6 @@
170150 pud_t *pud;
171151 pmd_t *pmd;
172152 pte_t *pte;
173
- /* Details of backup region */
174
- unsigned long backup_src_start;
175
- unsigned long backup_src_sz;
176
-
177
- /* Physical address of backup segment */
178
- unsigned long backup_load_addr;
179153
180154 /* Core ELF header buffer */
181155 void *elf_headers;
....@@ -217,6 +191,14 @@
217191 extern void arch_kexec_pre_free_pages(void *vaddr, unsigned int pages);
218192 #define arch_kexec_pre_free_pages arch_kexec_pre_free_pages
219193
194
+#ifdef CONFIG_KEXEC_FILE
195
+struct purgatory_info;
196
+int arch_kexec_apply_relocations_add(struct purgatory_info *pi,
197
+ Elf_Shdr *section,
198
+ const Elf_Shdr *relsec,
199
+ const Elf_Shdr *symtab);
200
+#define arch_kexec_apply_relocations_add arch_kexec_apply_relocations_add
201
+#endif
220202 #endif
221203
222204 typedef void crash_vmclear_fn(void);