]>
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 | |
1cb5cfc1 | 14 | .globl _OrigVector |
15 | .globl _InterruptEntryStub | |
16 | .globl _StubSize | |
17 | .globl _CommonIdtEntry | |
18 | .globl _FxStorSupport | |
b6454bcb | 19 | |
20 | _AppEsp: .long 0x11111111 # ? | |
21 | _DebugEsp: .long 0x22222222 # ? | |
22 | _ExtraPush: .long 0x33333333 # ? | |
23 | _ExceptData: .long 0x44444444 # ? | |
24 | _Eflags: .long 0x55555555 # ? | |
25 | _OrigVector: .long 0x66666666 # ? | |
a7bbc1eb | 26 | _StubSize: .long _InterruptEntryStubEnd - _InterruptEntryStub |
b6454bcb | 27 | |
1cb5cfc1 | 28 | .globl _FxStorSupport |
b6454bcb | 29 | _FxStorSupport: |
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 | ||
1cb5cfc1 | 39 | .globl _GetIdtr |
b6454bcb | 40 | _GetIdtr: |
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 | ||
1cb5cfc1 | 49 | .globl _WriteInterruptFlag |
b6454bcb | 50 | _WriteInterruptFlag: |
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 | |
59 | jne _WriteInterruptFlag+0x17 | |
60 | cli | |
61 | jmp _WriteInterruptFlag+0x18 | |
62 | sti | |
63 | leave | |
64 | ret | |
65 | ||
1cb5cfc1 | 66 | .globl _Vect2Desc |
b6454bcb | 67 | _Vect2Desc: |
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 | ||
1cb5cfc1 | 80 | .globl _InterruptEntryStub |
b6454bcb | 81 | _InterruptEntryStub: |
82 | mov %esp,0x0 | |
83 | mov $0x0,%esp | |
84 | push $0x0 | |
85 | jmp _CommonIdtEntry | |
1cb5cfc1 | 86 | .globl _InterruptEntryStubEnd |
a7bbc1eb | 87 | _InterruptEntryStubEnd: |
b6454bcb | 88 | |
1cb5cfc1 | 89 | .globl _CommonIdtEntry |
b6454bcb | 90 | _CommonIdtEntry: |
91 | pusha | |
92 | pushf | |
93 | pop %eax | |
94 | mov %eax,0x0 | |
95 | cmpl $0x8,0x0 | |
96 | jne _CommonIdtEntry+0x20 | |
97 | movl $0x1,0x0 | |
98 | jmp _CommonIdtEntry+0xa8 | |
99 | cmpl $0xa,0x0 | |
100 | jne _CommonIdtEntry+0x35 | |
101 | movl $0x1,0x0 | |
102 | jmp _CommonIdtEntry+0xa8 | |
103 | cmpl $0xb,0x0 | |
104 | jne _CommonIdtEntry+0x4a | |
105 | movl $0x1,0x0 | |
106 | jmp _CommonIdtEntry+0xa8 | |
107 | cmpl $0xc,0x0 | |
108 | jne _CommonIdtEntry+0x5f | |
109 | movl $0x1,0x0 | |
110 | jmp _CommonIdtEntry+0xa8 | |
111 | cmpl $0xd,0x0 | |
112 | jne _CommonIdtEntry+0x74 | |
113 | movl $0x1,0x0 | |
114 | jmp _CommonIdtEntry+0xa8 | |
115 | cmpl $0xe,0x0 | |
116 | jne _CommonIdtEntry+0x89 | |
117 | movl $0x1,0x0 | |
118 | jmp _CommonIdtEntry+0xa8 | |
119 | cmpl $0x11,0x0 | |
120 | jne _CommonIdtEntry+0x9e | |
121 | movl $0x1,0x0 | |
122 | jmp _CommonIdtEntry+0xa8 | |
123 | movl $0x0,0x0 | |
124 | cmpl $0x1,0x0 | |
125 | jne _CommonIdtEntry+0xc8 | |
126 | mov 0x0,%eax | |
127 | mov (%eax),%ebx | |
128 | mov %ebx,0x0 | |
129 | add $0x4,%eax | |
130 | mov %eax,0x0 | |
131 | jmp _CommonIdtEntry+0xd2 | |
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 | |
202 | call _CommonIdtEntry+0x184 | |
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 | |
242 | je _CommonIdtEntry+0x202 | |
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 |