grub-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Fix infinite loop in grub_pit_wait()


From: Robert Millan
Subject: Re: [PATCH] Fix infinite loop in grub_pit_wait()
Date: Thu, 7 Aug 2008 18:10:59 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

On Thu, Aug 07, 2008 at 05:32:42PM +0200, Christian Franke wrote:
> grub2 from current SVN hangs if run in VirtualPC, the problem was 
> introduced with 'svn diff -r 1779:1780'.

I'm not familiar with this part of the PIT interface;  why does it hang
only on VirtualPC?

>  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);
>  }

This doesn't AFAICT preserve the existing value of the timer2 gate and speaker.
I assume that is ok?

Thanks!

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."




reply via email to

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