2002-12-11 Yoshinori K. Okuji <okuji@enbug.org>

Add a workaround for buggy BIOSes which don't pass boot drive
	correctly. The idea is that GRUB forces the fixed disk flag
	when booted from a hard disk. When BIOS loads GRUB directly,
	the boot drive must be either of 0x00 and 0x80, so this should
	work, if those BIOSes always pass zero to %dl. AFAIK, this
	assumption is always correct.

	* stage2/builtins.c (install_func): Store the fixed disk flag of
	the destination drive in BOOT_DRIVE_MASK in Stage 1.

	* stage1/stage1.h (STAGE1_BOOT_DRIVE_MASK): New macro.

	* stage1/stage1.S (boot_drive_mask): New variable. It is or'ed
	to %dl.
This commit is contained in:
okuji committed 2002-12-10 17:30:29 +00:00
1 parent 631d47d206
commit f8111d3b54
4 files changed
+37 -2

No files matched your search

+6
View File
@@ -1916,6 +1916,12 @@ install_func (char *arg, int flags)
/* Set the "force LBA" flag. */
*((unsigned char *) (stage1_buffer + STAGE1_FORCE_LBA)) = is_force_lba;
/* Set the boot drive mask. This is a workaround for buggy BIOSes which
don't pass boot drive correctly. Instead, they pass 0x00 even when
booted from 0x80. */
*((unsigned char *) (stage1_buffer + STAGE1_BOOT_DRIVE_MASK))
= (dest_drive & BIOS_FLAG_FIXED_DISK);
/* Read the first sector of Stage 2. */
disk_read_hook = disk_read_savesect_func;