I'm working on CPUID utility for MenuetOS now. I'm find a bug in KERNEL.ASM during testing. It causes wrong value for CPU frequency (sysfunc 18 subfunc 5). Difference is about 0.5% (about 10 MHz on 2GHz CPU's).
Please, see at this:
delay_ms: ; delay in 1/1000 sec
push eax
push ecx
mov ecx,esi
;-------------------------------------------------
imul ecx,66 <----- wrong
;-------------------------------------------------
in al,0x61
and al,0x10
mov ah,al
cld
For getting more correct CPU frequency you must replace '' imul ecx,66 '' by this:
; Fix for CPU clock detection by Sergey Kuzmin aka Wildwest <kuzmin_serg [at] list.ru>
;10/20/2004
imul ecx,265
mov eax,ecx
shr eax, 2
mov ecx,eax
;10/20/2004
;Fix for CPU clock detection by Sergey Kuzmin aka Wildwest <kuzmin_serg [at] list.ru>
Ivan Poddubny makes it a little shorter
imul ecx, 265
shr ecx, 2
From Russia with love to MenuetOS,
Sergey Kuzmin
Please, see at this:
delay_ms: ; delay in 1/1000 sec
push eax
push ecx
mov ecx,esi
;-------------------------------------------------
imul ecx,66 <----- wrong
;-------------------------------------------------
in al,0x61
and al,0x10
mov ah,al
cld
For getting more correct CPU frequency you must replace '' imul ecx,66 '' by this:
; Fix for CPU clock detection by Sergey Kuzmin aka Wildwest <kuzmin_serg [at] list.ru>
;10/20/2004
imul ecx,265
mov eax,ecx
shr eax, 2
mov ecx,eax
;10/20/2004
;Fix for CPU clock detection by Sergey Kuzmin aka Wildwest <kuzmin_serg [at] list.ru>
Ivan Poddubny makes it a little shorter
imul ecx, 265
shr ecx, 2
From Russia with love to MenuetOS,
Sergey Kuzmin


