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