我想说,是大家一起努力的结果,尤其是neiljoy的测试非常耐心细致,另一方面我们两个的配合也比较默契。
这个机器的 BIOS 很明显有 BUG,它的 int13/ah=8h 标称 C/H/S=80/2/18,但按照这个 CHS 规格,它却不能访问柱面号C > 7 的任何扇区,一旦访问就死机。这在 DOS 下也是这样。虽然它的 int13/ah=8h返回BL=10h指示应该用int13/ah=48h来确定真正的 CHS 值,但是,这个 BIOS 厂家并未严格遵守业界事实工业标准,没有严格遵从微软的以下规范:
http://www.microsoft.com/whdc/archive/PhantomDrv.mspx
为了方便,我把这个规范复制到这里来:
Eliminating Phantom Floppy Disk Drives under Windows 95/98/Me
Updated: December 4, 2001
*
This article is for system manufacturers who build systems for Microsoft® Windows® Millennium Edition (Windows Me) and for Windows 95/98/Me.
Systems that do not include a floppy disk drive or controller can have a "phantom" floppy drive A listed in miscellaneous user interfaces in Windows.
This article clarifies:
•
How to eliminate phantom floppy drives from appearing in miscellaneous user interfaces such as My Computer.
•
How to get devices mapped as drive A other than an industry-standard legacy FDC-based 1.44-MB, 3.5-inch floppy disk drive.
Windows 95/98/Me will show floppy disk drives in miscellaneous user interfaces based on how BIOS support for Int 11 and Int 13 has been implemented. Use the information described in this article to implement your BIOS and verify there are no longer any phantom disk drives. This will result in preventing phantom (non-existent) drives from appearing in most of the Windows 95/98/Me user interfaces (UI).
Note: Not all Windows 95/98/Me user interfaces respond to hot plugging events. For example, if you hot-attach a USB floppy disk drive, My Computer will properly show the added device without a reboot, but there may be other less frequently used user interfaces that do not update until after a reboot.
BIOS Int 11 and Int 13 Implementation Guidelines
Interrupt Description
Int 11
Equipment determination. All subfunctions are required.
If there are devices that appear as floppy drives (for example, El Torito-capable CD-ROM devices), then:
•
Bit Mask 0x0001 (bit 0) in AL must be set.
•
Bits 6 and 7 must properly indicate the number of floppy drive devices and devices that appear as floppy devices.
Note: The two count bits are a zero-based count (00b means 1 floppy, 01b means 2 floppies, 10b means 3 floppies, and 11b means 4 floppies).
If there are no devices that appear as floppy drives, then:
•
Bit mask 0x0001 (bit 0) must be clear.
•
Bits 6 and 7 must be set to 0.
Int 13
High-capacity drive support. All subfunctions required, including AH = 40h-48h.
ROM BIOS must set the head settle, motor start, and format gap values in the disk table pointed to by interrupt vector 1Eh.
Implement the INT 13h AH = 17h call (that is, set the DASD type for format).
Support the change line (INT 13h AH = 15h) on INT 13h floppy drives. Support INT 13h AH = 8 (Get Device Parameters). The INT 13h AH = 8 Get Device Parameters call must not turn on the drive motor for floppy drives.
Implement the extended INT 13h services (AH functions 41h - 48h).
For INT 13h with AH = 48h for installed floppy drives:
•
If there are no floppy drives attached as INT 13h devices, INT 13h AH = 48h must fail for all floppy drive numbers (drive 0, in particular). However, INT 13h AH = 8 on drive number 0 (DL==0) must work even if there are no INT 13h floppy drives, and it must return a floppy drive count of 0 in the DL register to indicate that no floppy drives are present.
•
If a floppy drive is an industry-standard 1.44-MB, 3.5-inch drive, the INT 13h AH = 8 call on the device should not modify the BL register.
•
If the device is something other than an industry standard 1.44-MB, 3.5-inch drive, but is media compatible with the 1.44-MB floppy standard, the INT 13h AH = 8 call on the device should return the parameters for a 1.44-MB industry-standard floppy drive but set the BL register to 10h and return the true maximum-supported capacity drive parameters on the INT 13h AH = 48h call.
•
For floppy devices that are not media compatible with the 1.44-MB floppy standard, the INT 13h AH = 8 call should return the closest reasonable parameters, set the BL register to 10h, and return the true maximum supported capacity parameters on the INT 13h AH = 48h call. The INT 13h AH = 8 Get Device Parameters call must not turn on the drive motor for floppy drives.
USB 1.44-MB Floppy Disk Drives as Drive A
If you are building a PC that uses a USB 1.44-MB floppy disk drive in place of a legacy FDC-based 1.44-MB floppy drive and you want to map the USB floppy drive to Drive A, it is important that the INT 13h AH = 8 ROM BIOS call (Get Device Parameters) on the device should return with BL= 0x10.
If the floppy drive type returned in the BL register is not 10h, DISKTSD will "pick" a drive letter selecting the first available drive letter.
Call to action for eliminating phantom floppy disk drives
•
Be certain to map USB 1.44-MB floppy disk drives to drive A as described in this article.
微软在规范中指出,如果设备是与1.44M工业标准软盘兼容的,就应该让 int13/ah=8h 返回C/H/S=80/2/18的几何参数;如果设备不是与1.44M工业标准软盘兼容的,就应该适当地让 int13/ah=8h 返回最接近实际容量的几何参数。这个设备显然不是与1.44M工业标准软盘兼容的,因为按照这个标准去读取扇区会死机(前面说过,即便在DOS下也死机)。因此,它返回 80/2/18 是错误的。它应该返回 C = 7 或 8(后来在 int13/ah=48h中返回的C=96,幸亏当 H 和 S 都正确时,即便参数 C 是错的也不那么容易导致死机),H=255,S=63,这样才接近实际的几何容量。其次,当 BIOS 接到不合适的参数时就死机了,这肯定是 BIOS 的巨大 BUG,毫无疑问了。因此,这就讲清楚了,这个 BIOS 有两个严重的 BUG。
另外,这个 U 盘 BIOS 没能实现 int13/ah=42h 等功能(也就是通常所说的 EBIOS 或者 LBA),也是一个缺陷,因为 EBIOS 已经成了事实工业标准,不支持这个标准,那就是一大损失。不过这不是致命的严重缺陷。
GNU GRUB 方面也存在缺陷,因为它不能对 int13/ah=8h 所返回的 BL=10h 做出反应。GNU GRUB 仍旧很本分地按照古老的常规方法进行几何参数的确定,而不能适应新的规范、新的变化。需要说明的是,即便 GNU GRUB 按照因循守旧的方法去处理这个新型的存贮设备,本质上这也是没问题的,关键是 U 盘的 BIOS 在(前面所说的那个)敏感问题上搞错了。如果 BIOS 没有缺陷的话,GRUB 也是不会有问题的。所以,问题的本源、它的症结,是在 BIOS 一方。许多 U 盘的 BIOS 可以与 GRUB 和平相处,这就是一个明证。
我们肯定不能解决 BIOS 的 BUG,那是 BIOS 以及主板厂家的事情。我们所能做的,就是在 GRUB 上下功夫。我们让 GRUB 能够发现,这个 BIOS 除了 int13/ah=8h 之外,还有一个 int13/ah=48h 可以利用。因此,我们就得到了合适的几何参数,问题就这样解决了。但是,这不是说 GNU GRUB 就有严重缺陷。像前面说的那样,本质上属于 BIOS 的严重失误,它的 int13/ah=8h 没弄好。它把重要的具有更大事实工业标准地位的 int13/ah=8h 丢弃了,而作为补充,提供了 int13/ah=48h 来亡羊补牢,用一个带贬义的词,就是舍本逐末。我们对 GRUB 所进行的修补,本质上其实是替这个破损的 BIOS 打补丁而已。