VirtualBox

source: vbox/trunk/src/VBox/Disassembler/testcase/tstDisasm-1A.asm@ 53032

Last change on this file since 53032 was 53032, checked in by vboxsync, 10 years ago

DIS: #6249: Added crc32 Gy, Ew support (with word as operand 2)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.2 KB
Line 
1; $Id: tstDisasm-1A.asm 53032 2014-10-10 16:18:37Z vboxsync $
2;; @file
3; VBox disassembler: Assembler test routines
4;
5
6;
7; Copyright (C) 2006-2012 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
27BITS 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
34BEGINCODE
35
36align 16
37BEGINPROC 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%endif
165
166 movbe eax, [edi]
167 movbe ebx, [edi + 1000h]
168 movbe ax, [edi]
169 movbe [edi], eax
170
171 crc32 eax, bl
172 crc32 eax, bx
173 crc32 eax, ebx
174 crc32 eax, byte [edi]
175 crc32 eax, word [edi]
176 crc32 eax, dword [edi]
177
178 popcnt ax, bx
179 popcnt eax, ebx
180 popcnt ax, [edi]
181 popcnt eax, [edi]
182 popcnt eax, [edi + 1000h]
183
184 lzcnt ax, bx
185 lzcnt eax, ebx
186 lzcnt ax, [edi]
187 lzcnt eax, [edi]
188 lzcnt eax, [edi + 1000h]
189
190 vmread eax, ebx
191 vmwrite eax, ebx
192
193ENDPROC TestProc32
194
195
196%ifndef RT_OS_OS2
197BITS 64
198align 16
199BEGINPROC TestProc64
200 mov cr8, rax
201 mov cr8, rbx
202 mov [0xfffe0080], rax
203 mov [0xfffe0080], rbx
204 mov rax, cr8
205 mov rbx, cr8
206 mov rax, [0xfffe0080]
207 mov rbx, [0xfffe0080]
208 divsd xmm1, xmm0
209 ; invept rdi, dqword [rsi]
210 DB 0x66, 0x0F, 0x38, 0x80, 0x3E
211 ; invept rcx, dqword [rdx]
212 DB 0x66, 0x0F, 0x38, 0x80, 0xA
213 ;invvpid rdi, dqword [rsi]
214 DB 0x66, 0x0F, 0x38, 0x81, 0x3E
215 ; invvpid rcx, dqword [rdx]
216 DB 0x66, 0x0F, 0x38, 0x81, 0xA
217 mov rdi, [rsi]
218 mov rcx, [rdx]
219 db 48h
220 db 0c7h
221 db 42h
222 db 18h
223 db 20h
224 db 3eh
225 db 23h
226 db 80h
227 call qword [r8+10h]
228 ; test
229 db 48h
230 db 8bh
231 db 44h
232 db 0ah
233 db 0f8h
234 ;incorrectly assembled by yasm; REX.W should not be added!
235 ;test rax, dword 0cc90cc90h
236 db 8bh
237 db 04h
238 db 8dh
239 db 00h
240 db 00h
241 db 0feh
242 db 0ffh
243 mov qword [rcx+rdx], 0
244 mov dword [rcx+rdx], 0
245 and [r15], rax
246 movzx rcx, sil
247 and sil, 3
248 movzx ecx, ah
249 and ah, 3
250
251 sub rcx, 1234h
252 mov rax, qword [0cc90cc90h]
253 mov rax, qword [00c90cc90h]
254 mov rax, dword 0cc90cc90h
255 mov rax, qword 0ffffcc90cc90h
256
257 movzx rax,byte [edx]
258 movzx rax,word [edx]
259 movzx rax,byte [rdx]
260 lock cmpxchg [rcx], rax
261 lock cmpxchg [rcx], ax
262 lock cmpxchg [r15], dl
263 movzx RSI, word [R8]
264 in al, dx
265 in ax, dx
266 in eax, dx
267 mov rbx, [rcx + rax*4 + 17]
268 mov rbx, [rbp + rax*4 + 4]
269 mov rbx, [rbp + rax*4]
270 mov rbx, [ebp + eax*4]
271 int 80h
272 in al, 60h
273 in ax, dx
274 out 64h, eax
275
276 movss xmm0, xmm14
277 movsd xmm6, xmm1
278
279 movbe eax, [rdi]
280 movbe ax, [rdi]
281 movbe rax, [rdi]
282
283 crc32 eax, bl
284 crc32 eax, bx
285 crc32 eax, ebx
286 crc32 eax, byte [edi]
287 crc32 eax, word [edi]
288 crc32 eax, dword [edi]
289
290 crc32 rax, bl
291 crc32 rax, byte [rdi]
292 crc32 rax, qword [rdi]
293
294%if __YASM_VERSION_ID__ >= 001030000h ; Old yasm doesn't support the instructions below
295
296 adcx eax, ebx
297 adcx rax, rbx
298 adcx r8, r11
299 adcx r8d, edx
300
301 adox eax, ebx
302 adox eax, [edi]
303 adox eax, [edi + 1000h]
304
305 adox rax, rbx
306 adox rax, [rdi]
307 adox rax, [rdi + 1000h]
308 adox rax, [edi + 1000h]
309
310 tzcnt ax, bx
311 tzcnt eax, ebx
312 tzcnt rax, rbx
313 tzcnt ax, [edi]
314 tzcnt eax, [edi]
315 tzcnt eax, [edi + 1000h]
316%endif
317
318 popcnt ax, bx
319 popcnt eax, ebx
320 popcnt rax, rbx
321 popcnt ax, [edi]
322 popcnt eax, [edi]
323 popcnt eax, [edi + 1000h]
324 popcnt rax, [rdi + 1000h]
325
326 lzcnt ax, bx
327 lzcnt eax, ebx
328 lzcnt rax, rbx
329 lzcnt ax, [edi]
330 lzcnt eax, [edi]
331 lzcnt eax, [edi + 1000h]
332 lzcnt eax, [rdi]
333 lzcnt ax, [rdi]
334 lzcnt rax, [rdi]
335 lzcnt r8d, [rdi]
336
337 vmread rax, rbx
338 vmwrite rax, rbx
339
340 ret
341ENDPROC TestProc64
342%endif ; !OS2
343
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette