4 #define PA_CONTROL_PAGE 0
5 #define VA_CONTROL_PAGE 1
24 #include <asm/ptrace.h>
25 #include <asm/string.h>
28 * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return.
29 * I.e. Maximum page that is mapped directly into kernel memory,
30 * and kmap is not required.
33 /* Maximum physical address we can use pages from */
34 #define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
35 /* Maximum address we can reach in physical address mode */
36 #define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
37 /* Maximum address we can use for the control code buffer */
38 #define KEXEC_CONTROL_MEMORY_LIMIT TASK_SIZE
40 #define KEXEC_CONTROL_CODE_SIZE 4096
42 /* The native architecture */
43 #define KEXEC_ARCH KEXEC_ARCH_386
45 #define MAX_NOTE_BYTES 1024
47 /* CPU does not save ss and esp on stack if execution is already
48 * running in kernel mode at the time of NMI occurrence. This code
51 static inline void crash_fixup_ss_esp(struct pt_regs *newregs,
52 struct pt_regs *oldregs)
54 memcpy(newregs, oldregs, sizeof(*newregs));
55 newregs->esp = (unsigned long)&(oldregs->esp);
57 "xorl %%eax, %%eax\n\t"
63 * This function is responsible for capturing register states if coming
64 * via panic otherwise just fix up the ss and esp if coming via kernel
67 static inline void crash_setup_regs(struct pt_regs *newregs,
68 struct pt_regs *oldregs)
71 crash_fixup_ss_esp(newregs, oldregs);
73 __asm__ __volatile__("movl %%ebx,%0" : "=m"(newregs->ebx));
74 __asm__ __volatile__("movl %%ecx,%0" : "=m"(newregs->ecx));
75 __asm__ __volatile__("movl %%edx,%0" : "=m"(newregs->edx));
76 __asm__ __volatile__("movl %%esi,%0" : "=m"(newregs->esi));
77 __asm__ __volatile__("movl %%edi,%0" : "=m"(newregs->edi));
78 __asm__ __volatile__("movl %%ebp,%0" : "=m"(newregs->ebp));
79 __asm__ __volatile__("movl %%eax,%0" : "=m"(newregs->eax));
80 __asm__ __volatile__("movl %%esp,%0" : "=m"(newregs->esp));
81 __asm__ __volatile__("movw %%ss, %%ax;" :"=a"(newregs->xss));
82 __asm__ __volatile__("movw %%cs, %%ax;" :"=a"(newregs->xcs));
83 __asm__ __volatile__("movw %%ds, %%ax;" :"=a"(newregs->xds));
84 __asm__ __volatile__("movw %%es, %%ax;" :"=a"(newregs->xes));
85 __asm__ __volatile__("pushfl; popl %0" :"=m"(newregs->eflags));
87 newregs->eip = (unsigned long)current_text_addr();
90 asmlinkage NORET_TYPE void
91 relocate_kernel(unsigned long indirection_page,
92 unsigned long control_page,
93 unsigned long start_address,
94 unsigned int has_pae) ATTRIB_NORET;
96 #endif /* __ASSEMBLY__ */
98 #endif /* _I386_KEXEC_H */