diff --git a/sys/rump/librump/rumpkern/lwproc.c b/sys/rump/librump/rumpkern/lwproc.c index 1835671b7f52..c1b69fc0a29f 100644 --- a/sys/rump/librump/rumpkern/lwproc.c +++ b/sys/rump/librump/rumpkern/lwproc.c @@ -1,4 +1,4 @@ -/* $NetBSD: lwproc.c,v 1.9 2011/01/12 12:51:21 pooka Exp $ */ +/* $NetBSD: lwproc.c,v 1.10 2011/01/13 15:38:29 pooka Exp $ */ /* * Copyright (c) 2010, 2011 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.9 2011/01/12 12:51:21 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.10 2011/01/13 15:38:29 pooka Exp $"); #include #include @@ -78,7 +78,7 @@ lwproc_proc_free(struct proc *p) cv_destroy(&p->p_lwpcv); /* non-kernel vmspaces are not shared */ - if (p->p_vmspace != vmspace_kernel()) { + if (!RUMP_LOCALPROC_P(p)) { KASSERT(p->p_vmspace->vm_refcnt == 1); kmem_free(p->p_vmspace, sizeof(*p->p_vmspace)); } diff --git a/sys/rump/librump/rumpkern/rump_private.h b/sys/rump/librump/rumpkern/rump_private.h index f688f3c85569..1a405301930e 100644 --- a/sys/rump/librump/rumpkern/rump_private.h +++ b/sys/rump/librump/rumpkern/rump_private.h @@ -1,4 +1,4 @@ -/* $NetBSD: rump_private.h,v 1.68 2011/01/11 09:22:32 pooka Exp $ */ +/* $NetBSD: rump_private.h,v 1.69 2011/01/13 15:38:29 pooka Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -88,6 +88,8 @@ do { \ #define RUMPMEM_UNLIMITED ((unsigned long)-1) extern unsigned long rump_physmemlimit; +#define RUMP_LOCALPROC_P(p) (p->p_vmspace == vmspace_kernel()) + void rump_component_init(enum rump_component_type); int rump_component_count(enum rump_component_type); diff --git a/sys/rump/librump/rumpkern/rumpcopy.c b/sys/rump/librump/rumpkern/rumpcopy.c index b8e67f63a47f..4d63a552a264 100644 --- a/sys/rump/librump/rumpkern/rumpcopy.c +++ b/sys/rump/librump/rumpkern/rumpcopy.c @@ -1,4 +1,4 @@ -/* $NetBSD: rumpcopy.c,v 1.15 2011/01/09 14:12:37 pooka Exp $ */ +/* $NetBSD: rumpcopy.c,v 1.16 2011/01/13 15:38:29 pooka Exp $ */ /* * Copyright (c) 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rumpcopy.c,v 1.15 2011/01/09 14:12:37 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rumpcopy.c,v 1.16 2011/01/13 15:38:29 pooka Exp $"); #include #include @@ -46,7 +46,7 @@ copyin(const void *uaddr, void *kaddr, size_t len) return EFAULT; } - if (curproc->p_vmspace == vmspace_kernel()) { + if (RUMP_LOCALPROC_P(curproc)) { memcpy(kaddr, uaddr, len); } else if (len) { error = rumpuser_sp_copyin(curproc->p_vmspace->vm_map.pmap, @@ -65,7 +65,7 @@ copyout(const void *kaddr, void *uaddr, size_t len) return EFAULT; } - if (curproc->p_vmspace == vmspace_kernel()) { + if (RUMP_LOCALPROC_P(curproc)) { memcpy(uaddr, kaddr, len); } else if (len) { error = rumpuser_sp_copyout(curproc->p_vmspace->vm_map.pmap, @@ -79,7 +79,7 @@ subyte(void *uaddr, int byte) { int error = 0; - if (curproc->p_vmspace == vmspace_kernel()) + if (RUMP_LOCALPROC_P(curproc)) *(char *)uaddr = byte; else error = rumpuser_sp_copyout(curproc->p_vmspace->vm_map.pmap, @@ -115,7 +115,7 @@ copyinstr(const void *uaddr, void *kaddr, size_t len, size_t *done) if (len == 0) return 0; - if (curproc->p_vmspace == vmspace_kernel()) + if (RUMP_LOCALPROC_P(curproc)) return copystr(uaddr, kaddr, len, done); if ((rv = rumpuser_sp_copyinstr(curproc->p_vmspace->vm_map.pmap, @@ -144,7 +144,7 @@ copyoutstr(const void *kaddr, void *uaddr, size_t len, size_t *done) size_t slen; int error; - if (curproc->p_vmspace == vmspace_kernel()) + if (RUMP_LOCALPROC_P(curproc)) return copystr(kaddr, uaddr, len, done); slen = strlen(kaddr)+1; diff --git a/sys/rump/librump/rumpkern/vm.c b/sys/rump/librump/rumpkern/vm.c index 2152e06d3a66..e0e96d04a379 100644 --- a/sys/rump/librump/rumpkern/vm.c +++ b/sys/rump/librump/rumpkern/vm.c @@ -1,4 +1,4 @@ -/* $NetBSD: vm.c,v 1.105 2011/01/08 09:40:05 pooka Exp $ */ +/* $NetBSD: vm.c,v 1.106 2011/01/13 15:38:29 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.105 2011/01/08 09:40:05 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.106 2011/01/13 15:38:29 pooka Exp $"); #include #include @@ -378,7 +378,7 @@ uvm_mmap(struct vm_map *map, vaddr_t *addr, vsize_t size, vm_prot_t prot, if (*addr != 0) panic("uvm_mmap() variant unsupported"); - if (curproc->p_vmspace == vmspace_kernel()) { + if (RUMP_LOCALPROC_P(curproc)) { uaddr = rumpuser_anonmmap(NULL, size, 0, 0, &error); } else { error = rumpuser_sp_anonmmap(curproc->p_vmspace->vm_map.pmap, @@ -763,7 +763,7 @@ vmapbuf(struct buf *bp, vsize_t len) bp->b_saveaddr = bp->b_data; /* remote case */ - if (curproc->p_vmspace != vmspace_kernel()) { + if (!RUMP_LOCALPROC_P(curproc)) { bp->b_data = rump_hypermalloc(len, 0, true, "vmapbuf"); if (BUF_ISWRITE(bp)) { copyin(bp->b_saveaddr, bp->b_data, len); @@ -776,7 +776,7 @@ vunmapbuf(struct buf *bp, vsize_t len) { /* remote case */ - if (bp->b_proc->p_vmspace != vmspace_kernel()) { + if (!RUMP_LOCALPROC_P(bp->b_proc)) { if (BUF_ISREAD(bp)) { copyout_proc(bp->b_proc, bp->b_data, bp->b_saveaddr, len);