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