History

asm test

bellard committed 23 years ago

Commit 0da36131 parent 65092b71 file · +541 −0Browse files

Unified · Split

asmtest.S+541−0
@@ -0,0 +1,541 @@
1
2/* some directive tests */
3
4 .byte 0xff
5 .byte 1, 2, 3
6 .short 1, 2, 3
7 .word 1, 2, 3
8 .long 1, 2, 3
9 .int 1, 2, 3
10 .align 8
11 .byte 1
12 .align 16, 0x90
13 .skip 3
14 .skip 15, 0x90
15
16/* some label tests */
17
18 movl %eax, %ebx
19L1:
20 movl %eax, %ebx
21 mov 0x10000, %eax
22L2:
23 movl $L2 - L1, %ecx
24var1:
25 nop ; nop ; nop ; nop
26
27 mov var1, %eax
28
29/* instruction tests */
30movl %eax, %ebx
31mov 0x10000, %eax
32mov 0x10000, %ax
33mov 0x10000, %al
34mov %al, 0x10000
35
36mov $1, %edx
37mov $1, %dx
38mov $1, %dl
39movb $2, 0x100(%ebx,%edx,2)
40movw $2, 0x100(%ebx,%edx,2)
41movl $2, 0x100(%ebx,%edx,2)
42movl %eax, 0x100(%ebx,%edx,2)
43movl 0x100(%ebx,%edx,2), %edx
44movw %ax, 0x100(%ebx,%edx,2)
45
46mov %cr3, %edx
47mov %ecx, %cr3
48movl %cr3, %eax
49movl %tr3, %eax
50movl %db3, %ebx
51movl %dr6, %eax
52movl %fs, %ecx
53movl %ebx, %fs
54
55 movsbl 0x1000, %eax
56 movsbw 0x1000, %ax
57 movswl 0x1000, %eax
58
59 movzbl 0x1000, %eax
60 movzbw 0x1000, %ax
61 movzwl 0x1000, %eax
62
63 movzb 0x1000, %eax
64 movzb 0x1000, %ax
65
66
67 pushl %eax
68 pushw %ax
69 push %eax
70 push %cs
71 push %gs
72 push $1
73 push $100
74
75 popl %eax
76 popw %ax
77 pop %eax
78 pop %ds
79 pop %fs
80
81 xchg %eax, %ecx
82 xchg %edx, %eax
83 xchg %bx, 0x10000
84 xchg 0x10000, %ebx
85 xchg 0x10000, %dl
86
87 in $100, %al
88 in $100, %ax
89 in $100, %eax
90 in %dx, %al
91 in %dx, %ax
92 in %dx, %eax
93 inb %dx
94 inw %dx
95 inl %dx
96
97 out %al, $100
98 out %ax, $100
99 out %eax, $100
100
101 /* NOTE: gas is bugged here, so size must be added */
102 outb %al, %dx
103 outw %ax, %dx
104 outl %eax, %dx
105
106 leal 0x1000(%ebx), %ecx
107 lea 0x1000(%ebx), %ecx
108
109 les 0x2000, %eax
110 lds 0x2000, %ebx
111 lfs 0x2000, %ecx
112 lgs 0x2000, %edx
113 lss 0x2000, %edx
114
115addl $0x123, %eax
116add $0x123, %ebx
117addl $0x123, 0x100
118addl $0x123, 0x100(%ebx)
119addl $0x123, 0x100(%ebx,%edx,2)
120addl $0x123, 0x100(%esp)
121addl $0x123, (%ebp)
122addl $0x123, (%esp)
123cmpl $0x123, (%esp)
124
125add %eax, (%ebx)
126add (%ebx), %eax
127
128or %dx, (%ebx)
129or (%ebx), %si
130
131add %cl, (%ebx)
132add (%ebx), %dl
133
134 inc %edx
135 incl 0x10000
136 incb 0x10000
137 dec %dx
138
139 test $1, %al
140 test $1, %cl
141
142 testl $1, 0x1000
143 testb $1, 0x1000
144 testw $1, 0x1000
145 test %eax, %ebx
146 test %eax, 0x1000
147 test 0x1000, %edx
148
149 not %edx
150 notw 0x10000
151 notl 0x10000
152 notb 0x10000
153
154 neg %edx
155 negw 0x10000
156 negl 0x10000
157 negb 0x10000
158
159 imul %ecx
160 mul %edx
161 mulb %cl
162
163 imul %eax, %ecx
164 imul 0x1000, %cx
165 imul $10, %eax, %ecx
166 imul $10, %ax, %cx
167 imul $10, %eax
168 imul $0x1100000, %eax
169 imul $1, %eax
170
171 idivw 0x1000
172 div %ecx
173 div %bl
174 div %ecx, %eax
175
176
177shl %edx
178shl $10, %edx
179shl %cl, %edx
180
181shld $1, %eax, %edx
182shld %cl, %eax, %edx
183shld %eax, %edx
184
185shrd $1, %eax, %edx
186shrd %cl, %eax, %edx
187shrd %eax, %edx
188
189L4:
190call 0x1000
191call L4
192call *%eax
193call *0x1000
194call func1
195
196lcall $0x100, $0x1000
197
198jmp 0x1000
199jmp *%eax
200jmp *0x1000
201
202ljmp $0x100, $0x1000
203
204ret
205
206ret $10
207
208lret
209
210lret $10
211
212enter $1234, $10
213
214L3:
215 jo 0x1000
216 jnp 0x1001
217 jne 0x1002
218 jg 0x1003
219
220 jo L3
221 jnp L3
222 jne L3
223 jg L3
224
225 loopne L3
226 loopnz L3
227 loope L3
228 loopz L3
229 loop L3
230 jecxz L3
231
232
233 seto %al
234 setnp 0x1000
235 setl 0xaaaa
236 setg %dl
237
238 fadd
239 fadd %st(1), %st
240 fadd %st(3)
241
242 faddp %st(5)
243 faddp
244 faddp %st(1), %st
245
246 fadds 0x1000
247 fiadds 0x1002
248 faddl 0x1004
249 fiaddl 0x1006
250
251 fmul
252 fmul %st(1), %st
253 fmul %st(3)
254
255 fmulp %st(5)
256 fmulp
257 fmulp %st(1), %st
258
259 fmuls 0x1000
260 fimuls 0x1002
261 fmull 0x1004
262 fimull 0x1006
263
264 fsub
265 fsub %st(1), %st
266 fsub %st(3)
267
268 fsubp %st(5)
269 fsubp
270 fsubp %st(1), %st
271
272 fsubs 0x1000
273 fisubs 0x1002
274 fsubl 0x1004
275 fisubl 0x1006
276
277 fsubr
278 fsubr %st(1), %st
279 fsubr %st(3)
280
281 fsubrp %st(5)
282 fsubrp
283 fsubrp %st(1), %st
284
285 fsubrs 0x1000
286 fisubrs 0x1002
287 fsubrl 0x1004
288 fisubrl 0x1006
289
290 fdiv
291 fdiv %st(1), %st
292 fdiv %st(3)
293
294 fdivp %st(5)
295 fdivp
296 fdivp %st(1), %st
297
298 fdivs 0x1000
299 fidivs 0x1002
300 fdivl 0x1004
301 fidivl 0x1006
302
303 fcom %st(3)
304
305 fcoms 0x1000
306 ficoms 0x1002
307 fcoml 0x1004
308 ficoml 0x1006
309
310 fcomp %st(5)
311 fcomp
312 fcompp
313
314 fcomps 0x1000
315 ficomps 0x1002
316 fcompl 0x1004
317 ficompl 0x1006
318
319 fld %st(5)
320 fldl 0x1000
321 flds 0x1002
322 fildl 0x1004
323 fst %st(4)
324 fstp %st(6)
325 fstpt 0x1006
326 fbstp 0x1008
327
328 fxch
329 fxch %st(4)
330
331 fucom %st(6)
332 fucomp %st(3)
333 fucompp
334
335 finit
336 fninit
337 fldcw 0x1000
338 fnstcw 0x1002
339 fstcw 0x1002
340 fnstsw 0x1004
341 fnstsw %eax
342 fstsw 0x1004
343 fstsw %eax
344 fnclex
345 fclex
346 fnstenv 0x1000
347 fstenv 0x1000
348 fldenv 0x1000
349 fnsave 0x1002
350 fsave 0x1000
351 frstor 0x1000
352 ffree %st(7)
353 ffreep %st(6)
354
355 ftst
356 fxam
357 fld1
358 fldl2t
359 fldl2e
360 fldpi
361 fldlg2
362 fldln2
363 fldz
364
365 f2xm1
366 fyl2x
367 fptan
368 fpatan
369 fxtract
370 fprem1
371 fdecstp
372 fincstp
373 fprem
374 fyl2xp1
375 fsqrt
376 fsincos
377 frndint
378 fscale
379 fsin
380 fcos
381 fchs
382 fabs
383 fnop
384 fwait
385
386bswap %edx
387xadd %ecx, %edx
388xaddb %dl, 0x1000
389xaddw %ax, 0x1000
390xaddl %eax, 0x1000
391cmpxchg %ecx, %edx
392cmpxchgb %dl, 0x1000
393cmpxchgw %ax, 0x1000
394cmpxchgl %eax, 0x1000
395invlpg 0x1000
396cmpxchg8b 0x1002
397
398fcmovb %st(5), %st
399fcmove %st(5), %st
400fcmovbe %st(5), %st
401fcmovu %st(5), %st
402fcmovnb %st(5), %st
403fcmovne %st(5), %st
404fcmovnbe %st(5), %st
405fcmovnu %st(5), %st
406fcomi %st(5), %st
407fucomi %st(5), %st
408fcomip %st(5), %st
409fucomip %st(5), %st
410
411
412
413 cmovo 0x1000, %eax
414 cmovs 0x1000, %eax
415 cmovns %edx, %edi
416
417int $3
418int $0x10
419
420 pusha
421 popa
422 clc
423 cld
424 cli
425 clts
426 cmc
427 lahf
428 sahf
429 pushfl
430 popfl
431 pushf
432 popf
433 stc
434 std
435 sti
436 aaa
437 aas
438 daa
439 das
440 aad
441 aam
442 cbw
443 cwd
444 cwde
445 cdq
446 cbtw
447 cwtd
448 cwtl
449 cltd
450 leave
451 int3
452 into
453 iret
454 rsm
455 hlt
456 wait
457 nop
458
459 /* XXX: handle prefixes */
460#if 0
461 aword
462 addr16
463#endif
464 lock
465 rep
466 repe
467 repz
468 repne
469 repnz
470
471 invd
472 wbinvd
473 cpuid
474 wrmsr
475 rdtsc
476 rdmsr
477 rdpmc
478 ud2
479
480 emms
481 movd %edx, %mm3
482 movd 0x1000, %mm2
483 movd %mm4, %ecx
484 movd %mm5, 0x1000
485
486 movq 0x1000, %mm2
487 movq %mm4, 0x1000
488
489 pand 0x1000, %mm3
490 pand %mm4, %mm5
491
492 psllw $1, %mm6
493 psllw 0x1000, %mm7
494 psllw %mm2, %mm7
495
496 xlat
497 cmpsb
498 scmpw
499 insl
500 outsw
501 lodsb
502 slodl
503 movsb
504 movsl
505 smovb
506 scasb
507 sscaw
508 stosw
509 sstol
510
511 bsf 0x1000, %ebx
512 bsr 0x1000, %ebx
513 bt %edx, 0x1000
514 btl $2, 0x1000
515 btc %edx, 0x1000
516 btcl $2, 0x1000
517 btr %edx, 0x1000
518 btrl $2, 0x1000
519 bts %edx, 0x1000
520 btsl $2, 0x1000
521
522 boundl %edx, 0x10000
523 boundw %bx, 0x1000
524
525 arpl %bx, 0x1000
526 lar 0x1000, %eax
527 lgdt 0x1000
528 lidt 0x1000
529 lldt 0x1000
530 lmsw 0x1000
531 lsl 0x1000, %ecx
532 ltr 0x1000
533
534 sgdt 0x1000
535 sidt 0x1000
536 sldt 0x1000
537 smsw 0x1000
538 str 0x1000
539
540 verr 0x1000
541 verw 0x1000

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t