Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Sep 2016 21:40:14 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r306304 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/intel/dtrace cddl/contrib/opensolaris/uts/powerpc/dtrace conf modules/openso...
Message-ID:  <201609242140.u8OLeEwv079058@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Sat Sep 24 21:40:14 2016
New Revision: 306304
URL: https://svnweb.freebsd.org/changeset/base/306304

Log:
  Move implementations of uread() and uwrite() to the illumos compat layer.
  
  MFC after:	1 week

Added:
  head/sys/cddl/compat/opensolaris/kern/opensolaris_proc.c   (contents, props changed)
Modified:
  head/sys/cddl/compat/opensolaris/sys/proc.h
  head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c
  head/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c
  head/sys/conf/files
  head/sys/modules/opensolaris/Makefile

Added: head/sys/cddl/compat/opensolaris/kern/opensolaris_proc.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/cddl/compat/opensolaris/kern/opensolaris_proc.c	Sat Sep 24 21:40:14 2016	(r306304)
@@ -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);
+}

Modified: head/sys/cddl/compat/opensolaris/sys/proc.h
==============================================================================
--- head/sys/cddl/compat/opensolaris/sys/proc.h	Sat Sep 24 20:58:59 2016	(r306303)
+++ head/sys/cddl/compat/opensolaris/sys/proc.h	Sat Sep 24 21:40:14 2016	(r306304)
@@ -92,6 +92,9 @@ do_thread_create(caddr_t stk, size_t stk
 	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_ */

Modified: head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c	Sat Sep 24 20:58:59 2016	(r306303)
+++ head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c	Sat Sep 24 21:40:14 2016	(r306304)
@@ -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

Modified: head/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c	Sat Sep 24 20:58:59 2016	(r306303)
+++ head/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c	Sat Sep 24 21:40:14 2016	(r306304)
@@ -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)
 {

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Sat Sep 24 20:58:59 2016	(r306303)
+++ head/sys/conf/files	Sat Sep 24 21:40:14 2016	(r306304)
@@ -127,6 +127,7 @@ cddl/compat/opensolaris/kern/opensolaris
 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

Modified: head/sys/modules/opensolaris/Makefile
==============================================================================
--- head/sys/modules/opensolaris/Makefile	Sat Sep 24 20:58:59 2016	(r306303)
+++ head/sys/modules/opensolaris/Makefile	Sat Sep 24 21:40:14 2016	(r306304)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201609242140.u8OLeEwv079058>