1 #ifndef _X86_64_KEXEC_H
2 #define _X86_64_KEXEC_H
4 #define PA_CONTROL_PAGE 0
5 #define VA_CONTROL_PAGE 1
20 #define PA_TABLE_PAGE 16
25 #include <linux/string.h>
28 #include <asm/ptrace.h>
31 * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return.
32 * I.e. Maximum page that is mapped directly into kernel memory,
33 * and kmap is not required.
35 * So far x86_64 is limited to 40 physical address bits.
38 /* Maximum physical address we can use pages from */
39 #define KEXEC_SOURCE_MEMORY_LIMIT (0xFFFFFFFFFFUL)
40 /* Maximum address we can reach in physical address mode */
41 #define KEXEC_DESTINATION_MEMORY_LIMIT (0xFFFFFFFFFFUL)
42 /* Maximum address we can use for the control pages */
43 #define KEXEC_CONTROL_MEMORY_LIMIT (0xFFFFFFFFFFUL)
45 /* Allocate one page for the pdp and the second for the code */
46 #define KEXEC_CONTROL_CODE_SIZE (4096UL + 4096UL)
48 /* The native architecture */
49 #define KEXEC_ARCH KEXEC_ARCH_X86_64
52 * Saving the registers of the cpu on which panic occured in
53 * crash_kexec to save a valid sp. The registers of other cpus
54 * will be saved in machine_crash_shutdown while shooting down them.
57 static inline void crash_setup_regs(struct pt_regs
*newregs
,
58 struct pt_regs
*oldregs
)
61 memcpy(newregs
, oldregs
, sizeof(*newregs
));
63 __asm__
__volatile__("movq %%rbx,%0" : "=m"(newregs
->bx
));
64 __asm__
__volatile__("movq %%rcx,%0" : "=m"(newregs
->cx
));
65 __asm__
__volatile__("movq %%rdx,%0" : "=m"(newregs
->dx
));
66 __asm__
__volatile__("movq %%rsi,%0" : "=m"(newregs
->si
));
67 __asm__
__volatile__("movq %%rdi,%0" : "=m"(newregs
->di
));
68 __asm__
__volatile__("movq %%rbp,%0" : "=m"(newregs
->bp
));
69 __asm__
__volatile__("movq %%rax,%0" : "=m"(newregs
->ax
));
70 __asm__
__volatile__("movq %%rsp,%0" : "=m"(newregs
->sp
));
71 __asm__
__volatile__("movq %%r8,%0" : "=m"(newregs
->r8
));
72 __asm__
__volatile__("movq %%r9,%0" : "=m"(newregs
->r9
));
73 __asm__
__volatile__("movq %%r10,%0" : "=m"(newregs
->r10
));
74 __asm__
__volatile__("movq %%r11,%0" : "=m"(newregs
->r11
));
75 __asm__
__volatile__("movq %%r12,%0" : "=m"(newregs
->r12
));
76 __asm__
__volatile__("movq %%r13,%0" : "=m"(newregs
->r13
));
77 __asm__
__volatile__("movq %%r14,%0" : "=m"(newregs
->r14
));
78 __asm__
__volatile__("movq %%r15,%0" : "=m"(newregs
->r15
));
79 __asm__
__volatile__("movl %%ss, %%eax;" :"=a"(newregs
->ss
));
80 __asm__
__volatile__("movl %%cs, %%eax;" :"=a"(newregs
->cs
));
81 __asm__
__volatile__("pushfq; popq %0" :"=m"(newregs
->flags
));
83 newregs
->ip
= (unsigned long)current_text_addr();
88 relocate_kernel(unsigned long indirection_page
,
89 unsigned long page_list
,
90 unsigned long start_address
) ATTRIB_NORET
;
92 #endif /* __ASSEMBLY__ */
94 #endif /* _X86_64_KEXEC_H */