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