Index: sys/rump/librump/rumpkern/lwproc.c =================================================================== RCS file: /cvsroot/src/sys/rump/librump/rumpkern/lwproc.c,v retrieving revision 1.32 diff -p -u -r1.32 lwproc.c --- sys/rump/librump/rumpkern/lwproc.c 21 Jan 2015 14:39:37 -0000 1.32 +++ sys/rump/librump/rumpkern/lwproc.c 29 Mar 2015 18:22:00 -0000 @@ -176,7 +176,7 @@ lwproc_newproc(struct proc *parent, int p->p_stats = pstatscopy(parent->p_stats); - p->p_vmspace = vmspace_kernel(); + p->p_vmspace = uvmspace_fork(parent->p_vmspace); p->p_emul = emul_default; #ifdef __HAVE_SYSCALL_INTERN p->p_emul->e_syscall_intern(p); Index: sys/rump/librump/rumpkern/vm.c =================================================================== RCS file: /cvsroot/src/sys/rump/librump/rumpkern/vm.c,v retrieving revision 1.161 diff -p -u -r1.161 vm.c --- sys/rump/librump/rumpkern/vm.c 3 Jan 2015 17:23:51 -0000 1.161 +++ sys/rump/librump/rumpkern/vm.c 29 Mar 2015 18:22:00 -0000 @@ -88,6 +88,9 @@ struct vm_map *kernel_map = &kernel_map_ static struct vm_map module_map_store; extern struct vm_map *module_map; +/* VM space for local users of the rump kernel. */ +struct vmspace vmspace_local_user; + vmem_t *kmem_arena; vmem_t *kmem_va_arena; @@ -375,6 +378,11 @@ uvm_init(void) kernel_map->pmap = pmap_kernel(); + uvmspace_init(&vmspace_local_user, pmap_create(), + round_page(0), + trunc_page(UINTPTR_MAX), + true /* XXX topdown */); + pool_subsystem_init(); kmem_arena = vmem_create("kmem", 0, 1024*1024, PAGE_SIZE, @@ -396,10 +404,17 @@ uvmspace_init(struct vmspace *vm, struct bool topdown) { - vm->vm_map.pmap = pmap_kernel(); + vm->vm_map.pmap = pmap; vm->vm_refcnt = 1; } +struct vmspace * +uvmspace_fork(struct vmspace *parentvm __unused) +{ + + return &vmspace_local_user; +} + void uvm_pagewire(struct vm_page *pg) { Index: sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c =================================================================== RCS file: /cvsroot/src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c,v retrieving revision 1.2 diff -p -u -r1.2 rump_generic_pmap.c --- sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c 12 Feb 2014 22:30:45 -0000 1.2 +++ sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c 29 Mar 2015 18:22:00 -0000 @@ -29,6 +29,7 @@ __KERNEL_RCSID(0, "$NetBSD: rump_generic_pmap.c,v 1.2 2014/02/12 22:30:45 pooka Exp $"); #include +#include #include @@ -39,6 +40,24 @@ __KERNEL_RCSID(0, "$NetBSD: rump_generic struct pmap *const kernel_pmap_ptr = (struct pmap *const)-1; +struct pmap * +pmap_create(void) +{ + struct pmap *pmap; + + /* struct pmap is abstract, so allocate one byte. */ + pmap = kmem_alloc(1, KM_SLEEP); + + return pmap; +} + +void +pmap_destroy(struct pmap *pmap) +{ + + kmem_free(pmap, 1); +} + void pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot, u_int fl) { Index: sys/rump/librump/rumpkern/arch/x86/rump_x86_pmap.c =================================================================== RCS file: /cvsroot/src/sys/rump/librump/rumpkern/arch/x86/rump_x86_pmap.c,v retrieving revision 1.1 diff -p -u -r1.1 rump_x86_pmap.c --- sys/rump/librump/rumpkern/arch/x86/rump_x86_pmap.c 12 Feb 2014 22:28:43 -0000 1.1 +++ sys/rump/librump/rumpkern/arch/x86/rump_x86_pmap.c 29 Mar 2015 18:22:00 -0000 @@ -29,12 +29,30 @@ __KERNEL_RCSID(0, "$NetBSD: rump_x86_pmap.c,v 1.1 2014/02/12 22:28:43 pooka Exp $"); #include +#include #include static struct pmap thepmap; struct pmap *const kernel_pmap_ptr = &thepmap; +struct pmap * +pmap_create(void) +{ + struct pmap *pmap; + + pmap = kmem_alloc(sizeof(struct pmap), KM_SLEEP); + + return pmap; +} + +void +pmap_destroy(struct pmap *pmap) +{ + + kmem_free(pmap, sizeof(*pmap)); +} + void pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot, u_int fl) {