-/* $OpenBSD: pmap.c,v 1.15 1996/10/25 11:14:13 deraadt Exp $ */
+/* $OpenBSD: pmap.c,v 1.16 1997/01/07 05:37:32 tholo Exp $ */
/* $NetBSD: pmap.c,v 1.36 1996/05/03 19:42:22 christos Exp $ */
/*
splx(s);
}
+void
+pmap_prefault(map, v, l)
+ vm_map_t map;
+ vm_offset_t v;
+ vm_size_t l;
+{
+ vm_offset_t pv, pv2;
+
+ for (pv = v; pv < v + l ; pv += ~PD_MASK + 1) {
+ if (!pmap_pde_v(pmap_pde(map->pmap, pv))) {
+ pv2 = trunc_page(vtopte(pv));
+ vm_fault(map, pv2, VM_PROT_READ, FALSE);
+ }
+ pv &= PD_MASK;
+ }
+}
+
#ifdef DEBUG
void
pmap_pvdump(pa)
-/* $OpenBSD: pmap.old.c,v 1.15 1996/10/25 11:14:13 deraadt Exp $ */
+/* $OpenBSD: pmap.old.c,v 1.16 1997/01/07 05:37:32 tholo Exp $ */
/* $NetBSD: pmap.c,v 1.36 1996/05/03 19:42:22 christos Exp $ */
/*
splx(s);
}
+void
+pmap_prefault(map, v, l)
+ vm_map_t map;
+ vm_offset_t v;
+ vm_size_t l;
+{
+ vm_offset_t pv, pv2;
+
+ for (pv = v; pv < v + l ; pv += ~PD_MASK + 1) {
+ if (!pmap_pde_v(pmap_pde(map->pmap, pv))) {
+ pv2 = trunc_page(vtopte(pv));
+ vm_fault(map, pv2, VM_PROT_READ, FALSE);
+ }
+ pv &= PD_MASK;
+ }
+}
+
#ifdef DEBUG
void
pmap_pvdump(pa)
-/* $OpenBSD: pmap.h,v 1.7 1996/10/25 11:14:16 deraadt Exp $ */
+/* $OpenBSD: pmap.h,v 1.8 1997/01/07 05:37:34 tholo Exp $ */
/* $NetBSD: pmap.h,v 1.23 1996/05/03 19:26:30 christos Exp $ */
/*
void pmap_bootstrap __P((vm_offset_t start));
boolean_t pmap_testbit __P((vm_offset_t, int));
void pmap_changebit __P((vm_offset_t, int, int));
+void pmap_prefault __P((vm_map_t, vm_offset_t, vm_size_t));
#endif
/*
-/* $OpenBSD: pmap.old.h,v 1.7 1996/10/25 11:14:16 deraadt Exp $ */
+/* $OpenBSD: pmap.old.h,v 1.8 1997/01/07 05:37:34 tholo Exp $ */
/* $NetBSD: pmap.h,v 1.23 1996/05/03 19:26:30 christos Exp $ */
/*
void pmap_bootstrap __P((vm_offset_t start));
boolean_t pmap_testbit __P((vm_offset_t, int));
void pmap_changebit __P((vm_offset_t, int, int));
+void pmap_prefault __P((vm_map_t, vm_offset_t, vm_size_t));
#endif
/*
-/* $OpenBSD: procfs_mem.c,v 1.2 1996/02/27 08:03:36 niklas Exp $ */
+/* $OpenBSD: procfs_mem.c,v 1.3 1997/01/07 05:37:35 tholo Exp $ */
/* $NetBSD: procfs_mem.c,v 1.8 1996/02/09 22:40:50 christos Exp $ */
/*
*/
if (!error)
vm_map_lookup_done(tmap, out_entry);
-
+
+#ifdef __i386__
+ pmap_prefault(map, pageno, PAGE_SIZE);
+#endif
+
/*
* Fault the page in...
*/
-/* $OpenBSD: vm_extern.h,v 1.8 1996/08/02 00:05:58 niklas Exp $ */
+/* $OpenBSD: vm_extern.h,v 1.9 1997/01/07 05:37:35 tholo Exp $ */
/* $NetBSD: vm_extern.h,v 1.20 1996/04/23 12:25:23 christos Exp $ */
/*-
void vnode_pager_setsize __P((struct vnode *, u_long));
void vnode_pager_umount __P((struct mount *));
boolean_t vnode_pager_uncache __P((struct vnode *));
-void vslock __P((caddr_t, u_int));
-void vsunlock __P((caddr_t, u_int));
+int vslock __P((caddr_t, u_int));
+int vsunlock __P((caddr_t, u_int));
/* Machine dependent portion */
void vmapbuf __P((struct buf *, vm_size_t));
-/* $OpenBSD: vm_glue.c,v 1.21 1996/11/23 23:19:54 kstailey Exp $ */
+/* $OpenBSD: vm_glue.c,v 1.22 1997/01/07 05:37:36 tholo Exp $ */
/* $NetBSD: vm_glue.c,v 1.55.4.1 1996/06/13 17:25:45 cgd Exp $ */
/*
}
#endif
-void
+int
vslock(addr, len)
caddr_t addr;
u_int len;
{
- vm_map_pageable(&curproc->p_vmspace->vm_map, trunc_page(addr),
- round_page(addr+len), FALSE);
+#ifdef __i386__
+ pmap_prefault(&curproc->p_vmspace->vm_map, (vm_offset_t)addr, len);
+#endif
+ return vm_map_pageable(&curproc->p_vmspace->vm_map, trunc_page(addr),
+ round_page(addr+len), FALSE);
}
-void
+int
vsunlock(addr, len)
caddr_t addr;
u_int len;
{
- vm_map_pageable(&curproc->p_vmspace->vm_map, trunc_page(addr),
- round_page(addr+len), TRUE);
+ return vm_map_pageable(&curproc->p_vmspace->vm_map, trunc_page(addr),
+ round_page(addr+len), TRUE);
}
/*
-/* $OpenBSD: vm_mmap.c,v 1.6 1996/04/21 22:33:13 deraadt Exp $ */
+/* $OpenBSD: vm_mmap.c,v 1.7 1997/01/07 05:37:37 tholo Exp $ */
/* $NetBSD: vm_mmap.c,v 1.47 1996/03/16 23:15:23 christos Exp $ */
/*
return (error);
#endif
- error = vm_map_pageable(&p->p_vmspace->vm_map, addr, addr+size, FALSE);
+ error = vslock((caddr_t)addr, size);
return (error == KERN_SUCCESS ? 0 : ENOMEM);
}
return (error);
#endif
- error = vm_map_pageable(&p->p_vmspace->vm_map, addr, addr+size, TRUE);
+ error = vsunlock((caddr_t)addr, size);
return (error == KERN_SUCCESS ? 0 : ENOMEM);
}