Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  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.  setc %al
  248.  setcb %al
  249.  setnp 0x1000
  250.  setl 0xaaaa
  251.  setg %dl
  252.  
  253.  fadd
  254.  fadd %st(1), %st
  255.  fadd %st(0), %st(1)
  256.  fadd %st(3)
  257.  
  258.  fmul %st(0),%st(0)
  259.  fmul %st(0),%st(1)
  260.  
  261.  faddp %st(5)
  262.  faddp
  263.  faddp %st(1), %st
  264.  
  265.  fadds 0x1000
  266.  fiadds 0x1002
  267.  faddl 0x1004
  268.  fiaddl 0x1006
  269.  
  270.  fmul
  271.  fmul %st(1), %st
  272.  fmul %st(3)
  273.  
  274.  fmulp %st(5)
  275.  fmulp
  276.  fmulp %st(1), %st
  277.  
  278.  fmuls 0x1000
  279.  fimuls 0x1002
  280.  fmull 0x1004
  281.  fimull 0x1006
  282.  
  283.  fsub
  284.  fsub %st(1), %st
  285.  fsub %st(3)
  286.  
  287.  fsubp %st(5)
  288.  fsubp
  289.  fsubp %st(1), %st
  290.  
  291.  fsubs 0x1000
  292.  fisubs 0x1002
  293.  fsubl 0x1004
  294.  fisubl 0x1006
  295.  
  296.  fsubr
  297.  fsubr %st(1), %st
  298.  fsubr %st(3)
  299.  
  300.  fsubrp %st(5)
  301.  fsubrp
  302.  fsubrp %st(1), %st
  303.  
  304.  fsubrs 0x1000
  305.  fisubrs 0x1002
  306.  fsubrl 0x1004
  307.  fisubrl 0x1006
  308.  
  309.  fdiv
  310.  fdiv %st(1), %st
  311.  fdiv %st(3)
  312.  
  313.  fdivp %st(5)
  314.  fdivp
  315.  fdivp %st(1), %st
  316.  
  317.  fdivs 0x1000
  318.  fidivs 0x1002
  319.  fdivl 0x1004
  320.  fidivl 0x1006
  321.  
  322.  fcom %st(3)
  323.  
  324.  fcoms 0x1000
  325.  ficoms 0x1002
  326.  fcoml 0x1004
  327.  ficoml 0x1006
  328.  
  329.  fcomp %st(5)
  330.  fcomp
  331.  fcompp
  332.  
  333.  fcomps 0x1000
  334.  ficomps 0x1002
  335.  fcompl 0x1004
  336.  ficompl 0x1006
  337.  
  338.  fld %st(5)
  339.  fldl 0x1000
  340.  flds 0x1002
  341.  fildl 0x1004
  342.  fst %st(4)
  343.  fstp %st(6)
  344.  fstpt 0x1006
  345.  fbstp 0x1008
  346.  
  347.  fxch
  348.  fxch %st(4)
  349.  
  350.  fucom %st(6)
  351.  fucomp %st(3)
  352.  fucompp
  353.  
  354.  finit
  355.  fninit
  356.  fldcw 0x1000
  357.  fnstcw 0x1002
  358.  fstcw 0x1002
  359.  fnstsw 0x1004
  360.  fnstsw (%eax)
  361.  fstsw 0x1004
  362.  fstsw (%eax)
  363.  fnclex
  364.  fclex
  365.  fnstenv 0x1000
  366.  fstenv 0x1000
  367.  fldenv 0x1000
  368.  fnsave 0x1002
  369.  fsave 0x1000
  370.  frstor 0x1000
  371.  ffree %st(7)
  372.  ffreep %st(6)
  373.  
  374.     ftst
  375.     fxam
  376.     fld1
  377.     fldl2t
  378.     fldl2e
  379.     fldpi
  380.     fldlg2
  381.     fldln2
  382.     fldz
  383.  
  384.     f2xm1
  385.     fyl2x
  386.     fptan
  387.     fpatan
  388.     fxtract
  389.     fprem1
  390.     fdecstp
  391.     fincstp
  392.     fprem
  393.     fyl2xp1
  394.     fsqrt
  395.     fsincos
  396.     frndint
  397.     fscale
  398.     fsin
  399.     fcos
  400.     fchs
  401.     fabs
  402.     fnop
  403.     fwait
  404.  
  405. bswap %edx
  406. xadd %ecx, %edx
  407. xaddb %dl, 0x1000
  408. xaddw %ax, 0x1000
  409. xaddl %eax, 0x1000
  410. cmpxchg %ecx, %edx
  411. cmpxchgb %dl, 0x1000
  412. cmpxchgw %ax, 0x1000
  413. cmpxchgl %eax, 0x1000
  414. invlpg 0x1000
  415. cmpxchg8b 0x1002
  416.  
  417. fcmovb %st(5), %st
  418. fcmove %st(5), %st
  419. fcmovbe %st(5), %st
  420. fcmovu %st(5), %st
  421. fcmovnb %st(5), %st
  422. fcmovne %st(5), %st
  423. fcmovnbe %st(5), %st
  424. fcmovnu %st(5), %st
  425. fcomi %st(5), %st
  426. fucomi %st(5), %st
  427. fcomip %st(5), %st
  428. fucomip %st(5), %st
  429.  
  430.  
  431.  
  432.  cmovo 0x1000, %eax
  433.  cmovs 0x1000, %eax
  434.  cmovns %edx, %edi
  435.  
  436. int $3
  437. int $0x10
  438.  
  439.     pusha
  440.     popa
  441.     clc
  442.     cld
  443.     cli
  444.     clts
  445.     cmc
  446.     lahf
  447.     sahf
  448.     pushfl
  449.     popfl
  450.     pushf
  451.     popf
  452.     stc
  453.     std
  454.     sti
  455.     aaa
  456.     aas
  457.     daa
  458.     das
  459.     aad
  460.     aam
  461.     cbw
  462.     cwd
  463.     cwde
  464.     cdq
  465.     cbtw
  466.     cwtd
  467.     cwtl
  468.     cltd
  469.     leave
  470.     int3
  471.     into
  472.     iret
  473.     rsm
  474.     hlt
  475.     wait
  476.     nop
  477.  
  478.     /* XXX: handle prefixes */
  479. #if 0
  480.     aword
  481.     addr16
  482. #endif
  483.     lock
  484.     rep
  485.     repe
  486.     repz
  487.     repne
  488.     repnz
  489.     nop
  490.  
  491.     lock ;negl (%eax)
  492.     wait ;pushf
  493.     rep  ;stosb
  494.     repe ;lodsb
  495.     repz ;cmpsb
  496.     repne;movsb
  497.     repnz;outsb
  498.  
  499.     /* handle one-line prefix + ops */
  500.     lock  negl (%eax)
  501.     wait  pushf
  502.     rep   stosb
  503.     repe  lodsb
  504.     repz  cmpsb
  505.     repne movsb
  506.     repnz outsb
  507.    
  508.     invd
  509.     wbinvd
  510.     cpuid
  511.     wrmsr
  512.     rdtsc
  513.     rdmsr
  514.     rdpmc
  515.     ud2
  516.  
  517.     emms
  518.     movd %edx, %mm3
  519.     movd 0x1000, %mm2
  520.     movd %mm4, %ecx
  521.     movd %mm5, 0x1000
  522.                    
  523.     movq 0x1000, %mm2
  524.     movq %mm4, 0x1000
  525.    
  526.     pand 0x1000, %mm3
  527.     pand %mm4, %mm5
  528.    
  529.     psllw $1, %mm6
  530.     psllw 0x1000, %mm7
  531.     psllw %mm2, %mm7
  532.  
  533.     xlat
  534.     cmpsb
  535.     scmpw
  536.     insl
  537.     outsw
  538.     lodsb
  539.     slodl
  540.     movsb
  541.     movsl
  542.     smovb
  543.     scasb
  544.     sscaw
  545.     stosw
  546.     sstol
  547.  
  548.     bsf 0x1000, %ebx
  549.     bsr 0x1000, %ebx
  550.     bt %edx, 0x1000
  551.     btl $2, 0x1000
  552.     btc %edx, 0x1000
  553.     btcl $2, 0x1000
  554.     btr %edx, 0x1000
  555.     btrl $2, 0x1000
  556.     bts %edx, 0x1000
  557.     btsl $2, 0x1000
  558.  
  559.        
  560.        
  561.     boundl %edx, 0x10000
  562.     boundw %bx, 0x1000
  563.    
  564.     arpl %bx, 0x1000
  565.     lar 0x1000, %eax
  566.     lgdt 0x1000
  567.     lidt 0x1000
  568.     lldt 0x1000
  569.     lmsw 0x1000
  570.     lsl 0x1000, %ecx
  571.     ltr 0x1000
  572.    
  573.     sgdt 0x1000
  574.     sidt 0x1000
  575.     sldt 0x1000
  576.     smsw 0x1000
  577.     str 0x1000
  578.    
  579.     verr 0x1000
  580.     verw 0x1000
  581.  
  582.     push %ds
  583.     pushw %ds
  584.     pushl %ds
  585.     pop %ds
  586.     popw %ds
  587.     popl %ds
  588.     fxsave 1(%ebx)
  589.     fxrstor 1(%ecx)
  590.     pushl $1
  591.     pushw $1
  592.     push $1
  593.  
  594. #ifdef __ASSEMBLER__ // should be defined, for S files
  595.     inc %eax
  596. #endif
  597.  
  598. ft1: ft2: ft3: ft4: ft5: ft6: ft7: ft8: ft9:
  599.     xor %eax, %eax
  600.     ret
  601.  
  602. .type ft1,STT_FUNC
  603. .type ft2,@STT_FUNC
  604. .type ft3,%STT_FUNC
  605. .type ft4,"STT_FUNC"
  606. .type ft5,function
  607. .type ft6,@function
  608. .type ft7,%function
  609. .type ft8,"function"
  610.  
  611.     pause
  612.