FDC: Fix data transfer len (Hervé Poussineau)
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>
Thu, 1 May 2008 19:05:12 +0000 (19:05 +0000)
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>
Thu, 1 May 2008 19:05:12 +0000 (19:05 +0000)
In floppy controller, transfer data len is not correctly calculated.
We should read up to the last sector specified by the caller, and not up to
the last sector of the floppy.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4294 c046a42c-6fe2-441c-8c8c-71466251a162

hw/fdc.c

index e47a1da..cd00420 100644 (file)
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -1137,9 +1137,9 @@ static void fdctrl_start_transfer (fdctrl_t *fdctrl, int direction)
     } else {
         int tmp;
         fdctrl->data_len = 128 << (fdctrl->fifo[5] > 7 ? 7 : fdctrl->fifo[5]);
-        tmp = (cur_drv->last_sect - ks + 1);
+        tmp = (fdctrl->fifo[6] - ks + 1);
         if (fdctrl->fifo[0] & 0x80)
-            tmp += cur_drv->last_sect;
+            tmp += fdctrl->fifo[6];
         fdctrl->data_len *= tmp;
     }
     fdctrl->eot = fdctrl->fifo[6];