Fix bad comments.
[mirror_edk2.git] / EdkModulePkg / Universal / DebugSupport / Dxe / ia32 / AsmFuncs.S
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 #******************************************************************************
13
14 .global _OrigVector
15 .global _InterruptEntryStub
16 .global _StubSize
17 .global _CommonIdtEntry
18 .global _FxStorSupport
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 # ?
26 _StubSize: .long 0x0
27 # StubSize: .long InterruptEntryStubEnd - InterruptEntryStub
28
29 .global _FxStorSupport
30 _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 .global _GetIdtr
41 _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 .global _WriteInterruptFlag
51 _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 %ecx,%ecx
60 jne _WriteInterruptFlag+0x17
61 cli
62 jmp _WriteInterruptFlag+0x18
63 sti
64 leave
65 ret
66
67 .global _Vect2Desc
68 _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 .global _InterruptEntryStub
82 _InterruptEntryStub:
83 mov %esp,0x0
84 mov $0x0,%esp
85 push $0x0
86 jmp _CommonIdtEntry
87
88 .global _CommonIdtEntry
89 _CommonIdtEntry:
90 pusha
91 pushf
92 pop %eax
93 mov %eax,0x0
94 cmpl $0x8,0x0
95 jne _CommonIdtEntry+0x20
96 movl $0x1,0x0
97 jmp _CommonIdtEntry+0xa8
98 cmpl $0xa,0x0
99 jne _CommonIdtEntry+0x35
100 movl $0x1,0x0
101 jmp _CommonIdtEntry+0xa8
102 cmpl $0xb,0x0
103 jne _CommonIdtEntry+0x4a
104 movl $0x1,0x0
105 jmp _CommonIdtEntry+0xa8
106 cmpl $0xc,0x0
107 jne _CommonIdtEntry+0x5f
108 movl $0x1,0x0
109 jmp _CommonIdtEntry+0xa8
110 cmpl $0xd,0x0
111 jne _CommonIdtEntry+0x74
112 movl $0x1,0x0
113 jmp _CommonIdtEntry+0xa8
114 cmpl $0xe,0x0
115 jne _CommonIdtEntry+0x89
116 movl $0x1,0x0
117 jmp _CommonIdtEntry+0xa8
118 cmpl $0x11,0x0
119 jne _CommonIdtEntry+0x9e
120 movl $0x1,0x0
121 jmp _CommonIdtEntry+0xa8
122 movl $0x0,0x0
123 cmpl $0x1,0x0
124 jne _CommonIdtEntry+0xc8
125 mov 0x0,%eax
126 mov (%eax),%ebx
127 mov %ebx,0x0
128 add $0x4,%eax
129 mov %eax,0x0
130 jmp _CommonIdtEntry+0xd2
131 movl $0x0,0x0
132 mov 0xc(%esp),%eax
133 mov %eax,0x0
134 mov 0x0,%eax
135 add $0xc,%eax
136 mov %eax,0xc(%esp)
137 mov %ss,%eax
138 push %eax
139 mov 0x0,%eax
140 movzwl 0x4(%eax),%eax
141 push %eax
142 mov %ds,%eax
143 push %eax
144 mov %es,%eax
145 push %eax
146 mov %fs,%eax
147 push %eax
148 mov %gs,%eax
149 push %eax
150 mov 0x0,%eax
151 pushl (%eax)
152 push $0x0
153 push $0x0
154 sidtl (%esp)
155 push $0x0
156 push $0x0
157 sgdtl (%esp)
158 xor %eax,%eax
159 str %eax
160 push %eax
161 sldt %eax
162 push %eax
163 mov 0x0,%eax
164 pushl 0x8(%eax)
165 mov %cr4,%eax
166 or $0x208,%eax
167 mov %eax,%cr4
168 push %eax
169 mov %cr3,%eax
170 push %eax
171 mov %cr2,%eax
172 push %eax
173 push $0x0
174 mov %cr0,%eax
175 push %eax
176 mov %db7,%eax
177 push %eax
178 xor %eax,%eax
179 mov %eax,%db7
180 mov %db6,%eax
181 push %eax
182 xor %eax,%eax
183 mov %eax,%db6
184 mov %db3,%eax
185 push %eax
186 mov %db2,%eax
187 push %eax
188 mov %db1,%eax
189 push %eax
190 mov %db0,%eax
191 push %eax
192 sub $0x200,%esp
193 mov %esp,%edi
194 fxsave (%edi)
195 mov 0x0,%eax
196 push %eax
197 mov %esp,%eax
198 push %eax
199 mov 0x0,%eax
200 push %eax
201 call _CommonIdtEntry+0x184
202 add $0x8,%esp
203 add $0x4,%esp
204 mov %esp,%esi
205 fxrstor (%esi)
206 add $0x200,%esp
207 pop %eax
208 mov %eax,%db0
209 pop %eax
210 mov %eax,%db1
211 pop %eax
212 mov %eax,%db2
213 pop %eax
214 mov %eax,%db3
215 add $0x4,%esp
216 pop %eax
217 mov %eax,%db7
218 pop %eax
219 mov %eax,%cr0
220 add $0x4,%esp
221 pop %eax
222 mov %eax,%cr2
223 pop %eax
224 mov %eax,%cr3
225 pop %eax
226 mov %eax,%cr4
227 mov 0x0,%eax
228 popl 0x8(%eax)
229 add $0x18,%esp
230 popl (%eax)
231 pop %gs
232 pop %fs
233 pop %es
234 pop %ds
235 popl 0x4(%eax)
236 pop %ss
237 mov 0xc(%esp),%ebx
238 mov 0x0,%eax
239 add $0xc,%eax
240 cmp %eax,%ebx
241 je _CommonIdtEntry+0x202
242 mov 0x0,%eax
243 mov (%eax),%ecx
244 mov %ecx,(%ebx)
245 mov 0x4(%eax),%ecx
246 mov %ecx,0x4(%ebx)
247 mov 0x8(%eax),%ecx
248 mov %ecx,0x8(%ebx)
249 mov %ebx,%eax
250 mov %eax,0x0
251 mov 0x0,%eax
252 mov %eax,0xc(%esp)
253 cmpl $0x68,0x0
254 jne PhonyIretd+0xd
255 mov 0x0,%eax
256 mov 0x8(%eax),%ebx
257 and $0xfffffcff,%ebx
258 push %ebx
259 push %cs
260 push $0x0
261 iret
262
263 PhonyIretd:
264 popa
265 mov 0x0,%esp
266 jmp *0x0
267 popa
268 mov 0x0,%esp
269 iret