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