From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KR8HE-0005NY-Bq for mharc-grub-devel@gnu.org; Thu, 07 Aug 2008 12:23:48 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KR8HC-0005Kw-2y for grub-devel@gnu.org; Thu, 07 Aug 2008 12:23:46 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KR8HA-0005Ht-65 for grub-devel@gnu.org; Thu, 07 Aug 2008 12:23:45 -0400 Received: from [199.232.76.173] (port=46348 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KR8HA-0005Hb-1O for grub-devel@gnu.org; Thu, 07 Aug 2008 12:23:44 -0400 Received: from smtp-vbr15.xs4all.nl ([194.109.24.35]:1244) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KR8H9-0007dY-PA for grub-devel@gnu.org; Thu, 07 Aug 2008 12:23:44 -0400 Received: from localhost.localdomain (249-174.surfsnel.dsl.internl.net [145.99.174.249]) by smtp-vbr15.xs4all.nl (8.13.8/8.13.8) with ESMTP id m77GNdhG086266 for ; Thu, 7 Aug 2008 18:23:39 +0200 (CEST) (envelope-from mgerards@xs4all.nl) From: Marco Gerards To: The development of GRUB 2 References: <489B159A.2000106@t-online.de> Mail-Copies-To: mgerards@xs4all.nl Date: Thu, 07 Aug 2008 18:26:34 +0200 In-Reply-To: <489B159A.2000106@t-online.de> (Christian Franke's message of "Thu, 07 Aug 2008 17:32:42 +0200") Message-ID: <87hc9wssed.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 Subject: Re: [PATCH] Fix infinite loop in grub_pit_wait() 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: Thu, 07 Aug 2008 16:23:46 -0000 Christian Franke writes: > grub2 from current SVN hangs if run in VirtualPC, the problem was > introduced with 'svn diff -r 1779:1780'. > > Here is a proposed fix. > > Christian > > 2008-08-07 Christian Franke > > * kern/i386/pit.c (TIMER2_SPEAKER): New define. > (TIMER2_GATE): Likewise. > (grub_pit_wait): Add enable/disable of the timer2 gate > bit of port 0x61. This fixes a possible infinite loop. Small nitpick: use a double space > diff --git a/kern/i386/pit.c b/kern/i386/pit.c > index d0a6eda..a3fab26 100644 > --- a/kern/i386/pit.c > +++ b/kern/i386/pit.c > @@ -28,13 +28,26 @@ > #define TIMER_ENABLE_LSB 0x20 > #define TIMER_ENABLE_MSB 0x10 > #define TIMER2_LATCH 0x20 > +#define TIMER2_SPEAKER 0x02 > +#define TIMER2_GATE 0x01 > > void > grub_pit_wait (grub_uint16_t tics) > { > + /* Disable timer2 gate and speaker. */ > + grub_outb (grub_inb (TIMER2_REG_LATCH) & ~ (TIMER2_SPEAKER | TIMER2_GATE), TIMER2_REG_LATCH); > + > + /* Set tics. */ > grub_outb (TIMER2_SELECT | TIMER_ENABLE_LSB | TIMER_ENABLE_MSB, TIMER_REG_COMMAND); > grub_outb (tics & 0xff, TIMER2_REG_CONTROL); > grub_outb (tics >> 8, TIMER2_REG_CONTROL); > > + /* Enable timer2 gate, keep speaker disabled. */ > + grub_outb ((grub_inb (TIMER2_REG_LATCH) & ~ TIMER2_SPEAKER) | TIMER2_GATE, TIMER2_REG_LATCH); > + > + /* Wait. */ > while ((grub_inb (TIMER2_REG_LATCH) & TIMER2_LATCH) == 0x00); > + > + /* Disable timer2 gate and speaker. */ > + grub_outb (grub_inb (TIMER2_REG_LATCH) & ~ (TIMER2_SPEAKER | TIMER2_GATE), TIMER2_REG_LATCH); These lines are too long, please break them properly. -- Marco