Rev 1029 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
375 | Ghost | 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' |
||
3013 | dunkaist | 18 | include '../../debug.inc' |
375 | Ghost | 19 | |
398 | Ghost | 20 | START: print 'Please wait' |
21 | ; через быстрый вызов (SYSENTER) |
||
477 | Ghost | 22 | __CPU_type equ p6 |
398 | Ghost | 23 | test1: mov eax, 1 |
24 | cpuid |
||
25 | test edx, 0x800 |
||
26 | jnz .ok |
||
27 | dps 'unsupported ' |
||
28 | jmp .end |
||
29 | .ok: |
||
375 | Ghost | 30 | xor eax, eax |
31 | cpuid |
||
32 | rdtsc |
||
33 | mov [old_tsc], eax |
||
34 | mov [old_tsc + 4], edx |
||
35 | |||
398 | Ghost | 36 | mov ebx, 0x100000 |
375 | Ghost | 37 | align 32 |
1029 | serge | 38 | .nxt: ;mcall 19 ; функция пустышка |
477 | Ghost | 39 | ; портятся ecx, edx |
40 | dec ebx |
||
375 | Ghost | 41 | jnz .nxt |
42 | |||
43 | xor eax, eax |
||
44 | cpuid |
||
45 | rdtsc |
||
1029 | serge | 46 | sub eax, [old_tsc] |
47 | sbb edx, [old_tsc + 4] |
||
375 | Ghost | 48 | debug_print_hex edx |
49 | debug_print_hex eax |
||
398 | Ghost | 50 | .end: print ' <- Fast call (SYSENTER)' |
375 | Ghost | 51 | |
398 | Ghost | 52 | ;---------------------------------------------- |
53 | ; через быстрый вызов (SYSCALL) |
||
477 | Ghost | 54 | __CPU_type equ k6 |
398 | Ghost | 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 |
||
375 | Ghost | 65 | |
66 | xor eax, eax |
||
67 | cpuid |
||
68 | rdtsc |
||
69 | mov [old_tsc], eax |
||
70 | mov [old_tsc + 4], edx |
||
398 | Ghost | 71 | |
72 | mov ebx, 0x100000 |
||
375 | Ghost | 73 | align 32 |
1029 | serge | 74 | .nxt: ;mcall 19 ; функция пустышка |
398 | Ghost | 75 | |
477 | Ghost | 76 | dec ebx |
398 | Ghost | 77 | jnz .nxt |
78 | |||
79 | xor eax, eax |
||
80 | cpuid |
||
81 | rdtsc |
||
1029 | serge | 82 | |
83 | sub eax, [old_tsc] |
||
84 | sbb edx, [old_tsc + 4] |
||
398 | Ghost | 85 | debug_print_hex edx |
86 | debug_print_hex eax |
||
87 | .end: print ' <- Fast call (SYSCALL)' |
||
88 | ;---------------------------------------------- |
||
1029 | serge | 89 | ; через шлюз прерывани |
477 | Ghost | 90 | __CPU_type equ p5 |
398 | Ghost | 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 |
||
1029 | serge | 99 | .nxt: ;mcall 19 ; функция пустышка |
375 | Ghost | 100 | dec ebx |
101 | jnz .nxt |
||
102 | |||
103 | xor eax, eax |
||
104 | cpuid |
||
105 | rdtsc |
||
1029 | serge | 106 | |
107 | sub eax, [old_tsc] |
||
108 | sbb edx, [old_tsc + 4] |
||
375 | Ghost | 109 | debug_print_hex edx |
110 | debug_print_hex eax |
||
111 | print ' <- Interrupt' |
||
112 | |||
477 | Ghost | 113 | mcall -1 |
375 | Ghost | 114 | ;--------------------------------------------- |
115 | old_tsc: dd 0, 0 |
||
3013 | dunkaist | 116 | I_END:->->-> |