[Top][All Lists]

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

Re: [RFC] High resolution time support using x86 TSC

From: Marco Gerards
Subject: Re: [RFC] High resolution time support using x86 TSC
Date: Sun, 20 Jul 2008 20:21:28 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

Colin D Bennett <address@hidden> writes:

> Hi Marco,
> On Thu, 03 Jul 2008 20:52:53 +0200
> Marco Gerards <address@hidden> wrote:
>> Hi Colin,
>> Colin D Bennett <address@hidden> writes:
>> > 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.
>> What if TSC is not available?
> I updated the changelog entry to indicate that running on a 386 or 486
> will fail, since TSC is provided in Pentium+.  Do we support running on
> 386 or 386?  Should I check for this?  If so, the code will have to
> change a bit, and be able to select between the generic implementation
> and the TSC implementation at runtime.
> I think this would be best done letting the "grub_get_time_ms"
> implementation be selected by setting a function pointer in
> grub_machine_init() depending on the machine's capabilities.  I would
> have to significantly re-structure my patch, but it might be
> necessary (and could lead to more understandable code?).
> What do you think?

That would be great.  I do not want to drop 486 support just because
of this.  You could even drop back to a lower granularity of the timer
or better: submit code that does the trick for the 486 as well.


reply via email to

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