grub-devel
[Top][All Lists]
Advanced

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

Re: How to debug 'out of disk' error.


From: Lennart Sorensen
Subject: Re: How to debug 'out of disk' error.
Date: Thu, 17 Mar 2011 10:06:06 -0400
User-agent: Mutt/1.5.18 (2008-05-17)

On Wed, Mar 16, 2011 at 11:16:05PM +0100, Vladimir 'φ-coder/phcoder' Serbinenko 
wrote:
> On 16.03.2011 23:00, Lennart Sorensen wrote:
> > On Wed, Mar 16, 2011 at 09:19:12PM +0100, Vladimir 'φ-coder/phcoder' 
> > Serbinenko wrote:
> >   
> >> Following may help:
> >> === modified file 'grub-core/disk/i386/pc/biosdisk.c'
> >> --- grub-core/disk/i386/pc/biosdisk.c    2011-01-04 14:42:47 +0000
> >> +++ grub-core/disk/i386/pc/biosdisk.c    2011-03-16 20:17:57 +0000
> >> @@ -80,6 +80,9 @@
> >>    regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
> >>  
> >>    grub_bios_interrupt (0x13, &regs);
> >> +  if (!(regs.flags & GRUB_CPU_INT_FLAGS_CARRY))
> >> +    return 0;
> >> +
> >>    return (regs.eax >> 8) & 0xff;
> >>  }
> >>     
> > I now got this:
> >
> > GRUB loading.
> > Welcome to GRUB!
> >
> > int13_ext fixup due to CARRY flag
> > int13_ext fixup due to CARRY flag
> > int13_ext fixup due to CARRY flag
> > int13_ext fixup due to CARRY flag
> > int13_ext fixup due to CARRY flag
> > int13_ext fixup due to CARRY flag
> > int13_ext fixup due to CARRY flag
> > int13_ext fixup due to CARRY flag
> > int13_ext fixup due to CARRY flag
> >   
> It's not really a fixup. Correct return on no error is CF=0 AH=0. Some
> BIOSes in some other functions returned CF=0, AH!= 0 on no error so it
> was a wild guess.
> > Failed int13_ext call: ah=42, drive=80, dap=   6fe00 returned eax=8000
> >   
> Error 0x80 according to
> http://www.delorie.com/djgpp/doc/rbinter/it/34/2.html means timeout.
> Following code would retry on timeout:
> === modified file 'grub-core/disk/i386/pc/biosdisk.c'
> --- grub-core/disk/i386/pc/biosdisk.c    2011-01-04 14:42:47 +0000
> +++ grub-core/disk/i386/pc/biosdisk.c    2011-03-16 22:13:12 +0000
> @@ -72,6 +72,8 @@
>  grub_biosdisk_rw_int13_extensions (int ah, int drive, void *dap)
>  {
>    struct grub_bios_int_registers regs;
> +  int tries = 4;
> + retry:
>    regs.eax = ah << 8;
>    /* compute the address of disk_address_packet */
>    regs.ds = (((grub_addr_t) dap) & 0xffff0000) >> 4;
> @@ -80,6 +82,16 @@
>    regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
>  
>    grub_bios_interrupt (0x13, &regs);
> +  if (!(regs.flags & GRUB_CPU_INT_FLAGS_CARRY))
> +    return 0;
> +
> +  if (((regs.eax >> 8) & 0xff) == 0x80 && tries)
> +    {
> +      grub_millisleep (10);
> +      tries--;
> +      goto retry;
> +    }
> +
>    return (regs.eax >> 8) & 0xff;
>  }
>  
> 
> > error: hd0 out of disk.
> > Entering rescue mode...
> > grub rescue>
> >
> > I am now using 1.99-rc1.  Here is the biosdisk.c with my changes.
> >
> >   
> >
> >
> > _______________________________________________
> > Grub-devel mailing list
> > address@hidden
> > http://lists.gnu.org/mailman/listinfo/grub-devel
> >   

I am trying that now.

By the way I think I spotted a bug:

      else
        if (grub_biosdisk_rw_int13_extensions (cmd + 0x42, data->drive, dap))
          {
            /* Fall back to the CHS mode.  */
            data->flags &= ~GRUB_BIOSDISK_FLAG_LBA;
            disk->total_sectors = data->cylinders * data->heads * data->sectors;
            return grub_biosdisk_rw (cmd, disk, sector, size, segment);
          }

I think that + 0x42 is wrong.  The extended commands are 0x40 above the
normal ones.  + 0x40 makes more sense to me.

0x42 = extended read.
0x02 = normal read.

0x48 = extended parameter read.
0x08 = normal parameter read.

-- 
Len Sorensen



reply via email to

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