ia64/xen-unstable

view xen/arch/x86/boot/x86_32.S @ 16376:6c544894b8b2

x86: GDT reserved page should be a full page.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir@xensource.com>
date Tue Nov 13 19:21:00 2007 +0000 (2007-11-13)
parents 16f35bea00f8
children 8bd776540ab3
line source
1 .code32
3 /* Enable full CR4 features. */
4 mov mmu_cr4_features,%eax
5 mov %eax,%cr4
7 /* Initialise stack. */
8 mov stack_start,%esp
9 or $(STACK_SIZE-CPUINFO_sizeof),%esp
11 /* Reset EFLAGS (subsumes CLI and CLD). */
12 pushl $0
13 popf
15 lidt idt_descr
17 test %ebx,%ebx
18 jnz start_secondary
20 /* Initialise IDT with simple error defaults. */
21 lea ignore_int,%edx
22 mov $(__HYPERVISOR_CS << 16),%eax
23 mov %dx,%ax /* selector = 0x0010 = cs */
24 mov $0x8E00,%dx /* interrupt gate - dpl=0, present */
25 lea idt_table,%edi
26 mov $256,%ecx
27 1: mov %eax,(%edi)
28 mov %edx,4(%edi)
29 add $8,%edi
30 loop 1b
32 /* Pass off the Multiboot info structure to C land. */
33 pushl multiboot_ptr
34 call __start_xen
35 ud2 /* Force a panic (invalid opcode). */
37 /* This is the default interrupt handler. */
38 int_msg:
39 .asciz "Unknown interrupt (cr2=%08x)\n"
40 hex_msg:
41 .asciz " %08x"
42 ALIGN
43 ignore_int:
44 pusha
45 cld
46 mov $(__HYPERVISOR_DS),%eax
47 mov %eax,%ds
48 mov %eax,%es
49 mov %cr2,%eax
50 push %eax
51 pushl $int_msg
52 call printk
53 add $8,%esp
54 mov %esp,%ebp
55 0: pushl (%ebp)
56 add $4,%ebp
57 pushl $hex_msg
58 call printk
59 add $8,%esp
60 test $0xffc,%ebp
61 jnz 0b
62 1: jmp 1b
64 ENTRY(stack_start)
65 .long cpu0_stack
67 /*** DESCRIPTOR TABLES ***/
69 ALIGN
70 multiboot_ptr:
71 .long 0
73 .word 0
74 idt_descr:
75 .word 256*8-1
76 .long idt_table
78 .word 0
79 gdt_descr:
80 .word LAST_RESERVED_GDT_BYTE
81 .long gdt_table - FIRST_RESERVED_GDT_BYTE
84 #ifdef CONFIG_X86_PAE
85 .align 32
86 ENTRY(idle_pg_table)
87 .long sym_phys(idle_pg_table_l2) + 0*PAGE_SIZE + 0x01, 0
88 .long sym_phys(idle_pg_table_l2) + 1*PAGE_SIZE + 0x01, 0
89 .long sym_phys(idle_pg_table_l2) + 2*PAGE_SIZE + 0x01, 0
90 .long sym_phys(idle_pg_table_l2) + 3*PAGE_SIZE + 0x01, 0
91 #endif
93 .align PAGE_SIZE, 0
94 /* NB. Rings != 0 get access up to MACH2PHYS_VIRT_END. This allows access to */
95 /* the machine->physical mapping table. Ring 0 can access all memory. */
96 #define GUEST_DESC(d) \
97 .long ((MACH2PHYS_VIRT_END - 1) >> 12) & 0xffff, \
98 ((MACH2PHYS_VIRT_END - 1) >> 12) & (0xf << 16) | (d)
99 ENTRY(gdt_table)
100 .quad 0x0000000000000000 /* unused */
101 .quad 0x00cf9a000000ffff /* 0xe008 ring 0 4.00GB code at 0x0 */
102 .quad 0x00cf92000000ffff /* 0xe010 ring 0 4.00GB data at 0x0 */
103 GUEST_DESC(0x00c0ba00) /* 0xe019 ring 1 3.xxGB code at 0x0 */
104 GUEST_DESC(0x00c0b200) /* 0xe021 ring 1 3.xxGB data at 0x0 */
105 GUEST_DESC(0x00c0fa00) /* 0xe02b ring 3 3.xxGB code at 0x0 */
106 GUEST_DESC(0x00c0f200) /* 0xe033 ring 3 3.xxGB data at 0x0 */
107 .align PAGE_SIZE,0