ia64/xen-unstable

view linux-2.6-xen-sparse/arch/i386/kernel/head-xen.S @ 8976:4f4625f80528

Rename XENFEAT_ring0_kernel to slightly more generic XENFEAT_supervisor_mode_kernel.
Add comments in public header version.h to explain what all the different
feature flags mean. Add a new flag XENFEAT_pae_pgdir_above_4gb to inform the guest
that its PAE page directories do not need to conform to the usual hardware
restriction.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Feb 23 11:59:27 2006 +0100 (2006-02-23)
parents 697fac283c9e
children 4f838d2ac31a
line source
3 .text
4 #include <linux/config.h>
5 #include <linux/threads.h>
6 #include <linux/linkage.h>
7 #include <asm/segment.h>
8 #include <asm/page.h>
9 #include <asm/thread_info.h>
10 #include <asm/asm-offsets.h>
11 #include <xen/interface/arch-x86_32.h>
13 /*
14 * References to members of the new_cpu_data structure.
15 */
17 #define X86 new_cpu_data+CPUINFO_x86
18 #define X86_VENDOR new_cpu_data+CPUINFO_x86_vendor
19 #define X86_MODEL new_cpu_data+CPUINFO_x86_model
20 #define X86_MASK new_cpu_data+CPUINFO_x86_mask
21 #define X86_HARD_MATH new_cpu_data+CPUINFO_hard_math
22 #define X86_CPUID new_cpu_data+CPUINFO_cpuid_level
23 #define X86_CAPABILITY new_cpu_data+CPUINFO_x86_capability
24 #define X86_VENDOR_ID new_cpu_data+CPUINFO_x86_vendor_id
26 ENTRY(startup_32)
27 movl %esi,xen_start_info
29 #if 0
30 ENTRY(startup_32_smp)
31 #endif /* CONFIG_SMP */
33 cld
35 /* Set up the stack pointer */
36 movl $(init_thread_union+THREAD_SIZE),%esp
38 checkCPUtype:
40 /* get vendor info */
41 xorl %eax,%eax # call CPUID with 0 -> return vendor ID
42 cpuid
43 movl %eax,X86_CPUID # save CPUID level
44 movl %ebx,X86_VENDOR_ID # lo 4 chars
45 movl %edx,X86_VENDOR_ID+4 # next 4 chars
46 movl %ecx,X86_VENDOR_ID+8 # last 4 chars
48 movl $1,%eax # Use the CPUID instruction to get CPU type
49 cpuid
50 movb %al,%cl # save reg for future use
51 andb $0x0f,%ah # mask processor family
52 movb %ah,X86
53 andb $0xf0,%al # mask model
54 shrb $4,%al
55 movb %al,X86_MODEL
56 andb $0x0f,%cl # mask mask revision
57 movb %cl,X86_MASK
58 movl %edx,X86_CAPABILITY
60 xorl %eax,%eax # Clear FS/GS and LDT
61 movl %eax,%fs
62 movl %eax,%gs
63 cld # gcc2 wants the direction flag cleared at all times
65 #if 0
66 movb ready, %cl
67 movb $1, ready
68 cmpb $0,%cl
69 je 1f # the first CPU calls start_kernel
70 # all other CPUs call initialize_secondary
71 call initialize_secondary
72 jmp L6
73 1:
74 #endif /* CONFIG_SMP */
75 call start_kernel
76 L6:
77 jmp L6 # main should never return here, but
78 # just in case, we know what happens.
80 ALIGN
82 # boot GDT descriptor (later on used by CPU#0):
83 .word 0 # 32 bit align gdt_desc.address
84 .globl cpu_gdt_descr
85 cpu_gdt_descr:
86 .word GDT_SIZE
87 .long cpu_gdt_table
89 .fill NR_CPUS-1,8,0 # space for the other GDT descriptors
91 .org 0x1000
92 ENTRY(empty_zero_page)
94 .org 0x2000
95 ENTRY(cpu_gdt_table)
96 .quad 0x0000000000000000 /* NULL descriptor */
97 .quad 0x0000000000000000 /* 0x0b reserved */
98 .quad 0x0000000000000000 /* 0x13 reserved */
99 .quad 0x0000000000000000 /* 0x1b reserved */
100 .quad 0x0000000000000000 /* 0x20 unused */
101 .quad 0x0000000000000000 /* 0x28 unused */
102 .quad 0x0000000000000000 /* 0x33 TLS entry 1 */
103 .quad 0x0000000000000000 /* 0x3b TLS entry 2 */
104 .quad 0x0000000000000000 /* 0x43 TLS entry 3 */
105 .quad 0x0000000000000000 /* 0x4b reserved */
106 .quad 0x0000000000000000 /* 0x53 reserved */
107 .quad 0x0000000000000000 /* 0x5b reserved */
109 .quad 0x00cf9b000000ffff /* 0x60 kernel 4GB code at 0x00000000 */
110 .quad 0x00cf93000000ffff /* 0x68 kernel 4GB data at 0x00000000 */
111 .quad 0x00cffb000000ffff /* 0x73 user 4GB code at 0x00000000 */
112 .quad 0x00cff3000000ffff /* 0x7b user 4GB data at 0x00000000 */
114 .quad 0x0000000000000000 /* 0x80 TSS descriptor */
115 .quad 0x0000000000000000 /* 0x88 LDT descriptor */
117 /*
118 * Segments used for calling PnP BIOS have byte granularity.
119 * They code segments and data segments have fixed 64k limits,
120 * the transfer segment sizes are set at run time.
121 */
122 .quad 0x0000000000000000 /* 0x90 32-bit code */
123 .quad 0x0000000000000000 /* 0x98 16-bit code */
124 .quad 0x0000000000000000 /* 0xa0 16-bit data */
125 .quad 0x0000000000000000 /* 0xa8 16-bit data */
126 .quad 0x0000000000000000 /* 0xb0 16-bit data */
128 /*
129 * The APM segments have byte granularity and their bases
130 * are set at run time. All have 64k limits.
131 */
132 .quad 0x0000000000000000 /* 0xb8 APM CS code */
133 .quad 0x0000000000000000 /* 0xc0 APM CS 16 code (16 bit) */
134 .quad 0x0000000000000000 /* 0xc8 APM DS data */
136 .quad 0x0000000000000000 /* 0xd0 - ESPFIX 16-bit SS */
137 .quad 0x0000000000000000 /* 0xd8 - unused */
138 .quad 0x0000000000000000 /* 0xe0 - unused */
139 .quad 0x0000000000000000 /* 0xe8 - unused */
140 .quad 0x0000000000000000 /* 0xf0 - unused */
141 .quad 0x0000000000000000 /* 0xf8 - GDT entry 31: double-fault TSS */
143 /* Be sure this is zeroed to avoid false validations in Xen */
144 .fill PAGE_SIZE_asm / 8 - GDT_ENTRIES,8,0
146 .org 0x3000
147 ENTRY(default_ldt)
149 #define HYPERCALL_PAGE_OFFSET 0x4000
150 .org HYPERCALL_PAGE_OFFSET
151 ENTRY(hypercall_page)
152 .skip 0x1000
154 /*
155 * Real beginning of normal "text" segment
156 */
157 ENTRY(stext)
158 ENTRY(_stext)
161 /*
162 * __xen_guest information
163 */
164 .macro utoa value
165 .if (\value) < 0 || (\value) >= 0x10
166 utoa (((\value)>>4)&0x0fffffff)
167 .endif
168 .if ((\value) & 0xf) < 10
169 .byte '0' + ((\value) & 0xf)
170 .else
171 .byte 'A' + ((\value) & 0xf) - 10
172 .endif
173 .endm
175 .section __xen_guest
176 .ascii "GUEST_OS=linux,GUEST_VER=2.6"
177 .ascii ",XEN_VER=xen-3.0"
178 .ascii ",VIRT_BASE=0x"
179 utoa __PAGE_OFFSET
180 .ascii ",HYPERCALL_PAGE=0x"
181 utoa ((__PHYSICAL_START+HYPERCALL_PAGE_OFFSET)>>PAGE_SHIFT)
182 .ascii ",FEATURES=writable_page_tables"
183 .ascii "|writable_descriptor_tables"
184 .ascii "|auto_translated_physmap"
185 .ascii "|supervisor_mode_kernel"
186 #ifdef CONFIG_X86_PAE
187 .ascii ",PAE=yes"
188 #else
189 .ascii ",PAE=no"
190 #endif
191 .ascii ",LOADER=generic"
192 .byte 0