Set FDPT in irq table even for small drives.
authorKevin O'Connor <kevin@koconnor.net>
Mon, 4 Jan 2010 03:24:18 +0000 (22:24 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Mon, 4 Jan 2010 03:24:18 +0000 (22:24 -0500)
Fix bug due to fill_fdpt exiting early in non-logical drive case.

src/block.c

index c6787e25b2ef38f2f65b50cf2db69b5d26a2b272..01aa84a3c9a00fb2e7e23dfb9c830bebaff7d3f8 100644 (file)
@@ -180,20 +180,19 @@ fill_fdpt(struct drive_s *drive_g, int hdid)
     fdpt->heads = nlh;
     fdpt->sectors = nlspt;
 
-    if (nlc == npc && nlh == nph && nlspt == npspt)
-        // no logical CHS mapping used, just physical CHS
-        // use Standard Fixed Disk Parameter Table (FDPT)
-        return;
-
-    // complies with Phoenix style Translated Fixed Disk Parameter
-    // Table (FDPT)
-    fdpt->phys_cylinders = npc;
-    fdpt->phys_heads = nph;
-    fdpt->phys_sectors = npspt;
-    fdpt->a0h_signature = 0xa0;
-
-    // Checksum structure.
-    fdpt->checksum -= checksum(fdpt, sizeof(*fdpt));
+    if (nlc != npc || nlh != nph || nlspt != npspt) {
+        // Logical mapping present - use extended structure.
+
+        // complies with Phoenix style Translated Fixed Disk Parameter
+        // Table (FDPT)
+        fdpt->phys_cylinders = npc;
+        fdpt->phys_heads = nph;
+        fdpt->phys_sectors = npspt;
+        fdpt->a0h_signature = 0xa0;
+
+        // Checksum structure.
+        fdpt->checksum -= checksum(fdpt, sizeof(*fdpt));
+    }
 
     if (hdid == 0)
         SET_IVT(0x41, SEGOFF(get_ebda_seg(), offsetof(