--- uio_machdep.c (revision 209147) +++ uio_machdep.c (local) @@ -51,6 +51,8 @@ #include #include +#include + /* * Implement uiomove(9) from physical memory using a combination * of the direct mapping and sf_bufs to reduce the creation and @@ -91,8 +93,14 @@ m = ma[offset >> PAGE_SHIFT]; pa = VM_PAGE_TO_PHYS(m); if (pa < MIPS_KSEG0_LARGEST_PHYS) { - cp = (char *)MIPS_PHYS_TO_KSEG0(pa); sf = NULL; + cp = (char *)MIPS_PHYS_TO_KSEG0(pa) + page_offset; + /* + * flush all mappings to this page, KSEG0 address first + * in order to get it overwritten by correct data + */ + mips_dcache_wbinv_range((vm_offset_t)cp, cnt); + pmap_flush_pvcache(m); } else { sf = sf_buf_alloc(m, 0); cp = (char *)sf_buf_kva(sf) + page_offset; @@ -122,6 +130,8 @@ } if (sf != NULL) sf_buf_free(sf); + else + mips_dcache_wbinv_range((vm_offset_t)cp, cnt); iov->iov_base = (char *)iov->iov_base + cnt; iov->iov_len -= cnt; uio->uio_resid -= cnt;