2008-04-13 Robert Millan <rmh@aybabtu.com>

* disk/i386/pc/biosdisk.c (grub_biosdisk_rw): Fix CHS limit check,
        as per http://www.allensmith.net/Storage/HDDlimit/Int13h.htm
This commit is contained in:
robertmh 2008-04-13 18:40:25 +00:00
parent e54a72f5cb
commit 82ead3fe32
2 changed files with 13 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2008-04-13 Robert Millan <rmh@aybabtu.com>
* disk/i386/pc/biosdisk.c (grub_biosdisk_rw): Fix CHS limit check,
as per http://www.allensmith.net/Storage/HDDlimit/Int13h.htm
2008-04-13 Christian Franke <franke@computer.org>
* util/i386/pc/grub-mkrescue.in: Add --emulation=floppy

View File

@ -234,15 +234,17 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk,
{
unsigned coff, hoff, soff;
unsigned head;
unsigned real_sector = (unsigned) sector;
/* It is impossible to reach over 2TB with the traditional
CHS access. */
if (sector > ~0UL)
/* It is impossible to reach over 8064 MiB (a bit less than LBA24) with
the traditional CHS access. */
if (sector >
1024 /* cylinders */ *
256 /* heads */ *
63 /* spt */)
return grub_error (GRUB_ERR_OUT_OF_RANGE, "out of disk");
soff = real_sector % data->sectors + 1;
head = real_sector / data->sectors;
soff = ((grub_uint32_t) sector) % data->sectors + 1;
head = ((grub_uint32_t) sector) / data->sectors;
hoff = head % data->heads;
coff = head / data->heads;