Module Name: src Committed By: pooka Date: Mon Jul 12 21:00:48 UTC 2010
Modified Files: src/sys/rump/librump/rumpkern: rumpcopy.c Log Message: Implement poor man's (or woman's) fault handler (or handlim). from Stan (or Loretta) To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/rump/librump/rumpkern/rumpcopy.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/rump/librump/rumpkern/rumpcopy.c diff -u src/sys/rump/librump/rumpkern/rumpcopy.c:1.3 src/sys/rump/librump/rumpkern/rumpcopy.c:1.4 --- src/sys/rump/librump/rumpkern/rumpcopy.c:1.3 Thu Jun 10 21:40:42 2010 +++ src/sys/rump/librump/rumpkern/rumpcopy.c Mon Jul 12 21:00:47 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpcopy.c,v 1.3 2010/06/10 21:40:42 pooka Exp $ */ +/* $NetBSD: rumpcopy.c,v 1.4 2010/07/12 21:00:47 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.3 2010/06/10 21:40:42 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rumpcopy.c,v 1.4 2010/07/12 21:00:47 pooka Exp $"); #include <sys/param.h> #include <sys/lwp.h> @@ -40,10 +40,13 @@ copyin(const void *uaddr, void *kaddr, size_t len) { - if (curproc->p_vmspace == &vmspace0) + if (curproc->p_vmspace == &vmspace0) { + if (uaddr == NULL) + return EFAULT; memcpy(kaddr, uaddr, len); - else + } else { rump_sysproxy_copyin(uaddr, kaddr, len); + } return 0; } @@ -51,10 +54,13 @@ copyout(const void *kaddr, void *uaddr, size_t len) { - if (curproc->p_vmspace == &vmspace0) + if (curproc->p_vmspace == &vmspace0) { + if (uaddr == NULL) + return EFAULT; memcpy(uaddr, kaddr, len); - else + } else { rump_sysproxy_copyout(kaddr, uaddr, len); + } return 0; }