[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC] High resolution time support using x86 TSC

From: Colin D Bennett
Subject: [RFC] High resolution time support using x86 TSC
Date: Mon, 23 Jun 2008 07:54:38 -0700

I have implemented high resolution time support (through the
new grub_get_time_ms() function) using the RDTSC instruction available
on Pentium and higher x86 CPUs.  The TSC value is simply a 64-bit block
cycle counter that is zeroed at bootup, so grub_main() calls
grub_time_init(), which is defined by each platform.  If a platform
links to kern/i386/tsc.c, then the grub_time_init() function from tsc.c
is used, which calibrates the TSC rate and absolute zero reference using
the RTC.

I also extracted the grub_millisleep_generic() function into
kern/generic/millisleep.c and renamed it to grub_millisleep() so that
platforms linking to it don't need to define a grub_millisleep() just
to call grub_millisleep_generic() anymore.  Simply linking in
kern/generic/millisleep.c will use the generic implementation.

I have only tested this patch on the i386-pc platform, so if anyone
tests it on another platform and finds problems, please let me know and
I can try to fix it.


Attachment: tsc_2008-06-23.patch
Description: Text Data

Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]