2007-02-25 15:20:50 +01:00
|
|
|
|
;
|
|
|
|
|
; Kolibri Fast Calls test
|
|
|
|
|
;
|
|
|
|
|
; Compile with FASM for Kolibri
|
|
|
|
|
;
|
|
|
|
|
;
|
|
|
|
|
use32
|
|
|
|
|
org 0x0
|
|
|
|
|
db 'MENUET01'
|
|
|
|
|
dd 0x01
|
|
|
|
|
dd START
|
|
|
|
|
dd I_END
|
|
|
|
|
dd 0x1000
|
|
|
|
|
dd 0x1000
|
|
|
|
|
dd 0x0, 0x0
|
|
|
|
|
|
|
|
|
|
include 'macros.inc'
|
|
|
|
|
include 'debug.inc'
|
|
|
|
|
|
2007-03-07 15:11:13 +01:00
|
|
|
|
START: print 'Please wait'
|
|
|
|
|
; <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> (SYSENTER)
|
2007-05-07 14:54:32 +02:00
|
|
|
|
__CPU_type equ p6
|
2007-03-07 15:11:13 +01:00
|
|
|
|
test1: mov eax, 1
|
|
|
|
|
cpuid
|
|
|
|
|
test edx, 0x800
|
|
|
|
|
jnz .ok
|
|
|
|
|
dps 'unsupported '
|
|
|
|
|
jmp .end
|
|
|
|
|
.ok:
|
2007-02-25 15:20:50 +01:00
|
|
|
|
xor eax, eax
|
|
|
|
|
cpuid
|
|
|
|
|
rdtsc
|
|
|
|
|
mov [old_tsc], eax
|
|
|
|
|
mov [old_tsc + 4], edx
|
|
|
|
|
|
2007-03-07 15:11:13 +01:00
|
|
|
|
mov ebx, 0x100000
|
2007-02-25 15:20:50 +01:00
|
|
|
|
align 32
|
2009-02-11 07:52:01 +01:00
|
|
|
|
.nxt: ;mcall 19 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2007-05-07 14:54:32 +02:00
|
|
|
|
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ecx, edx
|
|
|
|
|
dec ebx
|
2007-02-25 15:20:50 +01:00
|
|
|
|
jnz .nxt
|
|
|
|
|
|
|
|
|
|
xor eax, eax
|
|
|
|
|
cpuid
|
|
|
|
|
rdtsc
|
2009-02-11 07:52:01 +01:00
|
|
|
|
sub eax, [old_tsc]
|
|
|
|
|
sbb edx, [old_tsc + 4]
|
2007-02-25 15:20:50 +01:00
|
|
|
|
debug_print_hex edx
|
|
|
|
|
debug_print_hex eax
|
2007-03-07 15:11:13 +01:00
|
|
|
|
.end: print ' <- Fast call (SYSENTER)'
|
|
|
|
|
|
|
|
|
|
;----------------------------------------------
|
|
|
|
|
; <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> (SYSCALL)
|
2007-05-07 14:54:32 +02:00
|
|
|
|
__CPU_type equ k6
|
2007-03-07 15:11:13 +01:00
|
|
|
|
test2: xor eax, eax
|
|
|
|
|
cpuid
|
|
|
|
|
cmp ecx, "cAMD"
|
|
|
|
|
je .ok
|
|
|
|
|
.nf: dps 'unsupported '
|
|
|
|
|
jmp .end
|
|
|
|
|
.ok: mov eax, 0x80000001
|
|
|
|
|
cpuid
|
|
|
|
|
test edx, 0x800 ; bit_11 - SYSCALL/SYSRET support
|
|
|
|
|
jz .nf
|
2007-02-25 15:20:50 +01:00
|
|
|
|
|
2007-03-07 15:11:13 +01:00
|
|
|
|
xor eax, eax
|
|
|
|
|
cpuid
|
|
|
|
|
rdtsc
|
|
|
|
|
mov [old_tsc], eax
|
|
|
|
|
mov [old_tsc + 4], edx
|
|
|
|
|
|
|
|
|
|
mov ebx, 0x100000
|
|
|
|
|
align 32
|
2009-02-11 07:52:01 +01:00
|
|
|
|
.nxt: ;mcall 19 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2007-02-25 15:20:50 +01:00
|
|
|
|
|
2007-05-07 14:54:32 +02:00
|
|
|
|
dec ebx
|
2007-03-07 15:11:13 +01:00
|
|
|
|
jnz .nxt
|
|
|
|
|
|
|
|
|
|
xor eax, eax
|
|
|
|
|
cpuid
|
|
|
|
|
rdtsc
|
2009-02-11 07:52:01 +01:00
|
|
|
|
|
|
|
|
|
sub eax, [old_tsc]
|
|
|
|
|
sbb edx, [old_tsc + 4]
|
2007-03-07 15:11:13 +01:00
|
|
|
|
debug_print_hex edx
|
|
|
|
|
debug_print_hex eax
|
|
|
|
|
.end: print ' <- Fast call (SYSCALL)'
|
|
|
|
|
;----------------------------------------------
|
2009-02-11 07:52:01 +01:00
|
|
|
|
; <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2007-05-07 14:54:32 +02:00
|
|
|
|
__CPU_type equ p5
|
2007-02-25 15:20:50 +01:00
|
|
|
|
xor eax, eax
|
|
|
|
|
cpuid
|
|
|
|
|
rdtsc
|
|
|
|
|
mov [old_tsc], eax
|
|
|
|
|
mov [old_tsc + 4], edx
|
2007-03-07 15:11:13 +01:00
|
|
|
|
|
|
|
|
|
test3: mov ebx, 0x100000
|
2007-02-25 15:20:50 +01:00
|
|
|
|
align 32
|
2009-02-11 07:52:01 +01:00
|
|
|
|
.nxt: ;mcall 19 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2007-02-25 15:20:50 +01:00
|
|
|
|
dec ebx
|
|
|
|
|
jnz .nxt
|
|
|
|
|
|
|
|
|
|
xor eax, eax
|
|
|
|
|
cpuid
|
|
|
|
|
rdtsc
|
2009-02-11 07:52:01 +01:00
|
|
|
|
|
|
|
|
|
sub eax, [old_tsc]
|
|
|
|
|
sbb edx, [old_tsc + 4]
|
2007-02-25 15:20:50 +01:00
|
|
|
|
debug_print_hex edx
|
|
|
|
|
debug_print_hex eax
|
|
|
|
|
print ' <- Interrupt'
|
|
|
|
|
|
2007-05-07 14:54:32 +02:00
|
|
|
|
mcall -1
|
2007-02-25 15:20:50 +01:00
|
|
|
|
;---------------------------------------------
|
|
|
|
|
old_tsc: dd 0, 0
|
|
|
|
|
I_END:
|