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