]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/DebugSupportDxe/Ia32/AsmFuncs.S
Port AsmFuncs.s to pass CYGWINGCC build for x64.
[mirror_edk2.git] / MdeModulePkg / Universal / DebugSupportDxe / Ia32 / AsmFuncs.S
CommitLineData
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
21ASM_PFX(AppEsp): .long 0x11111111 # ?\r
22ASM_PFX(DebugEsp): .long 0x22222222 # ?\r
23ASM_PFX(ExtraPush): .long 0x33333333 # ?\r
24ASM_PFX(ExceptData): .long 0x44444444 # ?\r
25ASM_PFX(Eflags): .long 0x55555555 # ?\r
26ASM_PFX(OrigVector): .long 0x66666666 # ?\r
27ASM_PFX(StubSize): .long ASM_PFX(InterruptEntryStubEnd) - ASM_PFX(InterruptEntryStub)\r
28\r
29.globl ASM_PFX(FxStorSupport)\r
30ASM_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
c1f23d63 40.globl ASM_PFX(Vect2Desc)\r
41ASM_PFX(Vect2Desc):\r
42 push %ebp\r
43 mov %esp,%ebp\r
44 mov 0xc(%ebp),%eax\r
45 mov 0x8(%ebp),%ecx\r
46 mov %ax,(%ecx)\r
47 movw $0x20,0x2(%ecx)\r
48 movw $0x8e00,0x4(%ecx)\r
49 shr $0x10,%eax\r
50 mov %ax,0x6(%ecx)\r
7b414b4e 51 leave\r
52 ret\r
c1f23d63 53\r
54.globl ASM_PFX(InterruptEntryStub)\r
55ASM_PFX(InterruptEntryStub):\r
56 mov %esp,0x0\r
57 mov $0x0,%esp\r
58 push $0x0\r
59 jmp ASM_PFX(CommonIdtEntry)\r
60.globl ASM_PFX(InterruptEntryStubEnd)\r
61ASM_PFX(InterruptEntryStubEnd):\r
62\r
63.globl ASM_PFX(CommonIdtEntry)\r
64ASM_PFX(CommonIdtEntry):\r
7b414b4e 65 pusha\r
66 pushf\r
c1f23d63 67 pop %eax\r
68 mov %eax,0x0\r
69 cmpl $0x8,0x0\r
70 jne ASM_PFX(CommonIdtEntry+0x20)\r
71 movl $0x1,0x0\r
72 jmp ASM_PFX(CommonIdtEntry+0xa8)\r
73 cmpl $0xa,0x0\r
74 jne ASM_PFX(CommonIdtEntry+0x35)\r
75 movl $0x1,0x0\r
76 jmp ASM_PFX(CommonIdtEntry+0xa8)\r
77 cmpl $0xb,0x0\r
78 jne ASM_PFX(CommonIdtEntry+0x4a)\r
79 movl $0x1,0x0\r
80 jmp ASM_PFX(CommonIdtEntry+0xa8)\r
81 cmpl $0xc,0x0\r
82 jne ASM_PFX(CommonIdtEntry+0x5f)\r
83 movl $0x1,0x0\r
84 jmp ASM_PFX(CommonIdtEntry+0xa8)\r
85 cmpl $0xd,0x0\r
86 jne ASM_PFX(CommonIdtEntry+0x74)\r
87 movl $0x1,0x0\r
88 jmp ASM_PFX(CommonIdtEntry+0xa8)\r
89 cmpl $0xe,0x0\r
90 jne ASM_PFX(CommonIdtEntry+0x89)\r
91 movl $0x1,0x0\r
92 jmp ASM_PFX(CommonIdtEntry+0xa8)\r
93 cmpl $0x11,0x0\r
94 jne ASM_PFX(CommonIdtEntry+0x9e)\r
95 movl $0x1,0x0\r
96 jmp ASM_PFX(CommonIdtEntry+0xa8)\r
97 movl $0x0,0x0\r
98 cmpl $0x1,0x0\r
99 jne ASM_PFX(CommonIdtEntry+0xc8)\r
100 mov 0x0,%eax\r
101 mov (%eax),%ebx\r
102 mov %ebx,0x0\r
103 add $0x4,%eax\r
104 mov %eax,0x0\r
105 jmp ASM_PFX(CommonIdtEntry+0xd2)\r
106 movl $0x0,0x0\r
107 mov 0xc(%esp),%eax\r
108 mov %eax,0x0\r
109 mov 0x0,%eax\r
110 add $0xc,%eax\r
111 mov %eax,0xc(%esp)\r
112 mov %ss,%eax\r
113 push %eax\r
114 mov 0x0,%eax\r
115 movzwl 0x4(%eax),%eax\r
116 push %eax\r
117 mov %ds,%eax\r
118 push %eax\r
119 mov %es,%eax\r
120 push %eax\r
121 mov %fs,%eax\r
122 push %eax\r
123 mov %gs,%eax\r
124 push %eax\r
125 mov 0x0,%eax\r
126 pushl (%eax)\r
127 push $0x0\r
128 push $0x0\r
129 sidtl (%esp)\r
130 push $0x0\r
131 push $0x0\r
132 sgdtl (%esp)\r
133 xor %eax,%eax\r
134 str %eax\r
135 push %eax\r
136 sldt %eax\r
137 push %eax\r
138 mov 0x0,%eax\r
139 pushl 0x8(%eax)\r
140 mov %cr4,%eax\r
141 or $0x208,%eax\r
142 mov %eax,%cr4\r
143 push %eax\r
144 mov %cr3,%eax\r
145 push %eax\r
146 mov %cr2,%eax\r
147 push %eax\r
148 push $0x0\r
149 mov %cr0,%eax\r
150 push %eax\r
151 mov %db7,%eax\r
152 push %eax\r
153 xor %eax,%eax\r
154 mov %eax,%db7\r
155 mov %db6,%eax\r
156 push %eax\r
157 xor %eax,%eax\r
158 mov %eax,%db6\r
159 mov %db3,%eax\r
160 push %eax\r
161 mov %db2,%eax\r
162 push %eax\r
163 mov %db1,%eax\r
164 push %eax\r
165 mov %db0,%eax\r
166 push %eax\r
167 sub $0x200,%esp\r
168 mov %esp,%edi\r
169 fxsave (%edi)\r
170 mov 0x0,%eax\r
171 push %eax\r
172 mov %esp,%eax\r
173 push %eax\r
174 mov 0x0,%eax\r
175 push %eax\r
176 call ASM_PFX(CommonIdtEntry+0x184)\r
177 add $0x8,%esp\r
178 add $0x4,%esp\r
179 mov %esp,%esi\r
180 fxrstor (%esi)\r
181 add $0x200,%esp\r
182 pop %eax\r
183 mov %eax,%db0\r
184 pop %eax\r
185 mov %eax,%db1\r
186 pop %eax\r
187 mov %eax,%db2\r
188 pop %eax\r
189 mov %eax,%db3\r
190 add $0x4,%esp\r
191 pop %eax\r
192 mov %eax,%db7\r
193 pop %eax\r
194 mov %eax,%cr0\r
195 add $0x4,%esp\r
196 pop %eax\r
197 mov %eax,%cr2\r
198 pop %eax\r
199 mov %eax,%cr3\r
200 pop %eax\r
201 mov %eax,%cr4\r
202 mov 0x0,%eax\r
203 popl 0x8(%eax)\r
204 add $0x18,%esp\r
205 popl (%eax)\r
206 pop %gs\r
207 pop %fs\r
208 pop %es\r
209 pop %ds\r
210 popl 0x4(%eax)\r
211 pop %ss\r
212 mov 0xc(%esp),%ebx\r
213 mov 0x0,%eax\r
214 add $0xc,%eax\r
215 cmp %eax,%ebx\r
216 je ASM_PFX(CommonIdtEntry+0x202)\r
217 mov 0x0,%eax\r
218 mov (%eax),%ecx\r
219 mov %ecx,(%ebx)\r
220 mov 0x4(%eax),%ecx\r
221 mov %ecx,0x4(%ebx)\r
222 mov 0x8(%eax),%ecx\r
223 mov %ecx,0x8(%ebx)\r
224 mov %ebx,%eax\r
225 mov %eax,0x0\r
226 mov 0x0,%eax\r
227 mov %eax,0xc(%esp)\r
228 cmpl $0x68,0x0\r
229 jne PhonyIretd+0xd\r
230 mov 0x0,%eax\r
231 mov 0x8(%eax),%ebx\r
232 and $0xfffffcff,%ebx\r
233 push %ebx\r
234 push %cs\r
235 push $0x0\r
7b414b4e 236 iret\r
c1f23d63 237\r
238PhonyIretd:\r
7b414b4e 239 popa\r
c1f23d63 240 mov 0x0,%esp\r
241 jmp *0x0\r
7b414b4e 242 popa\r
c1f23d63 243 mov 0x0,%esp\r
7b414b4e 244 iret\r