1 | ; $Id: tstDisasm-1A.asm 96407 2022-08-22 17:43:14Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; VBox disassembler: Assembler test routines
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2006-2022 Oracle and/or its affiliates.
|
---|
8 | ;
|
---|
9 | ; This file is part of VirtualBox base platform packages, as
|
---|
10 | ; available from https://www.virtualbox.org.
|
---|
11 | ;
|
---|
12 | ; This program is free software; you can redistribute it and/or
|
---|
13 | ; modify it under the terms of the GNU General Public License
|
---|
14 | ; as published by the Free Software Foundation, in version 3 of the
|
---|
15 | ; License.
|
---|
16 | ;
|
---|
17 | ; This program is distributed in the hope that it will be useful, but
|
---|
18 | ; WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | ; General Public License for more details.
|
---|
21 | ;
|
---|
22 | ; You should have received a copy of the GNU General Public License
|
---|
23 | ; along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | ;
|
---|
25 | ; SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | ;
|
---|
27 |
|
---|
28 | ;*******************************************************************************
|
---|
29 | ;* Header Files *
|
---|
30 | ;*******************************************************************************
|
---|
31 | %include "iprt/asmdefs.mac"
|
---|
32 | ;%include "VBox/vmm/vm.mac"
|
---|
33 | ;%include "VBox/err.mac"
|
---|
34 | ;%include "VBox/vmm/stam.mac"
|
---|
35 | ;%include "iprt/x86.mac"
|
---|
36 |
|
---|
37 | BITS 32
|
---|
38 |
|
---|
39 | %if __YASM_VERSION_ID__ >= 001020001h ; v1.2.0.1 and greater, make sure to exclude v1.2.0.0.
|
---|
40 | %define pmulhrwa pmulhrw
|
---|
41 | %endif
|
---|
42 |
|
---|
43 |
|
---|
44 | BEGINCODE
|
---|
45 |
|
---|
46 | align 16
|
---|
47 | BEGINPROC TestProc32
|
---|
48 | xor eax, eax
|
---|
49 | mov al, 4
|
---|
50 | lea edx, [4]
|
---|
51 | mov edx, 4
|
---|
52 | mov eax, 4
|
---|
53 | shl eax, 4
|
---|
54 | shl edx, 4
|
---|
55 | shr edx, 4
|
---|
56 | mov eax, edx
|
---|
57 | mov eax, ecx
|
---|
58 | mov edx, eax
|
---|
59 | mov ecx, eax
|
---|
60 | DB 0xF0, 0x0F, 0x22, 0xC0
|
---|
61 | DB 0xF0, 0x0F, 0x20, 0xC0
|
---|
62 | smsw word [edx+16]
|
---|
63 | ; invept eax, dqword [ecx]
|
---|
64 | DB 0x66, 0x0F, 0x38, 0x80, 0x1
|
---|
65 | ; invept eax, dqword [ecx]
|
---|
66 | DB 0x66, 0x0F, 0x38, 0x81, 0x1
|
---|
67 | mov eax, dword [ecx]
|
---|
68 | mov word [edi], 0123ah
|
---|
69 | movzx eax,byte [edx]
|
---|
70 | movzx eax,word [edx]
|
---|
71 | mov dword [es:ebx + 1234h], 0789h
|
---|
72 | mov word [fs:ebx + ecx], 0654h
|
---|
73 | mov byte [esi + eax*4], 054h
|
---|
74 | mov bl, byte [ds:ebp + 1234h]
|
---|
75 | mov al, [cs:1234h + ecx*8]
|
---|
76 | mov al, [cs:1234h]
|
---|
77 | mov ax, [cs:1234h]
|
---|
78 | mov eax, [cs:1234h]
|
---|
79 | lock cmpxchg [ecx], eax
|
---|
80 | lock cmpxchg [ecx], ax
|
---|
81 | lock cmpxchg [ecx], dl
|
---|
82 | movzx ESI,word [EAX]
|
---|
83 | in al, dx
|
---|
84 | in ax, dx
|
---|
85 | in eax, dx
|
---|
86 | mov ebx, [ecx + eax*4 + 17]
|
---|
87 | mov ebx, [ebp + eax*4 + 4]
|
---|
88 | mov ebx, [ebp + eax*4]
|
---|
89 | int 80h
|
---|
90 | in al, 60h
|
---|
91 | in ax, dx
|
---|
92 | out 64h, eax
|
---|
93 |
|
---|
94 | movss xmm0, xmm1
|
---|
95 | movss xmm3, [eax]
|
---|
96 | movss [eax], xmm4
|
---|
97 | movsd xmm6, xmm1
|
---|
98 |
|
---|
99 | pause
|
---|
100 | nop
|
---|
101 |
|
---|
102 | ; 3Dnow!
|
---|
103 | pavgusb mm1, mm0
|
---|
104 | pf2id mm5, mm4
|
---|
105 | pf2iw mm6, mm3
|
---|
106 | pfacc mm7, mm2
|
---|
107 | pfadd mm5, mm4
|
---|
108 | pfcmpeq mm6, mm3
|
---|
109 | pfcmpge mm2, mm7
|
---|
110 | pfcmpgt mm4, mm5
|
---|
111 | pfmax mm3, mm6
|
---|
112 | pfmin mm1, mm0
|
---|
113 | pfmul mm5, mm4
|
---|
114 | pmulhrwa mm3, mm6
|
---|
115 | pfnacc mm4, mm5
|
---|
116 | pfpnacc mm3, mm6
|
---|
117 | pfrcp mm0, mm1
|
---|
118 | pfrcpit1 mm2, mm7
|
---|
119 | pfrcpit2 mm4, mm5
|
---|
120 | pfrsqrt mm7, mm2
|
---|
121 | pfrsqit1 mm1, mm0
|
---|
122 | pfsub mm6, mm3
|
---|
123 | pfsubr mm0, mm1
|
---|
124 | pi2fd mm7, mm2
|
---|
125 | pi2fw mm0, mm1
|
---|
126 | pswapd mm2, mm7
|
---|
127 |
|
---|
128 | pavgusb mm1, qword [es:eax+000000010h]
|
---|
129 | pf2id mm5, qword [ds:esi+000101010h]
|
---|
130 | pf2iw mm6, qword [fs:esi+000101010h]
|
---|
131 | pfacc mm7, qword [gs:esi+000101010h]
|
---|
132 | pfadd mm5, qword [ esi+000101010h]
|
---|
133 | pfcmpeq mm6, qword [ edi*8+000101010h]
|
---|
134 | pfcmpge mm2, qword [es:esi+000100010h]
|
---|
135 | pfcmpgt mm4, qword [es:esi+000101010h]
|
---|
136 | pfmax mm3, qword [es:esi+000101010h]
|
---|
137 | pfmin mm1, qword [es:esi+000101010h]
|
---|
138 | pfmul mm5, qword [es:esi+000101000h]
|
---|
139 | pmulhrwa mm3, qword [es:eax+0ffffffffh]
|
---|
140 | pfnacc mm4, qword [es:ebx+000101010h]
|
---|
141 | pfpnacc mm3, qword [es:edx+000102900h]
|
---|
142 | pfrcp mm0, qword [es:ecx+000101020h]
|
---|
143 | pfrcpit1 mm2, qword [es:ebp+000101510h]
|
---|
144 | pfrcpit2 mm4, qword [es:esp+000101310h]
|
---|
145 | pfrsqrt mm7, qword [es:esi+0f0106010h]
|
---|
146 | pfrsqit1 mm1, qword [es:edi+0001f1010h]
|
---|
147 | pfsub mm6, qword [es:esi*2]
|
---|
148 | pfsubr mm0, qword [es:esi*3]
|
---|
149 | pi2fd mm7, qword [es:esi*4]
|
---|
150 | pi2fw mm0, qword [es:esi*5]
|
---|
151 | pswapd mm2, qword [es:esi*8]
|
---|
152 |
|
---|
153 | pmulhrwa mm0, qword [ds:ebp+edi*8+00f000001h]
|
---|
154 |
|
---|
155 | ; MMX
|
---|
156 | psubusb mm1, mm3
|
---|
157 | cvtpi2pd xmm0, mm3
|
---|
158 | paddd mm1, mm3
|
---|
159 | paddd xmm1, xmm3
|
---|
160 |
|
---|
161 | %if __YASM_VERSION_ID__ >= 001030000h ; Old yasm doesn't support the instructions below
|
---|
162 | adcx eax, ebx
|
---|
163 | adcx eax, [edi]
|
---|
164 |
|
---|
165 | adox eax, ebx
|
---|
166 | adox eax, [edi]
|
---|
167 | adox eax, [edi + 1000h]
|
---|
168 |
|
---|
169 | tzcnt ax, bx
|
---|
170 | tzcnt eax, ebx
|
---|
171 | tzcnt ax, [edi]
|
---|
172 | tzcnt eax, [edi]
|
---|
173 | tzcnt eax, [edi + 1000h]
|
---|
174 | vpmovsxbw ymm0, xmm1
|
---|
175 | vpmovzxbq ymm1, [100h]
|
---|
176 | vgatherqps xmm0,dword [eax+xmm0*2],xmm0
|
---|
177 | vgatherqpd xmm0,qword [eax+xmm0*2],xmm0
|
---|
178 | %endif
|
---|
179 |
|
---|
180 | movbe eax, [edi]
|
---|
181 | movbe ebx, [edi + 1000h]
|
---|
182 | movbe ax, [edi]
|
---|
183 | movbe [edi], eax
|
---|
184 |
|
---|
185 | crc32 eax, bl
|
---|
186 | crc32 eax, bx
|
---|
187 | crc32 eax, ebx
|
---|
188 | crc32 eax, byte [edi]
|
---|
189 | crc32 eax, word [edi]
|
---|
190 | crc32 eax, dword [edi]
|
---|
191 |
|
---|
192 | popcnt ax, bx
|
---|
193 | popcnt eax, ebx
|
---|
194 | popcnt ax, [edi]
|
---|
195 | popcnt eax, [edi]
|
---|
196 | popcnt eax, [edi + 1000h]
|
---|
197 |
|
---|
198 | lzcnt ax, bx
|
---|
199 | lzcnt eax, ebx
|
---|
200 | lzcnt ax, [edi]
|
---|
201 | lzcnt eax, [edi]
|
---|
202 | lzcnt eax, [edi + 1000h]
|
---|
203 |
|
---|
204 | vmread eax, ebx
|
---|
205 | vmwrite eax, ebx
|
---|
206 |
|
---|
207 | movd mm0, [edi]
|
---|
208 | movq mm0, [edi]
|
---|
209 | movq mm0, mm1
|
---|
210 |
|
---|
211 | vmovups xmm0, xmm1
|
---|
212 | vmovaps ymm0, ymm1
|
---|
213 | vunpcklps xmm0, xmm1, xmm2
|
---|
214 | vunpcklps ymm0, ymm1, ymm2
|
---|
215 |
|
---|
216 | lddqu xmm1, [ds:ebp+edi*8+00f000001h]
|
---|
217 | vlddqu xmm1, [ds:ebp+edi*8+00f000001h]
|
---|
218 | vlddqu ymm1, [ds:ebp+edi*8+00f000001h]
|
---|
219 |
|
---|
220 | vpmovsxbw xmm0,qword [0x100]
|
---|
221 | vbroadcastf128 ymm0,oword [0x100]
|
---|
222 |
|
---|
223 | palignr mm0, mm1, 1
|
---|
224 | vpinsrb xmm0, xmm1, eax, 1
|
---|
225 | vpinsrb xmm0, xmm1, [100h], 1
|
---|
226 | vinsertps xmm0, xmm1, xmm2, 1
|
---|
227 | vinsertps xmm0, xmm1, [100h], 1
|
---|
228 |
|
---|
229 | vblendvps xmm0, xmm1, xmm2, xmm3
|
---|
230 | vblendvps ymm0, ymm1, ymm2, ymm3
|
---|
231 |
|
---|
232 | aesimc xmm0, xmm1
|
---|
233 |
|
---|
234 | pmovzxbq xmm0, xmm1
|
---|
235 | pmovzxbq xmm1, [100h]
|
---|
236 |
|
---|
237 | vfmaddsub132pd ymm1, ymm2, ymm3
|
---|
238 |
|
---|
239 | blsr eax, ebx
|
---|
240 | blsi eax, [ebx]
|
---|
241 | db 0c4h, 0e2h, 0f8h, 0f3h, 01bh ; blsi rax, dword [ebx] - but VEX.W=1 is ignored, so same as previous
|
---|
242 | blsmsk eax, [ebx+edi*2]
|
---|
243 | shlx eax, ebx, ecx
|
---|
244 |
|
---|
245 | pmovmskb eax, mm2
|
---|
246 | pmovmskb eax, xmm3
|
---|
247 | vpmovmskb eax, xmm3
|
---|
248 | vpmovmskb eax, ymm3
|
---|
249 |
|
---|
250 | ENDPROC TestProc32
|
---|
251 |
|
---|
252 |
|
---|
253 | %ifndef RT_OS_OS2
|
---|
254 | BITS 64
|
---|
255 | align 16
|
---|
256 | BEGINPROC TestProc64
|
---|
257 | mov cr8, rax
|
---|
258 | mov cr8, rbx
|
---|
259 | mov [0xfffe0080], rax
|
---|
260 | mov [0xfffe0080], rbx
|
---|
261 | mov rax, cr8
|
---|
262 | mov rbx, cr8
|
---|
263 | mov rax, [0xfffe0080]
|
---|
264 | mov rbx, [0xfffe0080]
|
---|
265 | divsd xmm1, xmm0
|
---|
266 | ; invept rdi, dqword [rsi]
|
---|
267 | DB 0x66, 0x0F, 0x38, 0x80, 0x3E
|
---|
268 | ; invept rcx, dqword [rdx]
|
---|
269 | DB 0x66, 0x0F, 0x38, 0x80, 0xA
|
---|
270 | ;invvpid rdi, dqword [rsi]
|
---|
271 | DB 0x66, 0x0F, 0x38, 0x81, 0x3E
|
---|
272 | ; invvpid rcx, dqword [rdx]
|
---|
273 | DB 0x66, 0x0F, 0x38, 0x81, 0xA
|
---|
274 | mov rdi, [rsi]
|
---|
275 | mov rcx, [rdx]
|
---|
276 | db 48h
|
---|
277 | db 0c7h
|
---|
278 | db 42h
|
---|
279 | db 18h
|
---|
280 | db 20h
|
---|
281 | db 3eh
|
---|
282 | db 23h
|
---|
283 | db 80h
|
---|
284 | call qword [r8+10h]
|
---|
285 | ; test
|
---|
286 | db 48h
|
---|
287 | db 8bh
|
---|
288 | db 44h
|
---|
289 | db 0ah
|
---|
290 | db 0f8h
|
---|
291 | ;incorrectly assembled by yasm; REX.W should not be added!
|
---|
292 | ;test rax, dword 0cc90cc90h
|
---|
293 | db 8bh
|
---|
294 | db 04h
|
---|
295 | db 8dh
|
---|
296 | db 00h
|
---|
297 | db 00h
|
---|
298 | db 0feh
|
---|
299 | db 0ffh
|
---|
300 | mov qword [rcx+rdx], 0
|
---|
301 | mov dword [rcx+rdx], 0
|
---|
302 | and [r15], rax
|
---|
303 | movzx rcx, sil
|
---|
304 | and sil, 3
|
---|
305 | movzx ecx, ah
|
---|
306 | and ah, 3
|
---|
307 |
|
---|
308 | sub rcx, 1234h
|
---|
309 | mov rax, qword [0cc90cc90h]
|
---|
310 | mov rax, qword [00c90cc90h]
|
---|
311 | mov rax, dword 0cc90cc90h
|
---|
312 | mov rax, qword 0ffffcc90cc90h
|
---|
313 |
|
---|
314 | movzx rax,byte [edx]
|
---|
315 | movzx rax,word [edx]
|
---|
316 | movzx rax,byte [rdx]
|
---|
317 | lock cmpxchg [rcx], rax
|
---|
318 | lock cmpxchg [rcx], ax
|
---|
319 | lock cmpxchg [r15], dl
|
---|
320 | movzx RSI, word [R8]
|
---|
321 | in al, dx
|
---|
322 | in ax, dx
|
---|
323 | in eax, dx
|
---|
324 | mov rbx, [rcx + rax*4 + 17]
|
---|
325 | mov rbx, [rbp + rax*4 + 4]
|
---|
326 | mov rbx, [rbp + rax*4]
|
---|
327 | mov rbx, [ebp + eax*4]
|
---|
328 | int 80h
|
---|
329 | in al, 60h
|
---|
330 | in ax, dx
|
---|
331 | out 64h, eax
|
---|
332 |
|
---|
333 | movss xmm0, xmm14
|
---|
334 | movsd xmm6, xmm1
|
---|
335 |
|
---|
336 | movbe eax, [rdi]
|
---|
337 | movbe ax, [rdi]
|
---|
338 | movbe rax, [rdi]
|
---|
339 |
|
---|
340 | crc32 eax, bl
|
---|
341 | crc32 eax, bx
|
---|
342 | crc32 eax, ebx
|
---|
343 | crc32 eax, byte [edi]
|
---|
344 | crc32 eax, word [edi]
|
---|
345 | crc32 eax, dword [edi]
|
---|
346 |
|
---|
347 | crc32 rax, bl
|
---|
348 | crc32 rax, byte [rdi]
|
---|
349 | crc32 rax, qword [rdi]
|
---|
350 |
|
---|
351 | %if __YASM_VERSION_ID__ >= 001030000h ; Old yasm doesn't support the instructions below
|
---|
352 |
|
---|
353 | adcx eax, ebx
|
---|
354 | adcx rax, rbx
|
---|
355 | adcx r8, r11
|
---|
356 | adcx r8d, edx
|
---|
357 |
|
---|
358 | adox eax, ebx
|
---|
359 | adox eax, [edi]
|
---|
360 | adox eax, [edi + 1000h]
|
---|
361 |
|
---|
362 | adox rax, rbx
|
---|
363 | adox rax, [rdi]
|
---|
364 | adox rax, [rdi + 1000h]
|
---|
365 | adox rax, [edi + 1000h]
|
---|
366 |
|
---|
367 | tzcnt ax, bx
|
---|
368 | tzcnt eax, ebx
|
---|
369 | tzcnt rax, rbx
|
---|
370 | tzcnt ax, [edi]
|
---|
371 | tzcnt eax, [edi]
|
---|
372 | tzcnt eax, [edi + 1000h]
|
---|
373 |
|
---|
374 | vpunpcklbw ymm1, ymm2, ymm3
|
---|
375 | vpmovsxbw ymm4,[0x100]
|
---|
376 | vgatherqpd xmm0,qword [rbx+xmm11*2],xmm2
|
---|
377 | %endif
|
---|
378 |
|
---|
379 | popcnt ax, bx
|
---|
380 | popcnt eax, ebx
|
---|
381 | popcnt rax, rbx
|
---|
382 | popcnt ax, [edi]
|
---|
383 | popcnt eax, [edi]
|
---|
384 | popcnt eax, [edi + 1000h]
|
---|
385 | popcnt rax, [rdi + 1000h]
|
---|
386 |
|
---|
387 | lzcnt ax, bx
|
---|
388 | lzcnt eax, ebx
|
---|
389 | lzcnt rax, rbx
|
---|
390 | lzcnt ax, [edi]
|
---|
391 | lzcnt eax, [edi]
|
---|
392 | lzcnt eax, [edi + 1000h]
|
---|
393 | lzcnt eax, [rdi]
|
---|
394 | lzcnt ax, [rdi]
|
---|
395 | lzcnt rax, [rdi]
|
---|
396 | lzcnt r8d, [rdi]
|
---|
397 |
|
---|
398 | vmread rax, rbx
|
---|
399 | vmwrite rax, rbx
|
---|
400 |
|
---|
401 | getsec
|
---|
402 |
|
---|
403 | movd mm0, [rdi]
|
---|
404 | movq mm0, [edi]
|
---|
405 | movq mm0, mm1
|
---|
406 |
|
---|
407 | vmovups xmm0, xmm1
|
---|
408 | vmovaps ymm0, ymm1
|
---|
409 | vunpcklps xmm0, xmm1, xmm2
|
---|
410 | vunpcklps ymm0, ymm1, ymm2
|
---|
411 | vunpcklps ymm0, ymm10, ymm2
|
---|
412 |
|
---|
413 | vmovups xmm5, xmm9
|
---|
414 |
|
---|
415 | vcmpps xmm1, xmm2, xmm3, 12
|
---|
416 |
|
---|
417 | lddqu xmm1, [ebp+edi*8+00f000001h]
|
---|
418 | vlddqu xmm1, [rbp+rdi*8+00f000001h]
|
---|
419 | vlddqu ymm1, [rbp+rdi*8+00f000001h]
|
---|
420 |
|
---|
421 | vbroadcastf128 ymm0,oword [0x100]
|
---|
422 | vmovlps xmm0, xmm1, [100h]
|
---|
423 | vmovlps xmm0, xmm1, [eax + ebx]
|
---|
424 | vmovlps xmm0, xmm1, [rax + rbx]
|
---|
425 | vmovlps xmm10, xmm1, [rax]
|
---|
426 |
|
---|
427 | vblendvpd xmm0, xmm1, [100h], xmm3
|
---|
428 |
|
---|
429 | dpps xmm0, xmm1, 1
|
---|
430 |
|
---|
431 | extractps eax, xmm2, 3
|
---|
432 | vzeroupper
|
---|
433 | vzeroall
|
---|
434 |
|
---|
435 | movlps xmm0, [100h]
|
---|
436 | movlps xmm0, [eax + ebx]
|
---|
437 | movlps xmm10, [rax + rbx]
|
---|
438 | movhlps xmm0, xmm1
|
---|
439 |
|
---|
440 | blsr eax, ebx
|
---|
441 | blsr rax, rbx
|
---|
442 | blsi eax, [rbx]
|
---|
443 | blsi rax, [rbx]
|
---|
444 | db 0c4h, 0e2h, 0f8h | 4, 0f3h, 01bh ; blsi rax, [rbx] with VEX.L=1 - should be invalid
|
---|
445 | blsmsk eax, [rbx+rdi*2]
|
---|
446 | blsmsk rax, [rbx+rdi*2]
|
---|
447 | blsmsk r8, [rbx+rdi*2]
|
---|
448 |
|
---|
449 | shlx eax, ebx, ecx
|
---|
450 | shlx r8, rax, r15
|
---|
451 |
|
---|
452 | pmovmskb eax, mm2
|
---|
453 | pmovmskb r9, mm2
|
---|
454 | pmovmskb eax, xmm3
|
---|
455 | pmovmskb r10, xmm3
|
---|
456 | vpmovmskb eax, xmm3
|
---|
457 | vpmovmskb rax, xmm3
|
---|
458 | vpmovmskb r11, ymm9
|
---|
459 |
|
---|
460 | ret
|
---|
461 | ENDPROC TestProc64
|
---|
462 | %endif ; !OS2
|
---|
463 |
|
---|