forked from KolibriOS/kolibrios
Fast call demo program update
git-svn-id: svn://kolibrios.org@398 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
9431abc950
commit
f1bec30fb2
@ -18,23 +18,22 @@ org 0x0
|
|||||||
include 'macros.inc'
|
include 'macros.inc'
|
||||||
include 'debug.inc'
|
include 'debug.inc'
|
||||||
|
|
||||||
START:
|
START: print 'Please wait'
|
||||||
mov eax, 19 ; ôóíêöèÿ ïóñòûøêà
|
; ÷åðåç áûñòðûé âûçîâ (SYSENTER)
|
||||||
push ecx
|
test1: mov eax, 1
|
||||||
syscall
|
cpuid
|
||||||
pop ecx
|
test edx, 0x800
|
||||||
|
jnz .ok
|
||||||
|
dps 'unsupported '
|
||||||
print '! Alive !'
|
jmp .end
|
||||||
|
.ok:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
cpuid
|
cpuid
|
||||||
rdtsc
|
rdtsc
|
||||||
mov [old_tsc], eax
|
mov [old_tsc], eax
|
||||||
mov [old_tsc + 4], edx
|
mov [old_tsc + 4], edx
|
||||||
|
|
||||||
; ÷åðåç áûñòðûé âûçîâ
|
mov ebx, 0x100000
|
||||||
test1: mov ebx, 0x100000
|
|
||||||
mov dword[SYSENTER_VAR], .ret_p
|
mov dword[SYSENTER_VAR], .ret_p
|
||||||
mov [SYSENTER_VAR + 4], esp
|
mov [SYSENTER_VAR + 4], esp
|
||||||
align 32
|
align 32
|
||||||
@ -53,17 +52,57 @@ test1: mov ebx, 0x100000
|
|||||||
sub edx, [old_tsc + 4]
|
sub edx, [old_tsc + 4]
|
||||||
debug_print_hex edx
|
debug_print_hex edx
|
||||||
debug_print_hex eax
|
debug_print_hex eax
|
||||||
print ' <- Fast call'
|
.end: print ' <- Fast call (SYSENTER)'
|
||||||
|
|
||||||
|
|
||||||
|
;----------------------------------------------
|
||||||
|
; ÷åðåç áûñòðûé âûçîâ (SYSCALL)
|
||||||
|
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
|
||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
cpuid
|
cpuid
|
||||||
rdtsc
|
rdtsc
|
||||||
mov [old_tsc], eax
|
mov [old_tsc], eax
|
||||||
mov [old_tsc + 4], edx
|
mov [old_tsc + 4], edx
|
||||||
; ÷åðåç øëþç ïðåðûâàíèÿ
|
|
||||||
test2: mov ebx, 0x100000
|
mov ebx, 0x100000
|
||||||
|
align 32
|
||||||
|
.nxt: mov eax, 19
|
||||||
|
push ecx
|
||||||
|
syscall
|
||||||
|
pop ecx
|
||||||
|
|
||||||
|
.ret_p: dec ebx
|
||||||
|
jnz .nxt
|
||||||
|
|
||||||
|
xor eax, eax
|
||||||
|
cpuid
|
||||||
|
rdtsc
|
||||||
|
cmp eax, [old_tsc]
|
||||||
|
jnb @f
|
||||||
|
dec edx
|
||||||
|
@@: sub eax, [old_tsc]
|
||||||
|
sub edx, [old_tsc + 4]
|
||||||
|
debug_print_hex edx
|
||||||
|
debug_print_hex eax
|
||||||
|
.end: print ' <- Fast call (SYSCALL)'
|
||||||
|
;----------------------------------------------
|
||||||
|
; ÷åðåç øëþç ïðåðûâàíèÿ
|
||||||
|
xor eax, eax
|
||||||
|
cpuid
|
||||||
|
rdtsc
|
||||||
|
mov [old_tsc], eax
|
||||||
|
mov [old_tsc + 4], edx
|
||||||
|
|
||||||
|
test3: mov ebx, 0x100000
|
||||||
align 32
|
align 32
|
||||||
.nxt: mov eax, 19 ; ôóíêöèÿ ïóñòûøêà
|
.nxt: mov eax, 19 ; ôóíêöèÿ ïóñòûøêà
|
||||||
int 0x40
|
int 0x40
|
||||||
|
Loading…
Reference in New Issue
Block a user