mirror of
https://github.com/FDOS/kernel.git
synced 2025-07-23 22:04:33 +02:00
From bzt, initialize drive parameter head & sector values to avoid potential divisions by 0
This commit is contained in:
parent
5880d36ba9
commit
f1249dcd6f
@ -723,8 +723,13 @@ StandardBios: /* old way to get parameters */
|
|||||||
|
|
||||||
init_call_intr(0x13, ®s);
|
init_call_intr(0x13, ®s);
|
||||||
|
|
||||||
if (regs.flags & 0x01)
|
if (regs.flags & 0x01)
|
||||||
|
{
|
||||||
|
/* to avoid division by zero later, use some sane defaults */
|
||||||
|
driveParam->chs.Head = 16;
|
||||||
|
driveParam->chs.Sector = 63;
|
||||||
goto ErrorReturn;
|
goto ErrorReturn;
|
||||||
|
}
|
||||||
|
|
||||||
/* int13h call returns max value, store as count (#) i.e. +1 for 0 based heads & cylinders */
|
/* int13h call returns max value, store as count (#) i.e. +1 for 0 based heads & cylinders */
|
||||||
driveParam->chs.Head = (regs.d.x >> 8) + 1; /* DH = max head value = # of heads - 1 (0-255) */
|
driveParam->chs.Head = (regs.d.x >> 8) + 1; /* DH = max head value = # of heads - 1 (0-255) */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user