VirtualBox

source: vbox/trunk/src/VBox/Disassembler/testcase/tstAsmLock-2.asm@ 9098

Last change on this file since 9098 was 8980, checked in by vboxsync, 16 years ago

doc.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 13.3 KB
Line 
1; $Id: tstAsmLock-2.asm 8980 2008-05-20 19:50:06Z vboxsync $
2;; @file
3; Disassembly testcase - Invalid invariants.
4;
5; The intention is to check in a binary using the --all-invalid mode
6; of tstDisasm-2.
7;
8; There are some regX, reg/memX variations that aren't tested as
9; they would require db'ing out the instructions (12 /r and 13 /r
10; for instance).
11;
12
13;
14; Copyright (C) 2008 Sun Microsystems, Inc.
15;
16; This file is part of VirtualBox Open Source Edition (OSE), as
17; available from http://www.virtualbox.org. This file is free software;
18; you can redistribute it and/or modify it under the terms of the GNU
19; General Public License (GPL) as published by the Free Software
20; Foundation, in version 2 as it comes in the "COPYING" file of the
21; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
22; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
23;
24; Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
25; Clara, CA 95054 USA or visit http://www.sun.com if you need
26; additional information or have any questions.
27;
28
29%include "tstAsm.mac"
30%if TEST_BITS == 64
31; The disassembler doesn't do imm32 right for 64-bit stuff, so disable it for now.
32; %define WITH_64_BIT_TESTS_IMM32
33 %define WITH_64_BIT_TESTS
34%endif
35
36 BITS TEST_BITS
37
38 ;
39 ; ADC
40 ;
41 ; 14 ib ADC AL, imm8
42 lock adc al, byte 8
43 ; 15 i[wd] ADC [ER]AX, immX
44 lock adc ax, word 16
45 lock adc eax, dword 128
46%ifdef WITH_64_BIT_TESTS_IMM32
47 lock adc rax, dword 256
48 lock adc rax, dword 0cc90cc90h
49%endif
50 ; 80 /2 ib ADC reg/mem8, imm8 - with reg dst
51 lock adc cl, byte 8
52 ; 81 /2 i[wd] ADC reg/memX, immX - with reg dst
53 lock adc cx, word 1000h
54 lock adc ecx, dword 100000h
55%ifdef WITH_64_BIT_TESTS_IMM32
56 lock adc rcx, dword 100000h
57%endif
58 ; 83 /2 ib ADC reg/memX, imm8 - with reg dst
59 lock adc cx, byte 07fh
60 lock adc ecx, byte 07fh
61%ifdef WITH_64_BIT_TESTS_IMM32
62 lock adc rcx, byte 07fh
63%endif
64
65 ; 10 /r ADC reg/mem8, reg8 - with reg dst
66 lock adc cl, bl
67 ; 11 /r ADC reg/memX, regX - with reg dst
68 lock adc cx, bx
69 lock adc ecx, ebx
70%ifdef WITH_64_BIT_TESTS
71 lock adc rcx, rbx
72%endif
73 ; 12 /r ADC reg8, reg/mem8
74 lock adc cl, [0badh]
75 ; 13 /r ADC regX, reg/memX
76 lock adc cx, [0badh]
77 lock adc ecx, [0badh]
78%ifdef WITH_64_BIT_TESTS
79 lock adc rcx, [0badh]
80%endif
81
82 ;
83 ; ADD
84 ;
85 ; 04 ib ADD AL, imm8
86 lock add al, byte 8
87 ; 05 i[wd] ADD [ER]AX, immX
88 lock add ax, word 16
89 lock add eax, dword 128
90%ifdef WITH_64_BIT_TESTS_IMM32
91 lock add rax, dword 256
92 lock add rax, dword 0cc90cc90h
93%endif
94 ; 80 /0 ib ADD reg/mem8, imm8 - with reg dst
95 lock add cl, byte 8
96 ; 81 /0 i[wd] ADD reg/memX, immX - with reg dst
97 lock add cx, word 1000h
98 lock add ecx, dword 100000h
99%ifdef WITH_64_BIT_TESTS_IMM32
100 lock add rcx, dword 100000h
101%endif
102 ; 83 /0 ib ADD reg/memX, imm8 - with reg dst
103 lock add cx, byte 07fh
104 lock add ecx, byte 07fh
105%ifdef WITH_64_BIT_TESTS
106 lock add rcx, byte 07fh
107%endif
108
109 ; 00 /r ADD reg/mem8, reg8 - with reg dst
110 lock add cl, bl
111 ; 01 /r ADD reg/memX, regX - with reg dst
112 lock add cx, bx
113 lock add ecx, ebx
114%ifdef WITH_64_BIT_TESTS
115 lock add rcx, rbx
116%endif
117 ; 02 /r ADD reg8, reg/mem8
118 lock add cl, [0badh]
119 ; 03 /r ADD regX, reg/memX
120 lock add cx, [0badh]
121 lock add ecx, [0badh]
122%ifdef WITH_64_BIT_TESTS
123 lock add rcx, [0badh]
124%endif
125
126 ;
127 ; AND
128 ;
129 ; 24 ib AND AL, imm8
130 lock and al, byte 8
131 ; 25 i[wd] AND [ER]AX, immX
132 lock and ax, word 16
133 lock and eax, dword 128
134%ifdef WITH_64_BIT_TESTS_IMM32
135 lock and rax, dword 256
136 lock and rax, dword 0cc90cc90h
137%endif
138 ; 80 /4 ib AND reg/mem8, imm8 - with reg dst
139 lock and cl, byte 8
140 ; 81 /4 i[wd] AND reg/memX, immX - with reg dst
141 lock and cx, word 1000h
142 lock and ecx, dword 100000h
143%ifdef WITH_64_BIT_TESTS_IMM32
144 lock and rcx, dword 100000h
145%endif
146 ; 83 /4 ib AND reg/memX, imm8 - with reg dst
147 lock and cx, byte 07fh
148 lock and ecx, byte 07fh
149%ifdef WITH_64_BIT_TESTS
150 lock and rcx, byte 07fh
151%endif
152
153 ; 20 /r AND reg/mem8, reg8 - with reg dst
154 lock and cl, bl
155 ; 21 /r AND reg/memX, regX - with reg dst
156 lock and cx, bx
157 lock and ecx, ebx
158%ifdef WITH_64_BIT_TESTS
159 lock and rcx, rbx
160%endif
161 ; 22 /r AND reg8, reg/mem8
162 lock and cl, [0badh]
163 ; 23 /r AND regX, reg/memX
164 lock and cx, [0badh]
165 lock and ecx, [0badh]
166%ifdef WITH_64_BIT_TESTS
167 lock and rcx, [0badh]
168%endif
169
170 ;
171 ; BTC
172 ;
173 ; 0f bb /r BTC reg/memX, regX (X != 8) - with reg dst
174 lock btc cx, bx
175 lock btc ecx, ebx
176%ifdef WITH_64_BIT_TESTS
177 lock btc rcx, rbx
178 lock btc r8, rbx
179 lock btc r10, r8
180%endif
181 ; 0f ba /7 ib BTC reg/memX, imm8 (X != 8) - with reg dst
182 lock btc cx, 15
183 lock btc ecx, 30
184%ifdef WITH_64_BIT_TESTS
185 lock btc rcx, 60
186 lock btc r8, 61
187 lock btc r10, 3
188%endif
189
190 ;
191 ; BTR
192 ;
193 ; 0f b3 /r BTR reg/memX, regX (X != 8) - with reg dst
194 lock btr cx, bx
195 lock btr ecx, ebx
196%ifdef WITH_64_BIT_TESTS
197 lock btr rcx, rbx
198 lock btr r8, rbx
199 lock btr r10, r8
200%endif
201 ; 0f ba /6 ib BTR reg/memX, imm8 (X != 8) - with reg dst
202 lock btr cx, 15
203 lock btr ecx, 30
204%ifdef WITH_64_BIT_TESTS
205 lock btr rcx, 60
206 lock btr r8, 61
207 lock btr r10, 3
208%endif
209
210 ;
211 ; BTS
212 ;
213 ; 0f ab /r BTS reg/memX, regX (X != 8) - with reg dst
214 lock bts cx, bx
215 lock bts ecx, ebx
216%ifdef WITH_64_BIT_TESTS
217 lock bts rcx, rbx
218 lock bts r8, rbx
219 lock bts r10, r8
220%endif
221 ; 0f ba /5 ib BTS reg/memX, imm8 (X != 8) - with reg dst
222 lock bts cx, 15
223 lock bts ecx, 30
224%ifdef WITH_64_BIT_TESTS
225 lock bts rcx, 60
226 lock bts r8, 61
227 lock bts r10, 3
228%endif
229
230 ;
231 ; CMPXCHG
232 ;
233 ; 0f b0 /r CMPXCHG reg8/mem8, regX - with reg dst
234 lock cmpxchg bl, cl
235 ; 0f b1 /r CMPXCHG regX/memX, regX - with reg dst
236 lock cmpxchg bx, cx
237 lock cmpxchg ebx, ecx
238%ifdef WITH_64_BIT_TESTS
239 lock cmpxchg rbx, rcx
240%endif
241
242 ;
243 ; CMPXCHG8B
244 ; CMPXCHG16B
245 ;
246 ; all valid.
247
248 ;
249 ; DEC
250 ;
251 ; fe /1 DEC reg8/mem8 - with reg dst
252 lock dec bl
253 ; ff /1 DEC regX/memX - with reg dst
254
255%if TEST_BITS != 64 ; cannot force these two in 32 and 16 bit mode.
256 db 066h, 0f0h, 0ffh, 0cbh
257 db 0f0h, 0ffh, 0cbh
258%else
259 lock dec bx
260 lock dec ebx
261 %ifdef WITH_64_BIT_TESTS
262 lock dec rbx
263 lock dec r8
264 lock dec r14
265 %endif
266%endif
267%if TEST_BITS != 64
268 ; 48 +rw DEC reg16
269 lock dec dx
270 ; 48 +rd DEC reg32
271 lock dec edx
272%endif
273
274 ;
275 ; INC
276 ;
277 ; fe /1 INC reg8/mem8 - with reg dst
278 lock inc bl
279 ; ff /1 INC regX/memX - with reg dst
280
281%if TEST_BITS != 64 ; cannot force these two in 32 and 16 bit mode.
282 db 066h, 0f0h, 0ffh, 0c3h
283 db 0f0h, 0ffh, 0c3h
284%else
285 lock inc bx
286 lock inc ebx
287 %ifdef WITH_64_BIT_TESTS
288 lock inc rbx
289 lock inc r8
290 lock inc r14
291 %endif
292%endif
293%if TEST_BITS != 64
294 ; 48 +rw INC reg16
295 lock inc dx
296 ; 48 +rd INC reg32
297 lock inc edx
298%endif
299
300 ;
301 ; NEG
302 ;
303 ; f6 /3 NEG reg8/mem8 - with reg dst
304 lock neg bl
305 ; f7 /3 NEG regX/memX - with reg dst
306 lock neg bx
307 lock neg ebx
308%ifdef WITH_64_BIT_TESTS
309 lock neg rbx
310 lock neg r8
311 lock neg r14
312%endif
313
314 ;
315 ; NOT
316 ;
317 ; f6 /2 NOT reg8/mem8 - with reg dst
318 lock not bl
319 ; f7 /2 NOT regX/memX - with reg dst
320 lock not bx
321 lock not ebx
322%ifdef WITH_64_BIT_TESTS
323 lock not rbx
324 lock not r8
325 lock not r14
326%endif
327
328 ;
329 ; OR
330 ;
331 ; 0C ib OR AL, imm8
332 lock or al, byte 8
333 ; 0D i[wd] OR [ER]AX, immX
334 lock or ax, word 16
335 lock or eax, dword 128
336%ifdef WITH_64_BIT_TESTS_IMM32
337 lock or rax, dword 256
338 lock or rax, dword 0cc90cc90h
339%endif
340 ; 80 /1 ib OR reg/mem8, imm8 - with reg dst
341 lock or cl, byte 8
342 ; 81 /1 i[wd] OR reg/memX, immX - with reg dst
343 lock or cx, word 1000h
344 lock or ecx, dword 100000h
345%ifdef WITH_64_BIT_TESTS_IMM32
346 lock or rcx, dword 100000h
347%endif
348 ; 83 /1 ib OR reg/memX, imm8 - with reg dst
349 lock or cx, byte 07fh
350 lock or ecx, byte 07fh
351%ifdef WITH_64_BIT_TESTS_IMM32
352 lock or rcx, byte 07fh
353%endif
354 ; 08 /r OR reg/mem8, reg8 - with reg dst
355 lock or cl, bl
356 ; 09 /r OR reg/memX, regX - with reg dst
357 lock or cx, bx
358 lock or ecx, ebx
359%ifdef WITH_64_BIT_TESTS
360 lock or rcx, rbx
361%endif
362 ; 0A /r OR reg8, reg/mem8
363 lock or cl, [0badh]
364 ; 0B /r OR regX, reg/memX
365 lock or cx, [0badh]
366 lock or ecx, [0badh]
367%ifdef WITH_64_BIT_TESTS
368 lock or rcx, [0badh]
369%endif
370
371 ;
372 ; SBB
373 ;
374 ; 1C ib SBB AL, imm8
375 lock sbb al, byte 8
376 ; 1D i[wd] SBB [ER]AX, immX
377 lock sbb ax, word 16
378 lock sbb eax, dword 128
379%ifdef WITH_64_BIT_TESTS_IMM32
380 lock sbb rax, dword 256
381 lock sbb rax, dword 0cc90cc90h
382%endif
383 ; 80 /3 ib SBB reg/mem8, imm8 - with reg dst
384 lock sbb cl, byte 8
385 ; 81 /3 i[wd] SBB reg/memX, immX - with reg dst
386 lock sbb cx, word 1000h
387 lock sbb ecx, dword 100000h
388%ifdef WITH_64_BIT_TESTS_IMM32
389 lock sbb rcx, dword 100000h
390%endif
391 ; 83 /3 ib SBB reg/memX, imm8 - with reg dst
392 lock sbb cx, byte 07fh
393 lock sbb ecx, byte 07fh
394%ifdef WITH_64_BIT_TESTS_IMM32
395 lock sbb rcx, byte 07fh
396%endif
397 ; 18 /r SBB reg/mem8, reg8 - with reg dst
398 lock sbb cl, bl
399 ; 19 /r SBB reg/memX, regX - with reg dst
400 lock sbb cx, bx
401 lock sbb ecx, ebx
402%ifdef WITH_64_BIT_TESTS
403 lock sbb rcx, rbx
404%endif
405 ; 1A /r SBB reg8, reg/mem8
406 lock sbb cl, [0badh]
407 ; 1B /r SBB regX, reg/memX
408 lock sbb cx, [0badh]
409 lock sbb ecx, [0badh]
410%ifdef WITH_64_BIT_TESTS
411 lock sbb rcx, [0badh]
412%endif
413
414 ;
415 ; SUB
416 ;
417 ; 2C ib SUB AL, imm8
418 lock sub al, byte 8
419 ; 2D i[wd] SUB [ER]AX, immX
420 lock sub ax, word 16
421 lock sub eax, dword 128
422%ifdef WITH_64_BIT_TESTS_IMM32
423 lock sub rax, dword 256
424 lock sub rax, dword 0cc90cc90h
425%endif
426 ; 80 /5 ib SUB reg/mem8, imm8 - with reg dst
427 lock sub cl, byte 8
428 ; 81 /5 i[wd] SUB reg/memX, immX - with reg dst
429 lock sub cx, word 1000h
430 lock sub ecx, dword 100000h
431%ifdef WITH_64_BIT_TESTS_IMM32
432 lock sub rcx, dword 100000h
433%endif
434 ; 83 /5 ib SUB reg/memX, imm8 - with reg dst
435 lock sub cx, byte 07fh
436 lock sub ecx, byte 07fh
437%ifdef WITH_64_BIT_TESTS_IMM32
438 lock sub rcx, byte 07fh
439%endif
440 ; 28 /r SUB reg/mem8, reg8 - with reg dst
441 lock sub cl, bl
442 ; 29 /r SUB reg/memX, regX - with reg dst
443 lock sub cx, bx
444 lock sub ecx, ebx
445%ifdef WITH_64_BIT_TESTS
446 lock sub rcx, rbx
447%endif
448 ; 2A /r SUB reg8, reg/mem8
449 lock sub cl, [0badh]
450 ; 2B /r SUB regX, reg/memX
451 lock sub cx, [0badh]
452 lock sub ecx, [0badh]
453%ifdef WITH_64_BIT_TESTS
454 lock sub rcx, [0badh]
455%endif
456
457 ;
458 ; XADD
459 ;
460 ; 0f c0 /r XADD reg/mem8, reg8 - with reg dst
461 lock xadd al, bl
462 ; 0f c1 /r XADD reg/memX, immX - with reg dst
463 lock xadd cx, bx
464 lock xadd ecx, ebx
465%ifdef WITH_64_BIT_TESTS
466 lock xadd rcx, rbx
467 lock xadd r8, rbx
468 lock xadd r10, r8
469%endif
470
471 ;
472 ; XCHG
473 ;
474 ; Note: The operands can be switched around but the
475 ; encoding is the same.
476 ;
477 ; 90 +r[wdq] XCHG [RE]ax, regX
478 lock xchg ax, bx
479 lock xchg eax, ecx
480%ifdef WITH_64_BIT_TESTS
481 lock xchg rax, rcx
482 lock xchg rax, r10
483%endif
484 ; 86 /r XCHG reg/mem8, imm8 - with reg dst
485 lock xchg al, bl
486%ifdef WITH_64_BIT_TESTS
487 lock xchg r10b, cl
488 lock xchg r10b, r15b
489%endif
490 ; 87 /r XCHG reg/memX, immX - with reg dst
491 lock xchg ax, bx
492 lock xchg eax, ebx
493%ifdef WITH_64_BIT_TESTS_IMM32
494 lock xchg rax, rbx
495 lock xchg r12, rbx
496 lock xchg r14, r8
497%endif
498
499 ;
500 ; XOR
501 ;
502 ; 34 ib XOR AL, imm8
503 lock xor al, byte 8
504 ; 35 i[wd] XOR [ER]AX, immX
505 lock xor ax, word 16
506 lock xor eax, dword 128
507%ifdef WITH_64_BIT_TESTS_IMM32
508 lock xor rax, dword 256
509 lock xor rax, dword 0cc90cc90h
510%endif
511 ; 80 /6 ib XOR reg/mem8, imm8 - with reg dst
512 lock xor cl, byte 8
513 ; 81 /6 i[wd] XOR reg/memX, immX - with reg dst
514 lock xor cx, word 1000h
515 lock xor ecx, dword 100000h
516%ifdef WITH_64_BIT_TESTS_IMM32
517 lock xor rcx, dword 100000h
518%endif
519 ; 83 /6 ib XOR reg/memX, imm8 - with reg dst
520 lock xor cx, byte 07fh
521 lock xor ecx, byte 07fh
522%ifdef WITH_64_BIT_TESTS_IMM32
523 lock xor rcx, byte 07fh
524%endif
525 ; 30 /r XOR reg/mem8, reg8 - with reg dst
526 lock xor cl, bl
527 ; 31 /r XOR reg/memX, regX - with reg dst
528 lock xor cx, bx
529 lock xor ecx, ebx
530%ifdef WITH_64_BIT_TESTS
531 lock xor rcx, rbx
532%endif
533 ; 32 /r XOR reg8, reg/mem8
534 lock xor cl, [0badh]
535 ; 33 /r XOR regX, reg/memX
536 lock xor cx, [0badh]
537 lock xor ecx, [0badh]
538%ifdef WITH_64_BIT_TESTS
539 lock xor rcx, [0badh]
540%endif
541
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