direct-io.hg

view xen/arch/x86/boot/x86_32.S @ 15374:b1eb43f94a3a

x86/64: Avoid bogus mbi pointer into relocated Xen address space.
Prevent similar bugs in future by poisoning the relocated bottom
megabyte.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Mon Jun 18 16:48:05 2007 +0100 (2007-06-18)
parents a5ae31a91b10
children f50f0ec7dd2c
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\n"
40 ALIGN
41 ignore_int:
42 cld
43 mov $(__HYPERVISOR_DS),%eax
44 mov %eax,%ds
45 mov %eax,%es
46 pushl $int_msg
47 call printk
48 1: jmp 1b
50 ENTRY(stack_start)
51 .long cpu0_stack
53 /*** DESCRIPTOR TABLES ***/
55 ALIGN
56 multiboot_ptr:
57 .long 0
59 .word 0
60 idt_descr:
61 .word 256*8-1
62 .long idt_table
64 .word 0
65 gdt_descr:
66 .word LAST_RESERVED_GDT_BYTE
67 .long gdt_table - FIRST_RESERVED_GDT_BYTE
69 .word 0
70 nopaging_gdt_descr:
71 .word LAST_RESERVED_GDT_BYTE
72 .long sym_phys(gdt_table) - FIRST_RESERVED_GDT_BYTE
74 .align PAGE_SIZE, 0
75 /* NB. Rings != 0 get access up to MACH2PHYS_VIRT_END. This allows access to */
76 /* the machine->physical mapping table. Ring 0 can access all memory. */
77 #define GUEST_DESC(d) \
78 .long ((MACH2PHYS_VIRT_END - 1) >> 12) & 0xffff, \
79 ((MACH2PHYS_VIRT_END - 1) >> 12) & (0xf << 16) | (d)
80 ENTRY(gdt_table)
81 .quad 0x0000000000000000 /* unused */
82 .quad 0x00cf9a000000ffff /* 0xe008 ring 0 4.00GB code at 0x0 */
83 .quad 0x00cf92000000ffff /* 0xe010 ring 0 4.00GB data at 0x0 */
84 GUEST_DESC(0x00c0ba00) /* 0xe019 ring 1 3.xxGB code at 0x0 */
85 GUEST_DESC(0x00c0b200) /* 0xe021 ring 1 3.xxGB data at 0x0 */
86 GUEST_DESC(0x00c0fa00) /* 0xe02b ring 3 3.xxGB code at 0x0 */
87 GUEST_DESC(0x00c0f200) /* 0xe033 ring 3 3.xxGB data at 0x0 */
88 .quad 0x0000000000000000 /* unused */
89 .fill 2*NR_CPUS,8,0 /* space for TSS and LDT per CPU */
91 #ifdef CONFIG_X86_PAE
92 .align 32
93 ENTRY(idle_pg_table)
94 .long sym_phys(idle_pg_table_l2) + 0*PAGE_SIZE + 0x01, 0
95 .long sym_phys(idle_pg_table_l2) + 1*PAGE_SIZE + 0x01, 0
96 .long sym_phys(idle_pg_table_l2) + 2*PAGE_SIZE + 0x01, 0
97 .long sym_phys(idle_pg_table_l2) + 3*PAGE_SIZE + 0x01, 0
98 #endif