Subversion Repositories Kolibri OS

Rev

Rev 477 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;
  2. ; Kolibri Fast Calls test
  3. ;
  4. ;   Compile with FASM for Kolibri
  5. ;
  6. ;
  7. use32
  8. org     0x0
  9.         db    'MENUET01'
  10.         dd     0x01
  11.         dd     START
  12.         dd     I_END
  13.         dd     0x1000
  14.         dd     0x1000
  15.         dd     0x0, 0x0
  16.  
  17. include 'macros.inc'
  18. include 'debug.inc'
  19.  
  20. START:  print   'Please wait'
  21.         ; ÷åðåç áûñòðûé âûçîâ (SYSENTER)
  22.         __CPU_type      equ     p6
  23. test1:  mov     eax, 1
  24.         cpuid
  25.         test    edx, 0x800
  26.         jnz     .ok
  27.         dps     'unsupported     '
  28.         jmp     .end
  29. .ok:   
  30.         xor     eax, eax
  31.         cpuid
  32.         rdtsc
  33.         mov     [old_tsc], eax
  34.         mov     [old_tsc + 4], edx
  35.        
  36.         mov     ebx, 0x100000
  37.         align   32
  38. .nxt:  ;mcall   19              ; ôóíêöèÿ ïóñòûøêà
  39.                                 ; ïîðòÿòñÿ ecx, edx
  40.         dec     ebx
  41.         jnz     .nxt
  42.  
  43.         xor     eax, eax
  44.         cpuid
  45.         rdtsc
  46.         sub     eax, [old_tsc]
  47.         sbb     edx, [old_tsc + 4]
  48.         debug_print_hex edx
  49.         debug_print_hex eax
  50. .end:   print   ' <- Fast call (SYSENTER)'
  51.        
  52.         ;----------------------------------------------
  53.         ; ÷åðåç áûñòðûé âûçîâ (SYSCALL)
  54.         __CPU_type      equ     k6
  55. test2:  xor     eax, eax
  56.         cpuid
  57.         cmp     ecx, "cAMD"
  58.         je      .ok
  59. .nf:    dps     'unsupported     '
  60.         jmp     .end
  61. .ok:    mov     eax, 0x80000001
  62.         cpuid
  63.         test    edx, 0x800  ; bit_11 - SYSCALL/SYSRET support
  64.         jz      .nf
  65.        
  66.         xor     eax, eax
  67.         cpuid
  68.         rdtsc
  69.         mov     [old_tsc], eax
  70.         mov     [old_tsc + 4], edx
  71.        
  72.         mov     ebx, 0x100000
  73.         align   32
  74. .nxt:   ;mcall   19              ; ôóíêöèÿ ïóñòûøêà
  75.        
  76.         dec     ebx
  77.         jnz     .nxt
  78.  
  79.         xor     eax, eax
  80.         cpuid
  81.         rdtsc
  82.  
  83.         sub     eax, [old_tsc]
  84.         sbb     edx, [old_tsc + 4]
  85.         debug_print_hex edx
  86.         debug_print_hex eax
  87. .end:   print   ' <- Fast call (SYSCALL)'
  88.         ;----------------------------------------------
  89.         ; ÷åðåç øëþç ïðåðûâàíè
  90.         __CPU_type      equ     p5
  91.         xor     eax, eax
  92.         cpuid
  93.         rdtsc
  94.         mov     [old_tsc], eax
  95.         mov     [old_tsc + 4], edx
  96.        
  97. test3:  mov     ebx, 0x100000
  98.         align   32
  99. .nxt:   ;mcall   19              ; ôóíêöèÿ ïóñòûøêà
  100.         dec     ebx
  101.         jnz     .nxt
  102.        
  103.         xor     eax, eax
  104.         cpuid
  105.         rdtsc
  106.  
  107.         sub     eax, [old_tsc]
  108.         sbb     edx, [old_tsc + 4]
  109.         debug_print_hex edx
  110.         debug_print_hex eax
  111.         print   ' <- Interrupt'
  112.  
  113.         mcall -1
  114. ;---------------------------------------------
  115. old_tsc:        dd      0, 0
  116. I_END: