Fix typo in comment
[kqemu.git] / tests / entry-i386.S
blobc67f798945fb0047f4728c01d379b1b19ab131d9
1 /*
2  * Regression tests for KQEMU
3  * (c) 2005-2007 Fabrice Bellard
4  */
5 #include "kqemutest.h"
7         .globl _start
8         
9 _start:
10         .long kernel_exceptions
11         .long 0               
12         .long kernel_syscall
13         .long 0               
14         .long kernel_idt
15         .long 0               
16         .long kernel_gdt
17         .long 0               
18         .long kernel_ldt
19         .long 0               
20         .long 0 /* kernel_lstar */
21         .long 0
22         .long kernel_stack
23         .long 0
24         
25 #define EXCEPTION_VECTOR(n, push_0) \
26         .align 32 ; \
27         push_0 ; \
28         pushl %eax ; \
29         movl $0x ## n, %eax ; \
30         jmp kernel_exception
32         .align 32
33 kernel_exceptions:
34         
35 EXCEPTION_VECTOR(00, pushl $0)
36 EXCEPTION_VECTOR(01, pushl $0)
37 EXCEPTION_VECTOR(02, pushl $0)
38 EXCEPTION_VECTOR(03, pushl $0)
39 EXCEPTION_VECTOR(04, pushl $0)
40 EXCEPTION_VECTOR(05, pushl $0)
41 EXCEPTION_VECTOR(06, pushl $0)
42 EXCEPTION_VECTOR(07, pushl $0)
43 EXCEPTION_VECTOR(08, )
44 EXCEPTION_VECTOR(09, pushl $0)
45 EXCEPTION_VECTOR(0a, )
46 EXCEPTION_VECTOR(0b, )
47 EXCEPTION_VECTOR(0c, )
48 EXCEPTION_VECTOR(0d, )
49 EXCEPTION_VECTOR(0e, )
50 EXCEPTION_VECTOR(0f, pushl $0)
51 EXCEPTION_VECTOR(10, pushl $0)
52 EXCEPTION_VECTOR(11, )
53 EXCEPTION_VECTOR(12, pushl $0)
54 EXCEPTION_VECTOR(13, pushl $0)
56         .align 32
57 kernel_syscall:
58         pushl $0
59         pushl %eax
60         cld
61         pushl %es
62         pushl %ds
63         pushl %ebp
64         pushl %edi
65         pushl %esi
66         pushl %edx
67         pushl %ecx
68         pushl %ebx
70         movl $KERNEL_DS, %ebp
71         movl %ebp, %ds
72         movl %ebp, %es
74         call do_syscall
76 //        cli
77         popl %ebx
78         popl %ecx
79         popl %edx
80         popl %esi
81         popl %edi
82         popl %ebp
83         popl %ds
84         popl %es
85         addl $8, %esp
86         iret
88 kernel_exception:
89         cld
90         pushl %es
91         pushl %ds
92         pushl %ebp
93         pushl %edi
94         pushl %esi
95         pushl %edx
96         pushl %ecx
97         pushl %ebx
99         movl $KERNEL_DS, %ebp
100         movl %ebp, %ds
101         movl %ebp, %es
103         pushl %eax
104         call do_exception
105         addl $4, %esp
106         
107         popl %ebx
108         popl %ecx
109         popl %edx
110         popl %esi
111         popl %edi
112         popl %ebp
113         popl %ds
114         popl %es
115         popl %eax
116         addl $4, %esp
117         iret