ia64/xen-unstable

view linux-2.6-xen-sparse/arch/x86_64/kernel/head-xen.S @ 14172:9149ef0e61ce

Add suspend_cancel flag to linux elf notes.

Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>
author kfraser@localhost.localdomain
date Wed Feb 28 09:41:02 2007 +0000 (2007-02-28)
parents 0a348e9ecedb
children 145d3c81e654
line source
1 /*
2 * linux/arch/x86_64/kernel/head.S -- start in 32bit and switch to 64bit
3 *
4 * Copyright (C) 2000 Andrea Arcangeli <andrea@suse.de> SuSE
5 * Copyright (C) 2000 Pavel Machek <pavel@suse.cz>
6 * Copyright (C) 2000 Karsten Keil <kkeil@suse.de>
7 * Copyright (C) 2001,2002 Andi Kleen <ak@suse.de>
8 *
9 * $Id: head.S,v 1.49 2002/03/19 17:39:25 ak Exp $
10 *
11 * Jun Nakajima <jun.nakajima@intel.com>
12 * Modified for Xen
13 */
16 #include <linux/linkage.h>
17 #include <linux/threads.h>
18 #include <linux/init.h>
19 #include <linux/elfnote.h>
20 #include <asm/desc.h>
21 #include <asm/segment.h>
22 #include <asm/page.h>
23 #include <asm/msr.h>
24 #include <asm/cache.h>
26 #include <xen/interface/elfnote.h>
28 #define _PAGE_PRESENT 0x1
30 .section .bootstrap.text, "ax", @progbits
31 .code64
32 #define VIRT_ENTRY_OFFSET 0x0
33 .org VIRT_ENTRY_OFFSET
34 .globl startup_64
35 startup_64:
36 ENTRY(_start)
37 movq $(init_thread_union+THREAD_SIZE-8),%rsp
38 /* zero EFLAGS after setting rsp */
39 pushq $0
40 popfq
42 /* rsi is pointer to startup info structure.
43 pass it to C */
44 movq %rsi,%rdi
45 jmp x86_64_start_kernel
47 ENTRY(stext)
48 ENTRY(_stext)
50 $page = 0
51 #define NEXT_PAGE(name) \
52 $page = $page + 1; \
53 .org $page * 0x1000; \
54 phys_##name = $page * 0x1000 + __PHYSICAL_START; \
55 ENTRY(name)
57 NEXT_PAGE(init_level4_pgt)
58 /* This gets initialized in x86_64_start_kernel */
59 .fill 512,8,0
61 /*
62 * We update two pgd entries to make kernel and user pgd consistent
63 * at pgd_populate(). It can be used for kernel modules. So we place
64 * this page here for those cases to avoid memory corruption.
65 * We also use this page to establish the initiali mapping for
66 * vsyscall area.
67 */
68 NEXT_PAGE(init_level4_user_pgt)
69 .fill 512,8,0
71 NEXT_PAGE(level3_kernel_pgt)
72 .fill 512,8,0
74 /*
75 * This is used for vsyscall area mapping as we have a different
76 * level4 page table for user.
77 */
78 NEXT_PAGE(level3_user_pgt)
79 .fill 512,8,0
81 NEXT_PAGE(level2_kernel_pgt)
82 .fill 512,8,0
84 NEXT_PAGE(hypercall_page)
85 .fill 512,8,0
87 #undef NEXT_PAGE
89 .data
91 .align 16
92 .globl cpu_gdt_descr
93 cpu_gdt_descr:
94 .word gdt_end-cpu_gdt_table-1
95 gdt:
96 .quad cpu_gdt_table
97 #ifdef CONFIG_SMP
98 .rept NR_CPUS-1
99 .word 0
100 .quad 0
101 .endr
102 #endif
104 /* We need valid kernel segments for data and code in long mode too
105 * IRET will check the segment types kkeil 2000/10/28
106 * Also sysret mandates a special GDT layout
107 */
109 .section .data.page_aligned, "aw"
110 .align PAGE_SIZE
112 /* The TLS descriptors are currently at a different place compared to i386.
113 Hopefully nobody expects them at a fixed place (Wine?) */
115 ENTRY(cpu_gdt_table)
116 .quad 0x0000000000000000 /* NULL descriptor */
117 .quad 0x0 /* unused */
118 .quad 0x00af9a000000ffff /* __KERNEL_CS */
119 .quad 0x00cf92000000ffff /* __KERNEL_DS */
120 .quad 0x00cffa000000ffff /* __USER32_CS */
121 .quad 0x00cff2000000ffff /* __USER_DS, __USER32_DS */
122 .quad 0x00affa000000ffff /* __USER_CS */
123 .quad 0x00cf9a000000ffff /* __KERNEL32_CS */
124 .quad 0,0 /* TSS */
125 .quad 0,0 /* LDT */
126 .quad 0,0,0 /* three TLS descriptors */
127 .quad 0 /* unused */
128 gdt_end:
129 /* asm/segment.h:GDT_ENTRIES must match this */
130 /* This should be a multiple of the cache line size */
131 /* GDTs of other CPUs are now dynamically allocated */
133 /* zero the remaining page */
134 .fill PAGE_SIZE / 8 - GDT_ENTRIES,8,0
136 .section .bss.page_aligned, "aw", @nobits
137 .align PAGE_SIZE
138 ENTRY(empty_zero_page)
139 .skip PAGE_SIZE
141 #ifdef CONFIG_XEN_COMPAT_030002
142 /*
143 * __xen_guest information
144 */
145 .macro utoh value
146 .if (\value) < 0 || (\value) >= 0x10
147 utoh (((\value)>>4)&0x0fffffffffffffff)
148 .endif
149 .if ((\value) & 0xf) < 10
150 .byte '0' + ((\value) & 0xf)
151 .else
152 .byte 'A' + ((\value) & 0xf) - 10
153 .endif
154 .endm
156 .section __xen_guest
157 .ascii "GUEST_OS=linux,GUEST_VER=2.6"
158 .ascii ",XEN_VER=xen-3.0"
159 .ascii ",VIRT_BASE=0x"
160 utoh __START_KERNEL_map
161 .ascii ",ELF_PADDR_OFFSET=0x"
162 utoh __START_KERNEL_map
163 .ascii ",VIRT_ENTRY=0x"
164 utoh (__START_KERNEL_map + __PHYSICAL_START + VIRT_ENTRY_OFFSET)
165 .ascii ",HYPERCALL_PAGE=0x"
166 utoh (phys_hypercall_page >> PAGE_SHIFT)
167 .ascii ",FEATURES=writable_page_tables"
168 .ascii "|writable_descriptor_tables"
169 .ascii "|auto_translated_physmap"
170 .ascii "|supervisor_mode_kernel"
171 .ascii ",LOADER=generic"
172 .byte 0
173 #endif /* CONFIG_XEN_COMPAT_030002 */
175 ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz, "linux")
176 ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz, "2.6")
177 ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz, "xen-3.0")
178 ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, .quad, __START_KERNEL_map)
179 #ifdef CONFIG_XEN_COMPAT_030002
180 ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .quad, __START_KERNEL_map)
181 #else
182 ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .quad, 0)
183 #endif /* !CONFIG_XEN_COMPAT_030002 */
184 ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .quad, startup_64)
185 ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .quad, hypercall_page)
186 ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, .quad, _PAGE_PRESENT,_PAGE_PRESENT)
187 ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .asciz, "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|pae_pgdir_above_4gb|supervisor_mode_kernel")
188 ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz, "generic")
189 ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long, 1)