--- //depot/user/jhb/boot/sys/boot/i386/common/drv.c 2014-08-27 19:53:55.000000000 0000 +++ /home/jhb/work/p4/boot/sys/boot/i386/common/drv.c 2014-08-27 19:53:55.000000000 0000 @@ -54,11 +54,37 @@ #ifndef USE_XREAD static struct edd_packet packet; +static char bounce_buffer[512]; + +static int drvread_one(struct dsk *, void *, daddr_t, unsigned); #endif int drvread(struct dsk *dskp, void *buf, daddr_t lba, unsigned nblk) { +#ifndef USE_XREAD + int i; + + /* If the buffer is below 1MB, pass it through directly. */ + if (VTOP((char *)buf + nblk * 512) >> 20 == 0) + return (drvread_one(dskp, buf, lba, nblk)); + + /* + * Use the bounce buffer to transfer the data one sector at a + * time. + */ + for (i = 0; i < nblk; i++) { + if (drvread_one(dskp, bounce_buffer, lba + i, 1) < 0) + return (-1); + memcpy((char *)buf + 512 * i, bounce_buffer, 512); + } + return (0); +} + +static int +drvread_one(struct dsk *dskp, void *buf, daddr_t lba, unsigned nblk) +{ +#endif static unsigned c = 0x2d5c7c2f; int retries = 3;