Commit 771effeb8d49aaf4d1a39c0be5e4b722d22427ec

Authored by blueswir1
1 parent b3bc1540

FDC: Fix data transfer len (Hervé Poussineau)

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
Showing 1 changed file with 2 additions and 2 deletions
hw/fdc.c
@@ -1137,9 +1137,9 @@ static void fdctrl_start_transfer (fdctrl_t *fdctrl, int direction) @@ -1137,9 +1137,9 @@ static void fdctrl_start_transfer (fdctrl_t *fdctrl, int direction)
1137 } else { 1137 } else {
1138 int tmp; 1138 int tmp;
1139 fdctrl->data_len = 128 << (fdctrl->fifo[5] > 7 ? 7 : fdctrl->fifo[5]); 1139 fdctrl->data_len = 128 << (fdctrl->fifo[5] > 7 ? 7 : fdctrl->fifo[5]);
1140 - tmp = (cur_drv->last_sect - ks + 1); 1140 + tmp = (fdctrl->fifo[6] - ks + 1);
1141 if (fdctrl->fifo[0] & 0x80) 1141 if (fdctrl->fifo[0] & 0x80)
1142 - tmp += cur_drv->last_sect; 1142 + tmp += fdctrl->fifo[6];
1143 fdctrl->data_len *= tmp; 1143 fdctrl->data_len *= tmp;
1144 } 1144 }
1145 fdctrl->eot = fdctrl->fifo[6]; 1145 fdctrl->eot = fdctrl->fifo[6];