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