ia64/xen-unstable

view linux-2.6-xen-sparse/arch/i386/kernel/head-xen.S @ 8933:bea58b594c4a

Simplify utoa macro, make it identical with x86_64 version.

Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Mon Feb 20 16:49:35 2006 +0000 (2006-02-20)
parents c93c6b392ce5
children f572c467d9c3
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 lss stack_start,%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 ENTRY(lgdt_finish)
81 movl $(__KERNEL_DS),%eax # reload all the segment registers
82 movw %ax,%ss # after changing gdt.
84 movl $(__USER_DS),%eax # DS/ES contains default USER segment
85 movw %ax,%ds
86 movw %ax,%es
88 popl %eax # reload CS by intersegment return
89 pushl $(__KERNEL_CS)
90 pushl %eax
91 lret
93 ENTRY(stack_start)
94 .long init_thread_union+THREAD_SIZE
95 .long __BOOT_DS
97 ready: .byte 0
99 .globl idt_descr
100 .globl cpu_gdt_descr
102 ALIGN
103 .word 0 # 32-bit align idt_desc.address
104 idt_descr:
105 .word IDT_ENTRIES*8-1 # idt contains 256 entries
106 .long idt_table
108 # boot GDT descriptor (later on used by CPU#0):
109 .word 0 # 32 bit align gdt_desc.address
110 cpu_gdt_descr:
111 .word GDT_SIZE
112 .long cpu_gdt_table
114 .fill NR_CPUS-1,8,0 # space for the other GDT descriptors
116 .org 0x1000
117 ENTRY(empty_zero_page)
119 .org 0x2000
120 ENTRY(cpu_gdt_table)
121 .quad 0x0000000000000000 /* NULL descriptor */
122 .quad 0x0000000000000000 /* 0x0b reserved */
123 .quad 0x0000000000000000 /* 0x13 reserved */
124 .quad 0x0000000000000000 /* 0x1b reserved */
125 .quad 0x0000000000000000 /* 0x20 unused */
126 .quad 0x0000000000000000 /* 0x28 unused */
127 .quad 0x0000000000000000 /* 0x33 TLS entry 1 */
128 .quad 0x0000000000000000 /* 0x3b TLS entry 2 */
129 .quad 0x0000000000000000 /* 0x43 TLS entry 3 */
130 .quad 0x0000000000000000 /* 0x4b reserved */
131 .quad 0x0000000000000000 /* 0x53 reserved */
132 .quad 0x0000000000000000 /* 0x5b reserved */
134 #ifdef CONFIG_X86_PAE
135 .quad 0x00cfbb00000067ff /* 0x60 kernel 4GB code at 0x00000000 */
136 .quad 0x00cfb300000067ff /* 0x68 kernel 4GB data at 0x00000000 */
137 .quad 0x00cffb00000067ff /* 0x73 user 4GB code at 0x00000000 */
138 .quad 0x00cff300000067ff /* 0x7b user 4GB data at 0x00000000 */
139 #else
140 .quad 0x00cfbb000000c3ff /* 0x60 kernel 4GB code at 0x00000000 */
141 .quad 0x00cfb3000000c3ff /* 0x68 kernel 4GB data at 0x00000000 */
142 .quad 0x00cffb000000c3ff /* 0x73 user 4GB code at 0x00000000 */
143 .quad 0x00cff3000000c3ff /* 0x7b user 4GB data at 0x00000000 */
144 #endif
146 .quad 0x0000000000000000 /* 0x80 TSS descriptor */
147 .quad 0x0000000000000000 /* 0x88 LDT descriptor */
149 /*
150 * Segments used for calling PnP BIOS have byte granularity.
151 * They code segments and data segments have fixed 64k limits,
152 * the transfer segment sizes are set at run time.
153 */
154 .quad 0x0000000000000000 /* 0x90 32-bit code */
155 .quad 0x0000000000000000 /* 0x98 16-bit code */
156 .quad 0x0000000000000000 /* 0xa0 16-bit data */
157 .quad 0x0000000000000000 /* 0xa8 16-bit data */
158 .quad 0x0000000000000000 /* 0xb0 16-bit data */
160 /*
161 * The APM segments have byte granularity and their bases
162 * are set at run time. All have 64k limits.
163 */
164 .quad 0x0000000000000000 /* 0xb8 APM CS code */
165 .quad 0x0000000000000000 /* 0xc0 APM CS 16 code (16 bit) */
166 .quad 0x0000000000000000 /* 0xc8 APM DS data */
168 .quad 0x0000000000000000 /* 0xd0 - ESPFIX 16-bit SS */
169 .quad 0x0000000000000000 /* 0xd8 - unused */
170 .quad 0x0000000000000000 /* 0xe0 - unused */
171 .quad 0x0000000000000000 /* 0xe8 - unused */
172 .quad 0x0000000000000000 /* 0xf0 - unused */
173 .quad 0x0000000000000000 /* 0xf8 - GDT entry 31: double-fault TSS */
175 /* Be sure this is zeroed to avoid false validations in Xen */
176 .fill PAGE_SIZE_asm / 8 - GDT_ENTRIES,8,0
178 .org 0x3000
179 ENTRY(default_ldt)
181 #define HYPERCALL_PAGE_OFFSET 0x4000
182 .org HYPERCALL_PAGE_OFFSET
183 ENTRY(hypercall_page)
184 .skip 0x1000
186 /*
187 * Real beginning of normal "text" segment
188 */
189 ENTRY(stext)
190 ENTRY(_stext)
193 /*
194 * __xen_guest information
195 */
196 .macro utoa value
197 .if (\value) < 0 || (\value) >= 0x10
198 utoa (((\value)>>4)&0x0fffffff)
199 .endif
200 .if ((\value) & 0xf) < 10
201 .byte '0' + ((\value) & 0xf)
202 .else
203 .byte 'A' + ((\value) & 0xf) - 10
204 .endif
205 .endm
207 .section __xen_guest
208 .ascii "GUEST_OS=linux,GUEST_VER=2.6"
209 .ascii ",XEN_VER=xen-3.0"
210 .ascii ",VIRT_BASE=0x"
211 utoa __PAGE_OFFSET
212 .ascii ",HYPERCALL_PAGE=0x"
213 utoa ((__PHYSICAL_START+HYPERCALL_PAGE_OFFSET)>>PAGE_SHIFT)
214 #ifdef CONFIG_X86_PAE
215 .ascii ",PAE=yes"
216 #else
217 .ascii ",PAE=no"
218 #endif
219 .ascii ",LOADER=generic"
220 .byte 0