diff options
author | Mark Johnston <markj@FreeBSD.org> | 2016-09-24 21:40:14 +0000 |
---|---|---|
committer | Mark Johnston <markj@FreeBSD.org> | 2016-09-24 21:40:14 +0000 |
commit | 9e579a58c364cb29e76e8e4c630df63e97d42780 (patch) | |
tree | 484d7299a69ad5f92d520039496304c00f5a320b | |
parent | 788f3c06f6c3a552f9a8ae7ec705591f7ba36f48 (diff) | |
download | src-9e579a58c364cb29e76e8e4c630df63e97d42780.tar.gz src-9e579a58c364cb29e76e8e4c630df63e97d42780.zip |
Move implementations of uread() and uwrite() to the illumos compat layer.
MFC after: 1 week
Notes
Notes:
svn path=/head/; revision=306304
-rw-r--r-- | sys/cddl/compat/opensolaris/kern/opensolaris_proc.c | 57 | ||||
-rw-r--r-- | sys/cddl/compat/opensolaris/sys/proc.h | 3 | ||||
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c | 28 | ||||
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c | 26 | ||||
-rw-r--r-- | sys/conf/files | 1 | ||||
-rw-r--r-- | sys/modules/opensolaris/Makefile | 1 |
6 files changed, 63 insertions, 53 deletions
diff --git a/sys/cddl/compat/opensolaris/kern/opensolaris_proc.c b/sys/cddl/compat/opensolaris/kern/opensolaris_proc.c new file mode 100644 index 000000000000..652fa8928589 --- /dev/null +++ b/sys/cddl/compat/opensolaris/kern/opensolaris_proc.c @@ -0,0 +1,57 @@ +/*- + * Copyright 2016 Mark Johnston <markj@FreeBSD.org> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <sys/types.h> +#include <sys/proc.h> +#include <sys/ptrace.h> + +int +uread(proc_t *p, void *kaddr, size_t len, uintptr_t uaddr) +{ + ssize_t n; + + PHOLD(p); + n = proc_readmem(curthread, p, uaddr, kaddr, len); + PRELE(p); + if (n != len) + return (ENOMEM); + return (0); +} + +int +uwrite(proc_t *p, void *kaddr, size_t len, uintptr_t uaddr) +{ + ssize_t n; + + PHOLD(p); + n = proc_writemem(curthread, p, uaddr, kaddr, len); + PRELE(p); + if (n != len) + return (ENOMEM); + return (0); +} diff --git a/sys/cddl/compat/opensolaris/sys/proc.h b/sys/cddl/compat/opensolaris/sys/proc.h index 5c9e8dec78c4..ce503cf724ac 100644 --- a/sys/cddl/compat/opensolaris/sys/proc.h +++ b/sys/cddl/compat/opensolaris/sys/proc.h @@ -92,6 +92,9 @@ do_thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg, do_thread_create(stk, stksize, proc, arg, len, pp, state, pri) #define thread_exit() kthread_exit() +int uread(proc_t *, void *, size_t, uintptr_t); +int uwrite(proc_t *, void *, size_t, uintptr_t); + #endif /* _KERNEL */ #endif /* _OPENSOLARIS_SYS_PROC_H_ */ diff --git a/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c b/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c index 8555e2ff3335..e1f95de8a8d8 100644 --- a/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c +++ b/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c @@ -59,34 +59,8 @@ #include <sys/archsystm.h> #else #include <sys/ptrace.h> - -static int -uread(proc_t *p, void *kaddr, size_t len, uintptr_t uaddr) -{ - ssize_t n; - - PHOLD(p); - n = proc_readmem(curthread, p, uaddr, kaddr, len); - PRELE(p); - if (n != len) - return (ENOMEM); - return (0); -} - -static int -uwrite(proc_t *p, void *kaddr, size_t len, uintptr_t uaddr) -{ - ssize_t n; - - PHOLD(p); - n = proc_writemem(curthread, p, uaddr, kaddr, len); - PRELE(p); - if (n != len) - return (ENOMEM); - return (0); -} - #endif /* illumos */ + #ifdef __i386__ #define r_rax r_eax #define r_rbx r_ebx diff --git a/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c b/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c index e8dd684a4530..b0fc5816c5e3 100644 --- a/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c +++ b/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c @@ -44,32 +44,6 @@ #define OP_RA(x) (((x) & 0x001F0000) >> 16) #define OP_RB(x) (((x) & 0x0000F100) >> 11) -static int -uread(proc_t *p, void *kaddr, size_t len, uintptr_t uaddr) -{ - ssize_t n; - - PHOLD(p); - n = proc_readmem(curthread, p, uaddr, kaddr, len); - PRELE(p); - if (n <= 0 || n < len) - return (ENOMEM); - return (0); -} - -static int -uwrite(proc_t *p, void *kaddr, size_t len, uintptr_t uaddr) -{ - ssize_t n; - - PHOLD(p); - n = proc_writemem(curthread, p, uaddr, kaddr, len); - PRELE(p); - if (n <= 0 || n < len) - return (ENOMEM); - return (0); -} - int fasttrap_tracepoint_install(proc_t *p, fasttrap_tracepoint_t *tp) { diff --git a/sys/conf/files b/sys/conf/files index 37683bd47eed..296549639dfb 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -127,6 +127,7 @@ cddl/compat/opensolaris/kern/opensolaris.c optional zfs | dtrace compile-with " cddl/compat/opensolaris/kern/opensolaris_cmn_err.c optional zfs | dtrace compile-with "${CDDL_C}" cddl/compat/opensolaris/kern/opensolaris_kmem.c optional zfs | dtrace compile-with "${CDDL_C}" cddl/compat/opensolaris/kern/opensolaris_misc.c optional zfs | dtrace compile-with "${CDDL_C}" +cddl/compat/opensolaris/kern/opensolaris_proc.c optional zfs | dtrace compile-with "${CDDL_C}" cddl/compat/opensolaris/kern/opensolaris_sunddi.c optional zfs | dtrace compile-with "${CDDL_C}" cddl/compat/opensolaris/kern/opensolaris_taskq.c optional zfs | dtrace compile-with "${CDDL_C}" # zfs specific diff --git a/sys/modules/opensolaris/Makefile b/sys/modules/opensolaris/Makefile index 1620ab971989..c22c64c6367b 100644 --- a/sys/modules/opensolaris/Makefile +++ b/sys/modules/opensolaris/Makefile @@ -9,6 +9,7 @@ SRCS= opensolaris.c \ opensolaris_cmn_err.c \ opensolaris_kmem.c \ opensolaris_misc.c \ + opensolaris_proc.c \ opensolaris_sunddi.c _A=${SYSDIR}/cddl/contrib/opensolaris/common/atomic |