- Fix kseg0 address calculation - it doesn't always start at
page boundary - Add cache ops to ensure memory validity before/after copy operation
This commit is contained in:
parent
241e22a783
commit
522c90a143
@ -51,6 +51,8 @@ __FBSDID("$FreeBSD$");
|
||||
#include <vm/vm_page.h>
|
||||
#include <vm/vm_param.h>
|
||||
|
||||
#include <machine/cache.h>
|
||||
|
||||
/*
|
||||
* 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 @@ uiomove_fromphys(vm_page_t ma[], vm_offset_t offset, int n, struct uio *uio)
|
||||
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 @@ uiomove_fromphys(vm_page_t ma[], vm_offset_t offset, int n, struct uio *uio)
|
||||
}
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user