Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump/librump/rumpkern Introduce RUMP_LOCALPROC_P() macro...
details: https://anonhg.NetBSD.org/src/rev/5377284c203c
branches: trunk
changeset: 760819:5377284c203c
user: pooka <pooka%NetBSD.org@localhost>
date: Thu Jan 13 15:38:29 2011 +0000
description:
Introduce RUMP_LOCALPROC_P() macro and use it.
diffstat:
sys/rump/librump/rumpkern/lwproc.c | 6 +++---
sys/rump/librump/rumpkern/rump_private.h | 4 +++-
sys/rump/librump/rumpkern/rumpcopy.c | 14 +++++++-------
sys/rump/librump/rumpkern/vm.c | 10 +++++-----
4 files changed, 18 insertions(+), 16 deletions(-)
diffs (153 lines):
diff -r 240525bf843e -r 5377284c203c sys/rump/librump/rumpkern/lwproc.c
--- a/sys/rump/librump/rumpkern/lwproc.c Thu Jan 13 14:34:16 2011 +0000
+++ b/sys/rump/librump/rumpkern/lwproc.c Thu Jan 13 15:38:29 2011 +0000
@@ -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 <sys/cdefs.h>
-__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 <sys/param.h>
#include <sys/atomic.h>
@@ -78,7 +78,7 @@
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 -r 240525bf843e -r 5377284c203c sys/rump/librump/rumpkern/rump_private.h
--- a/sys/rump/librump/rumpkern/rump_private.h Thu Jan 13 14:34:16 2011 +0000
+++ b/sys/rump/librump/rumpkern/rump_private.h Thu Jan 13 15:38:29 2011 +0000
@@ -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 @@
#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 -r 240525bf843e -r 5377284c203c sys/rump/librump/rumpkern/rumpcopy.c
--- a/sys/rump/librump/rumpkern/rumpcopy.c Thu Jan 13 14:34:16 2011 +0000
+++ b/sys/rump/librump/rumpkern/rumpcopy.c Thu Jan 13 15:38:29 2011 +0000
@@ -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 <sys/cdefs.h>
-__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 <sys/param.h>
#include <sys/lwp.h>
@@ -46,7 +46,7 @@
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 @@
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 @@
{
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 @@
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 @@
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 -r 240525bf843e -r 5377284c203c sys/rump/librump/rumpkern/vm.c
--- a/sys/rump/librump/rumpkern/vm.c Thu Jan 13 14:34:16 2011 +0000
+++ b/sys/rump/librump/rumpkern/vm.c Thu Jan 13 15:38:29 2011 +0000
@@ -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 <sys/cdefs.h>
-__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 <sys/param.h>
#include <sys/atomic.h>
@@ -378,7 +378,7 @@
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 @@
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 @@
{
/* 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);
Home |
Main Index |
Thread Index |
Old Index