Kernel: use 22.10 fixed point arithmetic in HPET timestamp calculation.

git-svn-id: svn://kolibrios.org@5791 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2015-09-04 11:50:27 +00:00
parent 86fb4bfe83
commit a410b6abe3
2 changed files with 22 additions and 10 deletions

View File

@ -447,6 +447,7 @@ get_clock_ns:
jz .old_tics jz .old_tics
push ebx push ebx
push esi
pushfd pushfd
cli cli
@ -456,15 +457,24 @@ get_clock_ns:
mov eax, [ebx+0xF0] mov eax, [ebx+0xF0]
mov ecx, [ebx+0xF4] mov ecx, [ebx+0xF4]
cmp ecx, edx cmp ecx, edx
jnz @B jne @B
mov ecx, [hpet_period] mul [hpet_period]
mov ebx, edx shrd eax, edx, 10
imul ebx, ecx shr edx, 10
mul ecx
add edx, ebx mov ebx, eax
mov esi, edx
mov eax, ecx
mul [hpet_period]
shld edx, eax, 22
shl eax, 22
add eax, ebx
adc edx, esi
popfd popfd
pop esi
pop ebx pop ebx
ret ret

View File

@ -623,10 +623,12 @@ init_hpet:
mov ecx, eax mov ecx, eax
mov eax, [ebx+HPET_PERIOD] mov eax, [ebx+HPET_PERIOD]
mov edx, 0x431BDE83 xor edx, edx
mul edx shld edx, eax, 10
shr edx, 18 shl eax, 10
mov [hpet_period-OS_BASE], edx mov esi, 1000000
div esi
mov [hpet_period-OS_BASE], eax
mov esi, [ebx+HPET_CFG] mov esi, [ebx+HPET_CFG]
and esi, not HPET_CFG_ENABLE and esi, not HPET_CFG_ENABLE