don't check if a sector of a disk is outside the disk in LBA mode by default, because some BIOSes don't return correct geometries.

This commit is contained in:
okuji 2000-09-05 12:27:00 +00:00
parent 35662478d7
commit abca3d8f72
4 changed files with 25 additions and 2 deletions

View file

@ -1,3 +1,16 @@
2000-09-05 OKUJI Yoshinori <okuji@gnu.org>
* stage1/stage1.S (lba_mode) [!NO_BUGGY_BIOS_IN_THE_WORLD]:
Don't check for the geometry, since some BIOSes don't return the
number of total sectors correctly, even if they have working LBA
support.
* stage2/start.S (lba_mode) [!NO_BUGGY_BIOS_IN_THE_WORLD]:
Likewise.
* stage2/bios.c (biosdisk) [!NO_BUGGY_BIOS_IN_THE_WORLD]:
Likewise.
Reported by Jan Fricke <fricke@uni-greifswald.de> and Pixel
<pixel@mandrakesoft.com>.
2000-09-05 OKUJI Yoshinori <okuji@gnu.org>
From Alessandro Rubini <rubini@gnu.org>:

View file

@ -184,8 +184,11 @@ lba_mode:
movl ABS(stage2_sector), %ebx
/* check for the geometry */
#ifdef NO_BUGGY_BIOS_IN_THE_WORLD
cmpl %ecx, %ebx
jge geometry_error
#endif /* NO_BUGGY_BIOS_IN_THE_WORLD */
/* the size and the reserved byte */
movw $0x0010, (%si)

View file

@ -60,9 +60,14 @@ biosdisk (int read, int drive, struct geometry *geometry,
unsigned long buffer;
unsigned long long block;
} dap;
/* XXX: Don't check the geometry by default, because some buggy
BIOSes don't return the number of total sectors correctly,
even if they have working LBA support. Hell. */
#ifdef NO_BUGGY_BIOS_IN_THE_WORLD
if (sector >= geometry->total_sectors)
return BIOSDISK_ERROR_GEOMETRY;
#endif /* NO_BUGGY_BIOS_IN_THE_WORLD */
/* FIXME: sizeof (DAP) must be 0x10. Should assert that the compiler
can't add any padding. */

View file

@ -1,7 +1,7 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1996 Erich Boleyn <erich@uruk.org>
* Copyright (C) 1999 Free Software Foundation, Inc.
* Copyright (C) 1999,2000 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -96,8 +96,10 @@ lba_mode:
movl (%di), %ebx
/* check for the geometry */
#ifdef NO_BUGGY_BIOS_IN_THE_WORLD
cmpl %ecx, %ebx
jge geometry_error
#endif /* NO_BUGGY_BIOS_IN_THE_WORLD */
/* the maximum is limited to 0x7f because of Phoenix EDD */
xorl %eax, %eax