]>
Commit | Line | Data |
---|---|---|
c14ca13e | 1 | #****************************************************************************** |
2 | #* | |
3 | #* Copyright (c) 2006, Intel Corporation | |
4 | #* All rights reserved. This program and the accompanying materials | |
5 | #* are licensed and made available under the terms and conditions of the BSD License | |
6 | #* which accompanies this distribution. The full text of the license may be found at | |
7 | #* http://opensource.org/licenses/bsd-license.php | |
8 | #* | |
9 | #* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, | |
10 | #* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. | |
11 | #* | |
12 | #****************************************************************************** | |
b6454bcb | 13 | |
0dce6dc1 | 14 | .globl ASM_PFX(OrigVector) |
15 | .globl ASM_PFX(InterruptEntryStub) | |
16 | .globl ASM_PFX(StubSize) | |
17 | .globl ASM_PFX(CommonIdtEntry) | |
18 | .globl ASM_PFX(FxStorSupport) | |
b6454bcb | 19 | |
0dce6dc1 | 20 | ASM_PFX(AppEsp): .long 0x11111111 # ? |
21 | ASM_PFX(DebugEsp): .long 0x22222222 # ? | |
22 | ASM_PFX(ExtraPush): .long 0x33333333 # ? | |
23 | ASM_PFX(ExceptData): .long 0x44444444 # ? | |
24 | ASM_PFX(Eflags): .long 0x55555555 # ? | |
25 | ASM_PFX(OrigVector): .long 0x66666666 # ? | |
26 | ASM_PFX(StubSize): .long ASM_PFX(InterruptEntryStubEnd) - ASM_PFX(InterruptEntryStub) | |
b6454bcb | 27 | |
0dce6dc1 | 28 | .globl ASM_PFX(FxStorSupport) |
29 | ASM_PFX(FxStorSupport): | |
b6454bcb | 30 | push %ebx |
31 | mov $0x1,%eax | |
32 | cpuid | |
33 | mov %edx,%eax | |
34 | and $0x1000000,%eax | |
35 | shr $0x18,%eax | |
36 | pop %ebx | |
37 | ret | |
38 | ||
0dce6dc1 | 39 | .globl ASM_PFX(GetIdtr) |
40 | ASM_PFX(GetIdtr): | |
b6454bcb | 41 | push %ebp |
42 | mov %esp,%ebp | |
43 | add $0xfffffff8,%esp | |
44 | sidtl 0xfffffffa(%ebp) | |
45 | mov 0xfffffffc(%ebp),%eax | |
46 | leave | |
47 | ret | |
48 | ||
0dce6dc1 | 49 | .globl ASM_PFX(WriteInterruptFlag) |
50 | ASM_PFX(WriteInterruptFlag): | |
b6454bcb | 51 | push %ebp |
52 | mov %esp,%ebp | |
53 | pushf | |
54 | pop %eax | |
55 | and $0x200,%eax | |
56 | shr $0x9,%eax | |
57 | mov 0x8(%ebp),%ecx | |
58 | or %ecx,%ecx | |
0dce6dc1 | 59 | jne ASM_PFX(WriteInterruptFlag+0x17) |
b6454bcb | 60 | cli |
0dce6dc1 | 61 | jmp ASM_PFX(WriteInterruptFlag+0x18) |
b6454bcb | 62 | sti |
63 | leave | |
64 | ret | |
65 | ||
0dce6dc1 | 66 | .globl ASM_PFX(Vect2Desc) |
67 | ASM_PFX(Vect2Desc): | |
b6454bcb | 68 | push %ebp |
69 | mov %esp,%ebp | |
70 | mov 0xc(%ebp),%eax | |
71 | mov 0x8(%ebp),%ecx | |
72 | mov %ax,(%ecx) | |
73 | movw $0x20,0x2(%ecx) | |
74 | movw $0x8e00,0x4(%ecx) | |
75 | shr $0x10,%eax | |
76 | mov %ax,0x6(%ecx) | |
77 | leave | |
78 | ret | |
79 | ||
0dce6dc1 | 80 | .globl ASM_PFX(InterruptEntryStub) |
81 | ASM_PFX(InterruptEntryStub): | |
b6454bcb | 82 | mov %esp,0x0 |
83 | mov $0x0,%esp | |
84 | push $0x0 | |
0dce6dc1 | 85 | jmp ASM_PFX(CommonIdtEntry) |
86 | .globl ASM_PFX(InterruptEntryStubEnd) | |
87 | ASM_PFX(InterruptEntryStubEnd): | |
b6454bcb | 88 | |
0dce6dc1 | 89 | .globl ASM_PFX(CommonIdtEntry) |
90 | ASM_PFX(CommonIdtEntry): | |
b6454bcb | 91 | pusha |
92 | pushf | |
93 | pop %eax | |
94 | mov %eax,0x0 | |
95 | cmpl $0x8,0x0 | |
0dce6dc1 | 96 | jne ASM_PFX(CommonIdtEntry+0x20) |
b6454bcb | 97 | movl $0x1,0x0 |
0dce6dc1 | 98 | jmp ASM_PFX(CommonIdtEntry+0xa8) |
b6454bcb | 99 | cmpl $0xa,0x0 |
0dce6dc1 | 100 | jne ASM_PFX(CommonIdtEntry+0x35) |
b6454bcb | 101 | movl $0x1,0x0 |
0dce6dc1 | 102 | jmp ASM_PFX(CommonIdtEntry+0xa8) |
b6454bcb | 103 | cmpl $0xb,0x0 |
0dce6dc1 | 104 | jne ASM_PFX(CommonIdtEntry+0x4a) |
b6454bcb | 105 | movl $0x1,0x0 |
0dce6dc1 | 106 | jmp ASM_PFX(CommonIdtEntry+0xa8) |
b6454bcb | 107 | cmpl $0xc,0x0 |
0dce6dc1 | 108 | jne ASM_PFX(CommonIdtEntry+0x5f) |
b6454bcb | 109 | movl $0x1,0x0 |
0dce6dc1 | 110 | jmp ASM_PFX(CommonIdtEntry+0xa8) |
b6454bcb | 111 | cmpl $0xd,0x0 |
0dce6dc1 | 112 | jne ASM_PFX(CommonIdtEntry+0x74) |
b6454bcb | 113 | movl $0x1,0x0 |
0dce6dc1 | 114 | jmp ASM_PFX(CommonIdtEntry+0xa8) |
b6454bcb | 115 | cmpl $0xe,0x0 |
0dce6dc1 | 116 | jne ASM_PFX(CommonIdtEntry+0x89) |
b6454bcb | 117 | movl $0x1,0x0 |
0dce6dc1 | 118 | jmp ASM_PFX(CommonIdtEntry+0xa8) |
b6454bcb | 119 | cmpl $0x11,0x0 |
0dce6dc1 | 120 | jne ASM_PFX(CommonIdtEntry+0x9e) |
b6454bcb | 121 | movl $0x1,0x0 |
0dce6dc1 | 122 | jmp ASM_PFX(CommonIdtEntry+0xa8) |
b6454bcb | 123 | movl $0x0,0x0 |
124 | cmpl $0x1,0x0 | |
0dce6dc1 | 125 | jne ASM_PFX(CommonIdtEntry+0xc8) |
b6454bcb | 126 | mov 0x0,%eax |
127 | mov (%eax),%ebx | |
128 | mov %ebx,0x0 | |
129 | add $0x4,%eax | |
130 | mov %eax,0x0 | |
0dce6dc1 | 131 | jmp ASM_PFX(CommonIdtEntry+0xd2) |
b6454bcb | 132 | movl $0x0,0x0 |
133 | mov 0xc(%esp),%eax | |
134 | mov %eax,0x0 | |
135 | mov 0x0,%eax | |
136 | add $0xc,%eax | |
137 | mov %eax,0xc(%esp) | |
138 | mov %ss,%eax | |
139 | push %eax | |
140 | mov 0x0,%eax | |
141 | movzwl 0x4(%eax),%eax | |
142 | push %eax | |
143 | mov %ds,%eax | |
144 | push %eax | |
145 | mov %es,%eax | |
146 | push %eax | |
147 | mov %fs,%eax | |
148 | push %eax | |
149 | mov %gs,%eax | |
150 | push %eax | |
151 | mov 0x0,%eax | |
152 | pushl (%eax) | |
153 | push $0x0 | |
154 | push $0x0 | |
155 | sidtl (%esp) | |
156 | push $0x0 | |
157 | push $0x0 | |
158 | sgdtl (%esp) | |
159 | xor %eax,%eax | |
160 | str %eax | |
161 | push %eax | |
162 | sldt %eax | |
163 | push %eax | |
164 | mov 0x0,%eax | |
165 | pushl 0x8(%eax) | |
166 | mov %cr4,%eax | |
167 | or $0x208,%eax | |
168 | mov %eax,%cr4 | |
169 | push %eax | |
170 | mov %cr3,%eax | |
171 | push %eax | |
172 | mov %cr2,%eax | |
173 | push %eax | |
174 | push $0x0 | |
175 | mov %cr0,%eax | |
176 | push %eax | |
177 | mov %db7,%eax | |
178 | push %eax | |
179 | xor %eax,%eax | |
180 | mov %eax,%db7 | |
181 | mov %db6,%eax | |
182 | push %eax | |
183 | xor %eax,%eax | |
184 | mov %eax,%db6 | |
185 | mov %db3,%eax | |
186 | push %eax | |
187 | mov %db2,%eax | |
188 | push %eax | |
189 | mov %db1,%eax | |
190 | push %eax | |
191 | mov %db0,%eax | |
192 | push %eax | |
193 | sub $0x200,%esp | |
194 | mov %esp,%edi | |
195 | fxsave (%edi) | |
196 | mov 0x0,%eax | |
197 | push %eax | |
198 | mov %esp,%eax | |
199 | push %eax | |
200 | mov 0x0,%eax | |
201 | push %eax | |
0dce6dc1 | 202 | call ASM_PFX(CommonIdtEntry+0x184) |
b6454bcb | 203 | add $0x8,%esp |
204 | add $0x4,%esp | |
205 | mov %esp,%esi | |
206 | fxrstor (%esi) | |
207 | add $0x200,%esp | |
208 | pop %eax | |
209 | mov %eax,%db0 | |
210 | pop %eax | |
211 | mov %eax,%db1 | |
212 | pop %eax | |
213 | mov %eax,%db2 | |
214 | pop %eax | |
215 | mov %eax,%db3 | |
216 | add $0x4,%esp | |
217 | pop %eax | |
218 | mov %eax,%db7 | |
219 | pop %eax | |
220 | mov %eax,%cr0 | |
221 | add $0x4,%esp | |
222 | pop %eax | |
223 | mov %eax,%cr2 | |
224 | pop %eax | |
225 | mov %eax,%cr3 | |
226 | pop %eax | |
227 | mov %eax,%cr4 | |
228 | mov 0x0,%eax | |
229 | popl 0x8(%eax) | |
230 | add $0x18,%esp | |
231 | popl (%eax) | |
232 | pop %gs | |
233 | pop %fs | |
234 | pop %es | |
235 | pop %ds | |
236 | popl 0x4(%eax) | |
237 | pop %ss | |
238 | mov 0xc(%esp),%ebx | |
239 | mov 0x0,%eax | |
240 | add $0xc,%eax | |
241 | cmp %eax,%ebx | |
0dce6dc1 | 242 | je ASM_PFX(CommonIdtEntry+0x202) |
b6454bcb | 243 | mov 0x0,%eax |
244 | mov (%eax),%ecx | |
245 | mov %ecx,(%ebx) | |
246 | mov 0x4(%eax),%ecx | |
247 | mov %ecx,0x4(%ebx) | |
248 | mov 0x8(%eax),%ecx | |
249 | mov %ecx,0x8(%ebx) | |
250 | mov %ebx,%eax | |
251 | mov %eax,0x0 | |
252 | mov 0x0,%eax | |
253 | mov %eax,0xc(%esp) | |
254 | cmpl $0x68,0x0 | |
255 | jne PhonyIretd+0xd | |
256 | mov 0x0,%eax | |
257 | mov 0x8(%eax),%ebx | |
258 | and $0xfffffcff,%ebx | |
259 | push %ebx | |
260 | push %cs | |
261 | push $0x0 | |
262 | iret | |
263 | ||
264 | PhonyIretd: | |
265 | popa | |
266 | mov 0x0,%esp | |
267 | jmp *0x0 | |
268 | popa | |
269 | mov 0x0,%esp | |
270 | iret |