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