Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F166431510
D7718.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D7718.diff
View Options
Index: head/sys/boot/i386/libi386/biosdisk.c
===================================================================
--- head/sys/boot/i386/libi386/biosdisk.c
+++ head/sys/boot/i386/libi386/biosdisk.c
@@ -244,6 +244,7 @@
bd_int13probe(struct bdinfo *bd)
{
struct edd_params params;
+ int ret = 1; /* assume success */
v86.ctl = V86_FLAGS;
v86.addr = 0x13;
@@ -251,11 +252,14 @@
v86.edx = bd->bd_unit;
v86int();
+ /* Don't error out if we get bad sector number, try EDD as well */
if (V86_CY(v86.efl) || /* carry set */
- (v86.ecx & 0x3f) == 0 || /* absurd sector number */
(v86.edx & 0xff) <= (unsigned)(bd->bd_unit & 0x7f)) /* unit # bad */
return (0); /* skip device */
+ if ((v86.ecx & 0x3f) == 0) /* absurd sector number */
+ ret = 0; /* set error */
+
/* Convert max cyl # -> # of cylinders */
bd->bd_cyl = ((v86.ecx & 0xc0) << 2) + ((v86.ecx & 0xff00) >> 8) + 1;
/* Convert max head # -> # of heads */
@@ -280,7 +284,8 @@
if (V86_CY(v86.efl) || /* carry set */
(v86.ebx & 0xffff) != 0xaa55 || /* signature */
(v86.ecx & EDD_INTERFACE_FIXED_DISK) == 0)
- return (1);
+ return (ret); /* return code from int13 AH=08 */
+
/* EDD supported */
bd->bd_flags |= BD_MODEEDD1;
if ((v86.eax & 0xff00) >= 0x3000)
@@ -295,12 +300,22 @@
v86.esi = VTOPOFF(¶ms);
v86int();
if (!V86_CY(v86.efl)) {
- bd->bd_sectors = params.sectors;
+ uint64_t total;
+
+ if (params.sectors != 0)
+ bd->bd_sectors = params.sectors;
+
+ total = (uint64_t)params.cylinders *
+ params.heads * params.sectors_per_track;
+ if (bd->bd_sectors < total)
+ bd->bd_sectors = total;
+
bd->bd_sectorsize = params.sector_size;
+ ret = 1;
}
DEBUG("unit 0x%x flags %x, sectors %llu, sectorsize %u",
bd->bd_unit, bd->bd_flags, bd->bd_sectors, bd->bd_sectorsize);
- return (1);
+ return (ret);
}
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Aug 14, 1:20 PM (4 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36730180
Default Alt Text
D7718.diff (1 KB)
Attached To
Mode
D7718: bd_int13probe() should check extended info if sector info is bad
Attached
Detach File
Event Timeline
Log In to Comment