| .. | .. |
|---|
| 21 | 21 | #ifndef __ASSEMBLY__ |
|---|
| 22 | 22 | |
|---|
| 23 | 23 | #include <linux/string.h> |
|---|
| 24 | +#include <linux/kernel.h> |
|---|
| 24 | 25 | |
|---|
| 25 | 26 | #include <asm/page.h> |
|---|
| 26 | 27 | #include <asm/ptrace.h> |
|---|
| .. | .. |
|---|
| 65 | 66 | # define KEXEC_ARCH KEXEC_ARCH_X86_64 |
|---|
| 66 | 67 | #endif |
|---|
| 67 | 68 | |
|---|
| 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 | | - |
|---|
| 88 | 69 | /* |
|---|
| 89 | 70 | * This function is responsible for capturing register states if coming |
|---|
| 90 | 71 | * via panic otherwise just fix up the ss and sp if coming via kernel |
|---|
| .. | .. |
|---|
| 95 | 76 | { |
|---|
| 96 | 77 | if (oldregs) { |
|---|
| 97 | 78 | memcpy(newregs, oldregs, sizeof(*newregs)); |
|---|
| 98 | | - crash_fixup_ss_esp(newregs, oldregs); |
|---|
| 99 | 79 | } else { |
|---|
| 100 | 80 | #ifdef CONFIG_X86_32 |
|---|
| 101 | 81 | asm volatile("movl %%ebx,%0" : "=m"(newregs->bx)); |
|---|
| .. | .. |
|---|
| 132 | 112 | asm volatile("movl %%cs, %%eax;" :"=a"(newregs->cs)); |
|---|
| 133 | 113 | asm volatile("pushfq; popq %0" :"=m"(newregs->flags)); |
|---|
| 134 | 114 | #endif |
|---|
| 135 | | - newregs->ip = (unsigned long)current_text_addr(); |
|---|
| 115 | + newregs->ip = _THIS_IP_; |
|---|
| 136 | 116 | } |
|---|
| 137 | 117 | } |
|---|
| 138 | 118 | |
|---|
| .. | .. |
|---|
| 170 | 150 | pud_t *pud; |
|---|
| 171 | 151 | pmd_t *pmd; |
|---|
| 172 | 152 | 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; |
|---|
| 179 | 153 | |
|---|
| 180 | 154 | /* Core ELF header buffer */ |
|---|
| 181 | 155 | void *elf_headers; |
|---|
| .. | .. |
|---|
| 217 | 191 | extern void arch_kexec_pre_free_pages(void *vaddr, unsigned int pages); |
|---|
| 218 | 192 | #define arch_kexec_pre_free_pages arch_kexec_pre_free_pages |
|---|
| 219 | 193 | |
|---|
| 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 |
|---|
| 220 | 202 | #endif |
|---|
| 221 | 203 | |
|---|
| 222 | 204 | typedef void crash_vmclear_fn(void); |
|---|