direct-io.hg

view xen/arch/x86/boot/x86_32.S @ 15404:f50f0ec7dd2c

x86: early exception enhancement

In order to at least have some minimal debuging capabilities when Xen
crashes really early, dump out registers and stack contents in a raw
form.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Wed Jun 20 17:05:48 2007 +0100 (2007-06-20)
parents b1eb43f94a3a
children 16f35bea00f8
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
83 .word 0
84 nopaging_gdt_descr:
85 .word LAST_RESERVED_GDT_BYTE
86 .long sym_phys(gdt_table) - FIRST_RESERVED_GDT_BYTE
88 .align PAGE_SIZE, 0
89 /* NB. Rings != 0 get access up to MACH2PHYS_VIRT_END. This allows access to */
90 /* the machine->physical mapping table. Ring 0 can access all memory. */
91 #define GUEST_DESC(d) \
92 .long ((MACH2PHYS_VIRT_END - 1) >> 12) & 0xffff, \
93 ((MACH2PHYS_VIRT_END - 1) >> 12) & (0xf << 16) | (d)
94 ENTRY(gdt_table)
95 .quad 0x0000000000000000 /* unused */
96 .quad 0x00cf9a000000ffff /* 0xe008 ring 0 4.00GB code at 0x0 */
97 .quad 0x00cf92000000ffff /* 0xe010 ring 0 4.00GB data at 0x0 */
98 GUEST_DESC(0x00c0ba00) /* 0xe019 ring 1 3.xxGB code at 0x0 */
99 GUEST_DESC(0x00c0b200) /* 0xe021 ring 1 3.xxGB data at 0x0 */
100 GUEST_DESC(0x00c0fa00) /* 0xe02b ring 3 3.xxGB code at 0x0 */
101 GUEST_DESC(0x00c0f200) /* 0xe033 ring 3 3.xxGB data at 0x0 */
102 .quad 0x0000000000000000 /* unused */
103 .fill 2*NR_CPUS,8,0 /* space for TSS and LDT per CPU */
105 #ifdef CONFIG_X86_PAE
106 .align 32
107 ENTRY(idle_pg_table)
108 .long sym_phys(idle_pg_table_l2) + 0*PAGE_SIZE + 0x01, 0
109 .long sym_phys(idle_pg_table_l2) + 1*PAGE_SIZE + 0x01, 0
110 .long sym_phys(idle_pg_table_l2) + 2*PAGE_SIZE + 0x01, 0
111 .long sym_phys(idle_pg_table_l2) + 3*PAGE_SIZE + 0x01, 0
112 #endif