ia64/xen-unstable

view linux-2.6-xen-sparse/include/asm-i386/kexec.h @ 13341:3040ba0f2d3d

When booting via xm, only run the bootloader if it's in non-interactive mode:
otherwise we lose the user's named kernel and try to bootload the temporary
file pygrub returned.

Signed-off-by: John Levon <john.levon@sun.com>
author Tim Deegan <Tim.Deegan@xensource.com>
date Tue Jan 09 13:24:45 2007 +0000 (2007-01-09)
parents 562eee7568a8
children bbda47597917
line source
1 #ifndef _I386_KEXEC_H
2 #define _I386_KEXEC_H
4 #define PA_CONTROL_PAGE 0
5 #define VA_CONTROL_PAGE 1
6 #define PA_PGD 2
7 #define VA_PGD 3
8 #define PA_PTE_0 4
9 #define VA_PTE_0 5
10 #define PA_PTE_1 6
11 #define VA_PTE_1 7
12 #ifdef CONFIG_X86_PAE
13 #define PA_PMD_0 8
14 #define VA_PMD_0 9
15 #define PA_PMD_1 10
16 #define VA_PMD_1 11
17 #define PAGES_NR 12
18 #else
19 #define PAGES_NR 8
20 #endif
22 #ifndef __ASSEMBLY__
24 #include <asm/fixmap.h>
25 #include <asm/ptrace.h>
26 #include <asm/string.h>
28 /*
29 * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return.
30 * I.e. Maximum page that is mapped directly into kernel memory,
31 * and kmap is not required.
32 *
33 * Someone correct me if FIXADDR_START - PAGEOFFSET is not the correct
34 * calculation for the amount of memory directly mappable into the
35 * kernel memory space.
36 */
38 /* Maximum physical address we can use pages from */
39 #define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
40 /* Maximum address we can reach in physical address mode */
41 #define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
42 /* Maximum address we can use for the control code buffer */
43 #define KEXEC_CONTROL_MEMORY_LIMIT TASK_SIZE
45 #define KEXEC_CONTROL_CODE_SIZE 4096
47 /* The native architecture */
48 #define KEXEC_ARCH KEXEC_ARCH_386
50 #define MAX_NOTE_BYTES 1024
52 /* CPU does not save ss and esp on stack if execution is already
53 * running in kernel mode at the time of NMI occurrence. This code
54 * fixes it.
55 */
56 static inline void crash_fixup_ss_esp(struct pt_regs *newregs,
57 struct pt_regs *oldregs)
58 {
59 memcpy(newregs, oldregs, sizeof(*newregs));
60 newregs->esp = (unsigned long)&(oldregs->esp);
61 __asm__ __volatile__(
62 "xorl %%eax, %%eax\n\t"
63 "movw %%ss, %%ax\n\t"
64 :"=a"(newregs->xss));
65 }
67 /*
68 * This function is responsible for capturing register states if coming
69 * via panic otherwise just fix up the ss and esp if coming via kernel
70 * mode exception.
71 */
72 static inline void crash_setup_regs(struct pt_regs *newregs,
73 struct pt_regs *oldregs)
74 {
75 if (oldregs)
76 crash_fixup_ss_esp(newregs, oldregs);
77 else {
78 __asm__ __volatile__("movl %%ebx,%0" : "=m"(newregs->ebx));
79 __asm__ __volatile__("movl %%ecx,%0" : "=m"(newregs->ecx));
80 __asm__ __volatile__("movl %%edx,%0" : "=m"(newregs->edx));
81 __asm__ __volatile__("movl %%esi,%0" : "=m"(newregs->esi));
82 __asm__ __volatile__("movl %%edi,%0" : "=m"(newregs->edi));
83 __asm__ __volatile__("movl %%ebp,%0" : "=m"(newregs->ebp));
84 __asm__ __volatile__("movl %%eax,%0" : "=m"(newregs->eax));
85 __asm__ __volatile__("movl %%esp,%0" : "=m"(newregs->esp));
86 __asm__ __volatile__("movw %%ss, %%ax;" :"=a"(newregs->xss));
87 __asm__ __volatile__("movw %%cs, %%ax;" :"=a"(newregs->xcs));
88 __asm__ __volatile__("movw %%ds, %%ax;" :"=a"(newregs->xds));
89 __asm__ __volatile__("movw %%es, %%ax;" :"=a"(newregs->xes));
90 __asm__ __volatile__("pushfl; popl %0" :"=m"(newregs->eflags));
92 newregs->eip = (unsigned long)current_text_addr();
93 }
94 }
95 asmlinkage NORET_TYPE void
96 relocate_kernel(unsigned long indirection_page,
97 unsigned long control_page,
98 unsigned long start_address,
99 unsigned int has_pae) ATTRIB_NORET;
102 /* Under Xen we need to work with machine addresses. These macros give the
103 * machine address of a certain page to the generic kexec code instead of
104 * the pseudo physical address which would be given by the default macros.
105 */
107 #ifdef CONFIG_XEN
108 #define KEXEC_ARCH_HAS_PAGE_MACROS
109 #define kexec_page_to_pfn(page) pfn_to_mfn(page_to_pfn(page))
110 #define kexec_pfn_to_page(pfn) pfn_to_page(mfn_to_pfn(pfn))
111 #define kexec_virt_to_phys(addr) virt_to_machine(addr)
112 #define kexec_phys_to_virt(addr) phys_to_virt(machine_to_phys(addr))
113 #endif
115 #endif /* __ASSEMBLY__ */
117 #endif /* _I386_KEXEC_H */