Garbage-collect extra copy of mappedcopy.

This commit is contained in:
thorpej 1997-02-02 08:30:54 +00:00
parent 243f0119cb
commit 68950edae8
1 changed files with 1 additions and 90 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.6 1996/04/26 19:27:08 chuck Exp $ */
/* $NetBSD: vm_machdep.c,v 1.7 1997/02/02 08:30:54 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -405,92 +405,3 @@ vunmapbuf(bp, sz)
bp->b_data = bp->b_saveaddr;
bp->b_saveaddr = NULL;
}
#ifdef MAPPEDCOPY
u_int mappedcopysize = 4096;
mappedcopyin(fromp, top, count)
register char *fromp, *top;
register int count;
{
register vm_offset_t kva, upa;
register int off, len;
int alignable;
pmap_t upmap;
extern caddr_t CADDR1;
kva = (vm_offset_t) CADDR1;
off = (vm_offset_t)fromp & PAGE_MASK;
alignable = (off == ((vm_offset_t)top & PAGE_MASK));
upmap = vm_map_pmap(&curproc->p_vmspace->vm_map);
while (count > 0) {
/*
* First access of a page, use fubyte to make sure
* page is faulted in and read access allowed.
*/
if (fubyte(fromp) == -1)
return (EFAULT);
/*
* Map in the page and bcopy data in from it
*/
upa = pmap_extract(upmap, trunc_page(fromp));
if (upa == 0)
panic("mappedcopyin");
len = min(count, PAGE_SIZE-off);
pmap_enter(pmap_kernel(), kva, upa, VM_PROT_READ, TRUE);
if (len == PAGE_SIZE && alignable && off == 0)
copypage(kva, top);
else
bcopy((caddr_t)(kva+off), top, len);
fromp += len;
top += len;
count -= len;
off = 0;
}
pmap_remove(pmap_kernel(), kva, kva+PAGE_SIZE);
return (0);
}
mappedcopyout(fromp, top, count)
register char *fromp, *top;
register int count;
{
register vm_offset_t kva, upa;
register int off, len;
int alignable;
pmap_t upmap;
extern caddr_t CADDR2;
kva = (vm_offset_t) CADDR2;
off = (vm_offset_t)top & PAGE_MASK;
alignable = (off == ((vm_offset_t)fromp & PAGE_MASK));
upmap = vm_map_pmap(&curproc->p_vmspace->vm_map);
while (count > 0) {
/*
* First access of a page, use subyte to make sure
* page is faulted in and write access allowed.
*/
if (subyte(top, *fromp) == -1)
return (EFAULT);
/*
* Map in the page and bcopy data out to it
*/
upa = pmap_extract(upmap, trunc_page(top));
if (upa == 0)
panic("mappedcopyout");
len = min(count, PAGE_SIZE-off);
pmap_enter(pmap_kernel(), kva, upa,
VM_PROT_READ|VM_PROT_WRITE, TRUE);
if (len == PAGE_SIZE && alignable && off == 0)
copypage(fromp, kva);
else
bcopy(fromp, (caddr_t)(kva+off), len);
fromp += len;
top += len;
count -= len;
off = 0;
}
pmap_remove(pmap_kernel(), kva, kva+PAGE_SIZE);
return (0);
}
#endif