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