From 2cbf514c37807ea606a7fb08b4b70f98ecae9464 Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Fri, 11 Aug 2017 16:17:30 +0000 Subject: [PATCH] kernel: get_clock_ns() funny 96-bit arithmetic git-svn-id: svn://kolibrios.org@6942 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/core/apic.inc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/kernel/trunk/core/apic.inc b/kernel/trunk/core/apic.inc index 0d8c4d252f..698e2e7b9e 100644 --- a/kernel/trunk/core/apic.inc +++ b/kernel/trunk/core/apic.inc @@ -460,17 +460,24 @@ get_clock_ns: jne @B popfd +;96-bit arithmetic +;ebx - low dword +;esi - medium dword +;edx - high dword + mul [hpet_period] mov ebx, eax mov esi, edx mov eax, ecx mul [hpet_period] - add eax, esi - mov edx, eax + add esi, eax + adc edx, 0 mov eax, ebx - shrd eax, edx, 10 - shr edx, 10 + mov ebx, esi + shrd eax, ebx, 10 + shrd esi, edx, 10 + mov edx, esi pop esi pop ebx