1
0

kernel: export GetCpuFreq

git-svn-id: svn://kolibrios.org@3481 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2013-04-26 10:57:25 +00:00
parent d15a13f685
commit d67b35544c
5 changed files with 24 additions and 13 deletions

View File

@ -218,10 +218,10 @@ KEY_BUFF equ (OS_BASE+0x000F401)
BTN_COUNT equ (OS_BASE+0x000F500) BTN_COUNT equ (OS_BASE+0x000F500)
BTN_BUFF equ (OS_BASE+0x000F501) BTN_BUFF equ (OS_BASE+0x000F501)
CPU_FREQ equ (OS_BASE+0x000F600) ;CPU_FREQ equ (OS_BASE+0x000F600)
;unused ? no active references ;unused ? no active references
MOUSE_PORT equ (OS_BASE+0x000F604) ;MOUSE_PORT equ (OS_BASE+0x000F604)
;unused ;unused
PS2_CHUNK equ (OS_BASE+0x000FB00) PS2_CHUNK equ (OS_BASE+0x000FB00)

View File

@ -335,7 +335,8 @@ __exports:
delay_hs, 'Delay', \ ; ebx delay_hs, 'Delay', \ ; ebx
set_mouse_data, 'SetMouseData', \ ; set_mouse_data, 'SetMouseData', \ ;
set_keyboard_data, 'SetKeyboardData', \ ; gcc fastcall set_keyboard_data, 'SetKeyboardData', \ ; gcc fastcall
timer_hs, 'TimerHs' ; stdcall timer_hs, 'TimerHs', \ ; stdcall
get_cpu_freq, 'GetCpuFreq'

View File

@ -332,6 +332,8 @@ mem_block_list rd 64*2
mem_used_list rd 64*2 mem_used_list rd 64*2
mem_hash_cnt rd 64 mem_hash_cnt rd 64
cpu_freq rq 1
heap_mutex MUTEX heap_mutex MUTEX
heap_size rd 1 heap_size rd 1
heap_free rd 1 heap_free rd 1

View File

@ -165,6 +165,7 @@ raise_event: ;; EXPORT use
; esi - event data (=0 => skip) ; esi - event data (=0 => skip)
;scratched: ebx,ecx,esi,edi ;scratched: ebx,ecx,esi,edi
call NotDummyTest ; not returned for fail !!! call NotDummyTest ; not returned for fail !!!
mov [check_idle_semaphore], 5
or esi, esi or esi, esi
jz @f jz @f
lea edi, [ebx+EVENT.code] lea edi, [ebx+EVENT.code]

View File

@ -837,16 +837,19 @@ end if
rdtsc ;call _rdtsc rdtsc ;call _rdtsc
sti sti
sub eax, ecx sub eax, ecx
xor edx, edx
shld edx, eax, 2
shl eax, 2 shl eax, 2
mov [CPU_FREQ], eax ; save tsc / sec mov dword [cpu_freq], eax
; mov ebx, 1000000 mov dword [cpu_freq+4], edx
; div ebx mov ebx, 1000000
div ebx
; ¢®®¡é¥-â® ¯à®¨§¢®¤¨â¥«ì­®áâì ¢ ¤ ­­®¬ ª®­ªà¥â­®¬ ¬¥á⥠; ¢®®¡é¥-â® ¯à®¨§¢®¤¨â¥«ì­®áâì ¢ ¤ ­­®¬ ª®­ªà¥â­®¬ ¬¥áâ¥
; ᮢ¥à襭­® ­¥ªà¨â¨ç­ , ­® çâ®¡ë § âª­ãâì «î¡¨â¥«¥© ; ᮢ¥à襭­® ­¥ªà¨â¨ç­ , ­® çâ®¡ë § âª­ãâì «î¡¨â¥«¥©
; ®¯â¨¬¨§¨àãîé¨å ª®¬¯¨«ïâ®à®¢ Ÿ‚“... ; ®¯â¨¬¨§¨àãîé¨å ª®¬¯¨«ïâ®à®¢ Ÿ‚“...
mov edx, 2251799814 ; mov edx, 2251799814
mul edx ; mul edx
shr edx, 19 ; shr edx, 19
mov [stall_mcs], edx mov [stall_mcs], edx
; PRINT CPU FREQUENCY ; PRINT CPU FREQUENCY
mov esi, boot_cpufreq mov esi, boot_cpufreq
@ -2240,10 +2243,14 @@ sysfn_getidletime: ; 18.4 = GET IDLETIME
ret ret
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
sysfn_getcpuclock: ; 18.5 = GET TSC/SEC sysfn_getcpuclock: ; 18.5 = GET TSC/SEC
mov eax, [CPU_FREQ] mov eax, dword [cpu_freq]
mov [esp+32], eax mov [esp+32], eax
ret ret
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
get_cpu_freq:
mov eax, dword [cpu_freq]
mov edx, dword [cpu_freq+4]
ret
; SAVE ramdisk to /hd/1/menuet.img ; SAVE ramdisk to /hd/1/menuet.img
;!!!!!!!!!!!!!!!!!!!!!!!! ;!!!!!!!!!!!!!!!!!!!!!!!!
include 'blkdev/rdsave.inc' include 'blkdev/rdsave.inc'