ia64/xen-unstable

view linux-2.6-xen-sparse/arch/i386/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
3 .text
4 #include <linux/elfnote.h>
5 #include <linux/threads.h>
6 #include <linux/linkage.h>
7 #include <asm/segment.h>
8 #include <asm/page.h>
9 #include <asm/cache.h>
10 #include <asm/thread_info.h>
11 #include <asm/asm-offsets.h>
12 #include <xen/interface/xen.h>
13 #include <xen/interface/elfnote.h>
15 #define _PAGE_PRESENT 0x1
17 /*
18 * References to members of the new_cpu_data structure.
19 */
21 #define X86 new_cpu_data+CPUINFO_x86
22 #define X86_VENDOR new_cpu_data+CPUINFO_x86_vendor
23 #define X86_MODEL new_cpu_data+CPUINFO_x86_model
24 #define X86_MASK new_cpu_data+CPUINFO_x86_mask
25 #define X86_HARD_MATH new_cpu_data+CPUINFO_hard_math
26 #define X86_CPUID new_cpu_data+CPUINFO_cpuid_level
27 #define X86_CAPABILITY new_cpu_data+CPUINFO_x86_capability
28 #define X86_VENDOR_ID new_cpu_data+CPUINFO_x86_vendor_id
30 #define VIRT_ENTRY_OFFSET 0x0
31 .org VIRT_ENTRY_OFFSET
32 ENTRY(startup_32)
33 movl %esi,xen_start_info
34 cld
36 /* Set up the stack pointer */
37 movl $(init_thread_union+THREAD_SIZE),%esp
39 /* get vendor info */
40 xorl %eax,%eax # call CPUID with 0 -> return vendor ID
41 XEN_CPUID
42 movl %eax,X86_CPUID # save CPUID level
43 movl %ebx,X86_VENDOR_ID # lo 4 chars
44 movl %edx,X86_VENDOR_ID+4 # next 4 chars
45 movl %ecx,X86_VENDOR_ID+8 # last 4 chars
47 movl $1,%eax # Use the CPUID instruction to get CPU type
48 XEN_CPUID
49 movb %al,%cl # save reg for future use
50 andb $0x0f,%ah # mask processor family
51 movb %ah,X86
52 andb $0xf0,%al # mask model
53 shrb $4,%al
54 movb %al,X86_MODEL
55 andb $0x0f,%cl # mask mask revision
56 movb %cl,X86_MASK
57 movl %edx,X86_CAPABILITY
59 movb $1,X86_HARD_MATH
61 xorl %eax,%eax # Clear FS/GS and LDT
62 movl %eax,%fs
63 movl %eax,%gs
64 cld # gcc2 wants the direction flag cleared at all times
66 pushl %eax # fake return address
67 jmp start_kernel
68 L6:
69 jmp L6 # main should never return here, but
70 # just in case, we know what happens.
72 #define HYPERCALL_PAGE_OFFSET 0x1000
73 .org HYPERCALL_PAGE_OFFSET
74 ENTRY(hypercall_page)
75 .skip 0x1000
77 /*
78 * Real beginning of normal "text" segment
79 */
80 ENTRY(stext)
81 ENTRY(_stext)
83 /*
84 * BSS section
85 */
86 .section ".bss.page_aligned","w"
87 ENTRY(empty_zero_page)
88 .fill 4096,1,0
90 /*
91 * This starts the data section.
92 */
93 .data
95 /*
96 * The Global Descriptor Table contains 28 quadwords, per-CPU.
97 */
98 .align L1_CACHE_BYTES
99 ENTRY(cpu_gdt_table)
100 .quad 0x0000000000000000 /* NULL descriptor */
101 .quad 0x0000000000000000 /* 0x0b reserved */
102 .quad 0x0000000000000000 /* 0x13 reserved */
103 .quad 0x0000000000000000 /* 0x1b reserved */
104 .quad 0x0000000000000000 /* 0x20 unused */
105 .quad 0x0000000000000000 /* 0x28 unused */
106 .quad 0x0000000000000000 /* 0x33 TLS entry 1 */
107 .quad 0x0000000000000000 /* 0x3b TLS entry 2 */
108 .quad 0x0000000000000000 /* 0x43 TLS entry 3 */
109 .quad 0x0000000000000000 /* 0x4b reserved */
110 .quad 0x0000000000000000 /* 0x53 reserved */
111 .quad 0x0000000000000000 /* 0x5b reserved */
113 .quad 0x00cf9a000000ffff /* 0x60 kernel 4GB code at 0x00000000 */
114 .quad 0x00cf92000000ffff /* 0x68 kernel 4GB data at 0x00000000 */
115 .quad 0x00cffa000000ffff /* 0x73 user 4GB code at 0x00000000 */
116 .quad 0x00cff2000000ffff /* 0x7b user 4GB data at 0x00000000 */
118 .quad 0x0000000000000000 /* 0x80 TSS descriptor */
119 .quad 0x0000000000000000 /* 0x88 LDT descriptor */
121 /*
122 * Segments used for calling PnP BIOS have byte granularity.
123 * They code segments and data segments have fixed 64k limits,
124 * the transfer segment sizes are set at run time.
125 */
126 .quad 0x0000000000000000 /* 0x90 32-bit code */
127 .quad 0x0000000000000000 /* 0x98 16-bit code */
128 .quad 0x0000000000000000 /* 0xa0 16-bit data */
129 .quad 0x0000000000000000 /* 0xa8 16-bit data */
130 .quad 0x0000000000000000 /* 0xb0 16-bit data */
132 /*
133 * The APM segments have byte granularity and their bases
134 * are set at run time. All have 64k limits.
135 */
136 .quad 0x0000000000000000 /* 0xb8 APM CS code */
137 .quad 0x0000000000000000 /* 0xc0 APM CS 16 code (16 bit) */
138 .quad 0x0000000000000000 /* 0xc8 APM DS data */
140 .quad 0x0000000000000000 /* 0xd0 - ESPFIX 16-bit SS */
141 .quad 0x0000000000000000 /* 0xd8 - unused */
142 .quad 0x0000000000000000 /* 0xe0 - unused */
143 .quad 0x0000000000000000 /* 0xe8 - unused */
144 .quad 0x0000000000000000 /* 0xf0 - unused */
145 .quad 0x0000000000000000 /* 0xf8 - GDT entry 31: double-fault TSS */
147 #ifdef CONFIG_XEN_COMPAT_030002
148 /*
149 * __xen_guest information
150 */
151 .macro utoa value
152 .if (\value) < 0 || (\value) >= 0x10
153 utoa (((\value)>>4)&0x0fffffff)
154 .endif
155 .if ((\value) & 0xf) < 10
156 .byte '0' + ((\value) & 0xf)
157 .else
158 .byte 'A' + ((\value) & 0xf) - 10
159 .endif
160 .endm
162 .section __xen_guest
163 .ascii "GUEST_OS=linux,GUEST_VER=2.6"
164 .ascii ",XEN_VER=xen-3.0"
165 .ascii ",VIRT_BASE=0x"
166 utoa __PAGE_OFFSET
167 .ascii ",ELF_PADDR_OFFSET=0x"
168 utoa __PAGE_OFFSET
169 .ascii ",VIRT_ENTRY=0x"
170 utoa (__PAGE_OFFSET + __PHYSICAL_START + VIRT_ENTRY_OFFSET)
171 .ascii ",HYPERCALL_PAGE=0x"
172 utoa ((__PHYSICAL_START+HYPERCALL_PAGE_OFFSET)>>PAGE_SHIFT)
173 .ascii ",FEATURES=writable_page_tables"
174 .ascii "|writable_descriptor_tables"
175 .ascii "|auto_translated_physmap"
176 .ascii "|pae_pgdir_above_4gb"
177 .ascii "|supervisor_mode_kernel"
178 #ifdef CONFIG_X86_PAE
179 .ascii ",PAE=yes[extended-cr3]"
180 #else
181 .ascii ",PAE=no"
182 #endif
183 .ascii ",LOADER=generic"
184 .byte 0
185 #endif /* CONFIG_XEN_COMPAT_030002 */
188 ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz, "linux")
189 ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz, "2.6")
190 ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz, "xen-3.0")
191 ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, .long, __PAGE_OFFSET)
192 #ifdef CONFIG_XEN_COMPAT_030002
193 ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .long, __PAGE_OFFSET)
194 #else
195 ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .long, 0)
196 #endif /* !CONFIG_XEN_COMPAT_030002 */
197 ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .long, startup_32)
198 ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .long, hypercall_page)
199 ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW, .long, HYPERVISOR_VIRT_START)
200 ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .asciz, "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|pae_pgdir_above_4gb|supervisor_mode_kernel")
201 #ifdef CONFIG_X86_PAE
202 ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz, "yes")
203 ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, .quad, _PAGE_PRESENT,_PAGE_PRESENT)
204 #else
205 ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz, "no")
206 ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, .long, _PAGE_PRESENT,_PAGE_PRESENT)
207 #endif
208 ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz, "generic")
209 ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long, 1)