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_BUFF equ (OS_BASE+0x000F501)
CPU_FREQ equ (OS_BASE+0x000F600)
;CPU_FREQ equ (OS_BASE+0x000F600)
;unused ? no active references
MOUSE_PORT equ (OS_BASE+0x000F604)
;MOUSE_PORT equ (OS_BASE+0x000F604)
;unused
PS2_CHUNK equ (OS_BASE+0x000FB00)

View File

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

View File

@ -81,7 +81,7 @@ if lang eq ru
boot_pal_vga db '“áâ ­®¢ª  VGA 640x480 ¯ «¨âàë',0
boot_failed db '‡ £à㧪  ¯¥à¢®£® ¯à¨«®¦¥­¨ï ­¥ 㤠« áì',0
boot_mtrr db '“áâ ­®¢ª  MTRR',0
boot_APIC_found db 'APIC ¢ª«î祭', 0
boot_APIC_nfound db 'APIC ­¥ ­ ©¤¥­', 0
if preboot_blogesc
@ -119,7 +119,7 @@ else
boot_pal_vga db 'Setting VGA 640x480 palette',0
boot_failed db 'Failed to start first app',0
boot_mtrr db 'Setting MTRR',0
boot_APIC_found db 'APIC enabled', 0
boot_APIC_nfound db 'APIC not found', 0
if preboot_blogesc
@ -332,6 +332,8 @@ mem_block_list rd 64*2
mem_used_list rd 64*2
mem_hash_cnt rd 64
cpu_freq rq 1
heap_mutex MUTEX
heap_size rd 1
heap_free rd 1

View File

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

View File

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