summaryrefslogtreecommitdiffstats
path: root/sys/boot/i386
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2004-01-21 23:22:29 +0000
committerjhb <jhb@FreeBSD.org>2004-01-21 23:22:29 +0000
commit5690dee266aafd27e9ccb89abe63e0400b055263 (patch)
tree0fff2d7becdfc8de4ac3ca51da075e581ca70163 /sys/boot/i386
parentdda01dfaf85fc509b36c4f586c9bee362a707502 (diff)
downloadFreeBSD-src-5690dee266aafd27e9ccb89abe63e0400b055263.zip
FreeBSD-src-5690dee266aafd27e9ccb89abe63e0400b055263.tar.gz
If a transfer to or from a floppy disk crosses a 64k boundary, we have to
use a bounce buffer for the actual transfer to avoid crossing a 64k boundary. To do this, we malloc a buffer twice as big as we need and then find an aligned block within that buffer to do the transfer. The check to see which part of the block we use used the wrong variable for part of the condition meaning that in certain edge cases we would ask the BIOS to cross a 64k boundary. The BIOS request would then fail resulting in file transfers that just magically fail in the middle without any apparent reason. Specifically, my tests for the splitfs boot floppies managed to trigger this edge case. MFC after: 1 week X-MFC-info: along with fixes to libstand filesystems
Diffstat (limited to 'sys/boot/i386')
-rw-r--r--sys/boot/i386/libi386/biosdisk.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/boot/i386/libi386/biosdisk.c b/sys/boot/i386/libi386/biosdisk.c
index 6d381d4..25faefc 100644
--- a/sys/boot/i386/libi386/biosdisk.c
+++ b/sys/boot/i386/libi386/biosdisk.c
@@ -867,7 +867,7 @@ bd_read(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest)
*/
x = min(FLOPPY_BOUNCEBUF, (unsigned)blks);
bbuf = malloc(x * 2 * BIOSDISK_SECSIZE);
- if (((u_int32_t)VTOP(bbuf) & 0xffff0000) == ((u_int32_t)VTOP(dest + x * BIOSDISK_SECSIZE) & 0xffff0000)) {
+ if (((u_int32_t)VTOP(bbuf) & 0xffff0000) == ((u_int32_t)VTOP(bbuf + x * BIOSDISK_SECSIZE) & 0xffff0000)) {
breg = bbuf;
} else {
breg = bbuf + x * BIOSDISK_SECSIZE;
@@ -1000,7 +1000,7 @@ bd_write(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest)
x = min(FLOPPY_BOUNCEBUF, (unsigned)blks);
bbuf = malloc(x * 2 * BIOSDISK_SECSIZE);
- if (((u_int32_t)VTOP(bbuf) & 0xffff0000) == ((u_int32_t)VTOP(dest + x * BIOSDISK_SECSIZE) & 0xffff0000)) {
+ if (((u_int32_t)VTOP(bbuf) & 0xffff0000) == ((u_int32_t)VTOP(bbuf + x * BIOSDISK_SECSIZE) & 0xffff0000)) {
breg = bbuf;
} else {
breg = bbuf + x * BIOSDISK_SECSIZE;
OpenPOWER on IntegriCloud