Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KKdWa-0004Qs-9I for mharc-grub-devel@gnu.org; Sun, 20 Jul 2008 14:20:48 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KKdWY-0004Qn-NQ for grub-devel@gnu.org; Sun, 20 Jul 2008 14:20:46 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KKdWX-0004Qb-8T for grub-devel@gnu.org; Sun, 20 Jul 2008 14:20:46 -0400 Received: from [199.232.76.173] (port=57213 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KKdWX-0004QY-2E for grub-devel@gnu.org; Sun, 20 Jul 2008 14:20:45 -0400 Received: from smtp-vbr16.xs4all.nl ([194.109.24.36]:3416) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KKdWW-0003cf-Ny for grub-devel@gnu.org; Sun, 20 Jul 2008 14:20:45 -0400 Received: from localhost.localdomain (249-174.surfsnel.dsl.internl.net [145.99.174.249]) by smtp-vbr16.xs4all.nl (8.13.8/8.13.8) with ESMTP id m6KIKfll080543; Sun, 20 Jul 2008 20:20:42 +0200 (CEST) (envelope-from mgerards@xs4all.nl) From: Marco Gerards To: Colin D Bennett References: <20080623075438.5861e6d1@gibibit.com> <878wwi6bqy.fsf@xs4all.nl> <20080704102616.6ce86238@gibibit.com> Mail-Copies-To: mgerards@xs4all.nl Date: Sun, 20 Jul 2008 20:21:28 +0200 In-Reply-To: <20080704102616.6ce86238@gibibit.com> (Colin D. Bennett's message of "Fri, 4 Jul 2008 10:26:16 -0700") Message-ID: <87y73wifh3.fsf@xs4all.nl> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by XS4ALL Virus Scanner X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.6-4.9 Cc: The development of GRUB 2 Subject: Re: [RFC] High resolution time support using x86 TSC X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jul 2008 18:20:46 -0000 Colin D Bennett writes: > Hi Marco, > > On Thu, 03 Jul 2008 20:52:53 +0200 > Marco Gerards wrote: > >> Hi Colin, >> >> Colin D Bennett 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. -- Marco