- for (i = 0; i < uio->uio_iovcnt; i++) {
- iovp = &uio->uio_iov[i];
- while (iovp->iov_len > 0) {
- /*
- * [mark the buffer busy for physical I/O]
- * (i.e. set B_PHYS (because it's an I/O to user
- * memory, and B_RAW, because B_RAW is to be
- * "Set by physio for raw transfers.", in addition
- * to the "busy" and read/write flag.)
- */
- s = splbio();
- bp->b_flags = B_BUSY | B_PHYS | B_RAW | flags;
- splx(s);
-
- /* [set up the buffer for a maximum-sized transfer] */
- bp->b_blkno = uio->uio_offset / blocksize;
- bp->b_bcount = iovp->iov_len;
- bp->b_data = iovp->iov_base;
-
- /*
- * [call minphys to bound the tranfer size]
- * and remember the amount of data to transfer,
- * for later comparison.
- */
- (*minphys)(bp);
- todo = bp->b_bcount;
+ while (uio_resid(uio) > 0) {
+ iosize = uio_curriovlen(uio);
+ if (iosize > MAXPHYSIO_WIRED) {
+ iosize = MAXPHYSIO_WIRED;
+ }