PERFORCE change 178688 for review

Alexander Motin mav at FreeBSD.org
Mon May 24 04:03:39 UTC 2010


http://p4web.freebsd.org/@@178688?ac=10

Change 178688 by mav at mav_mavtest on 2010/05/24 04:02:54

	IFC

Affected files ...

.. //depot/projects/scottl-camlock/src/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c#3 integrate
.. //depot/projects/scottl-camlock/src/release/doc/en_US.ISO8859-1/hardware/article.sgml#9 integrate
.. //depot/projects/scottl-camlock/src/share/man/man4/mvs.4#4 integrate
.. //depot/projects/scottl-camlock/src/sys/amd64/amd64/elf_machdep.c#10 integrate
.. //depot/projects/scottl-camlock/src/sys/amd64/amd64/local_apic.c#29 delete
.. //depot/projects/scottl-camlock/src/sys/amd64/amd64/trap.c#29 integrate
.. //depot/projects/scottl-camlock/src/sys/amd64/ia32/ia32_syscall.c#10 integrate
.. //depot/projects/scottl-camlock/src/sys/amd64/include/proc.h#8 integrate
.. //depot/projects/scottl-camlock/src/sys/amd64/linux32/linux32_sysvec.c#21 integrate
.. //depot/projects/scottl-camlock/src/sys/arm/arm/elf_machdep.c#9 integrate
.. //depot/projects/scottl-camlock/src/sys/arm/arm/trap.c#15 integrate
.. //depot/projects/scottl-camlock/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c#12 integrate
.. //depot/projects/scottl-camlock/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c#12 integrate
.. //depot/projects/scottl-camlock/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c#7 integrate
.. //depot/projects/scottl-camlock/src/sys/cddl/dev/systrace/systrace.c#2 integrate
.. //depot/projects/scottl-camlock/src/sys/compat/ia32/ia32_sysvec.c#13 integrate
.. //depot/projects/scottl-camlock/src/sys/compat/ia32/ia32_util.h#2 integrate
.. //depot/projects/scottl-camlock/src/sys/compat/svr4/svr4_sysvec.c#8 integrate
.. //depot/projects/scottl-camlock/src/sys/conf/files#77 integrate
.. //depot/projects/scottl-camlock/src/sys/conf/files.amd64#30 integrate
.. //depot/projects/scottl-camlock/src/sys/conf/files.i386#30 integrate
.. //depot/projects/scottl-camlock/src/sys/conf/files.pc98#23 integrate
.. //depot/projects/scottl-camlock/src/sys/i386/i386/elf_machdep.c#11 integrate
.. //depot/projects/scottl-camlock/src/sys/i386/i386/local_apic.c#30 delete
.. //depot/projects/scottl-camlock/src/sys/i386/i386/trap.c#25 integrate
.. //depot/projects/scottl-camlock/src/sys/i386/ibcs2/ibcs2_sysvec.c#7 integrate
.. //depot/projects/scottl-camlock/src/sys/i386/include/proc.h#9 integrate
.. //depot/projects/scottl-camlock/src/sys/i386/linux/linux_sysvec.c#19 integrate
.. //depot/projects/scottl-camlock/src/sys/ia64/ia32/ia32_trap.c#7 integrate
.. //depot/projects/scottl-camlock/src/sys/ia64/ia64/elf_machdep.c#13 integrate
.. //depot/projects/scottl-camlock/src/sys/ia64/ia64/trap.c#20 integrate
.. //depot/projects/scottl-camlock/src/sys/ia64/include/proc.h#6 integrate
.. //depot/projects/scottl-camlock/src/sys/kern/imgact_aout.c#9 integrate
.. //depot/projects/scottl-camlock/src/sys/kern/init_main.c#24 integrate
.. //depot/projects/scottl-camlock/src/sys/kern/kern_exec.c#27 integrate
.. //depot/projects/scottl-camlock/src/sys/kern/kern_sig.c#34 integrate
.. //depot/projects/scottl-camlock/src/sys/kern/subr_trap.c#17 integrate
.. //depot/projects/scottl-camlock/src/sys/kern/sys_process.c#24 integrate
.. //depot/projects/scottl-camlock/src/sys/mips/mips/elf64_machdep.c#4 integrate
.. //depot/projects/scottl-camlock/src/sys/mips/mips/elf_machdep.c#9 integrate
.. //depot/projects/scottl-camlock/src/sys/mips/mips/trap.c#8 integrate
.. //depot/projects/scottl-camlock/src/sys/modules/ata/atadisk/Makefile#2 integrate
.. //depot/projects/scottl-camlock/src/sys/modules/cam/Makefile#16 integrate
.. //depot/projects/scottl-camlock/src/sys/modules/uart/Makefile#10 integrate
.. //depot/projects/scottl-camlock/src/sys/modules/zfs/Makefile#12 integrate
.. //depot/projects/scottl-camlock/src/sys/powerpc/aim/trap.c#9 integrate
.. //depot/projects/scottl-camlock/src/sys/powerpc/booke/trap.c#5 integrate
.. //depot/projects/scottl-camlock/src/sys/powerpc/include/proc.h#4 integrate
.. //depot/projects/scottl-camlock/src/sys/powerpc/powerpc/elf_machdep.c#11 integrate
.. //depot/projects/scottl-camlock/src/sys/sparc64/include/proc.h#6 integrate
.. //depot/projects/scottl-camlock/src/sys/sparc64/sparc64/elf_machdep.c#12 integrate
.. //depot/projects/scottl-camlock/src/sys/sparc64/sparc64/trap.c#22 integrate
.. //depot/projects/scottl-camlock/src/sys/sun4v/include/proc.h#3 integrate
.. //depot/projects/scottl-camlock/src/sys/sun4v/sun4v/trap.c#9 integrate
.. //depot/projects/scottl-camlock/src/sys/sys/proc.h#34 integrate
.. //depot/projects/scottl-camlock/src/sys/sys/ptrace.h#9 integrate
.. //depot/projects/scottl-camlock/src/sys/sys/sysent.h#14 integrate
.. //depot/projects/scottl-camlock/src/tools/regression/bin/sh/builtins/wait1.0#1 branch
.. //depot/projects/scottl-camlock/src/tools/regression/bin/sh/builtins/wait2.0#1 branch
.. //depot/projects/scottl-camlock/src/usr.sbin/iostat/iostat.8#3 integrate

Differences ...

==== //depot/projects/scottl-camlock/src/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c#3 (text+ko) ====

@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -1209,10 +1209,12 @@
 
 	/*
 	 * And mount all the datasets, keeping track of which ones
-	 * succeeded or failed. By using zfs_alloc(), the good pointer
-	 * will always be non-NULL.
+	 * succeeded or failed.
 	 */
-	good = zfs_alloc(zhp->zpool_hdl, cb.cb_used * sizeof (int));
+	if ((good = zfs_alloc(zhp->zpool_hdl,
+	    cb.cb_used * sizeof (int))) == NULL)
+		goto out;
+
 	ret = 0;
 	for (i = 0; i < cb.cb_used; i++) {
 		if (zfs_mount(cb.cb_datasets[i], mntopts, flags) != 0)

==== //depot/projects/scottl-camlock/src/release/doc/en_US.ISO8859-1/hardware/article.sgml#9 (text+ko) ====

@@ -17,7 +17,7 @@
 
     <corpauthor>The &os; Documentation Project</corpauthor>
 
-    <pubdate>$FreeBSD: src/release/doc/en_US.ISO8859-1/hardware/article.sgml,v 1.362 2010/05/13 03:56:57 brueffer Exp $</pubdate>
+    <pubdate>$FreeBSD: src/release/doc/en_US.ISO8859-1/hardware/article.sgml,v 1.364 2010/05/23 20:00:12 nwhitehorn Exp $</pubdate>
 
     <copyright>
       <year>2000</year>
@@ -36,6 +36,7 @@
     <legalnotice id="trademarks" role="trademarks">
       &tm-attrib.freebsd;
       &tm-attrib.amd;
+      &tm-attrib.fujitsu;
       &tm-attrib.ibm;
       &tm-attrib.intel;
       &tm-attrib.sparc;
@@ -326,12 +327,18 @@
 
       <para>All systems listed below are fully supported, with the
 	exception that software fan control is currently missing on
-	the Power Macintosh G5. SMP is supported on all systems with
-	more than 1 processor.</para>
+	some Power Macintosh G5 models. SMP is supported on all systems
+	with more than 1 processor.</para>
 
       <itemizedlist>
 	<listitem>
-	  <para>Apple iMac</para>
+	  <para>Apple iMac G3</para>
+	</listitem>
+	<listitem>
+	  <para>Apple iMac G4</para>
+	</listitem>
+	<listitem>
+	  <para>Apple iMac G5</para>
 	</listitem>
 	<listitem>
 	  <para>Apple Power Macintosh G3 (Blue & White)</para>
@@ -340,10 +347,16 @@
 	  <para>Apple Power Macintosh G4</para>
 	</listitem>
 	<listitem>
-	  <para>Apple Power Macintosh G5 (non-970MP models)</para>
+	  <para>Apple Power Macintosh G5</para>
+	</listitem>
+	<listitem>
+	  <para>Apple iBook G3</para>
+	</listitem>
+	<listitem>
+	  <para>Apple iBook G4</para>
 	</listitem>
 	<listitem>
-	  <para>Apple iBook</para>
+	  <para>Apple PowerBook G3 (Lombard and Pismo)</para>
 	</listitem>
 	<listitem>
 	  <para>Apple PowerBook G4</para>
@@ -367,7 +380,8 @@
       <title>sparc64</title>
 
       <para>This section describes the systems currently known to be
-	supported by &os; on the &ultrasparc; platform.  For
+	supported by &os; on the &fujitsu; &sparc64; and &sun; &ultrasparc;
+	platforms.  For
 	background information on the various hardware designs see the
 	<ulink url="http://sunsolve.sun.com/handbook_pub/">Sun System
 	  Handbook</ulink>.</para>
@@ -392,6 +406,10 @@
 
       <itemizedlist>
 	<listitem>
+	  <para>Naturetech GENIALstation 777S</para>
+	</listitem>
+
+	<listitem>
 	  <para>&sun.blade; 100</para>
 	</listitem>
 
@@ -400,7 +418,7 @@
 	</listitem>
 
 	<listitem>
-	  <para>&sun.enterprise; 100</para>
+	  <para>&sun.enterprise; 150</para>
 	</listitem>
 
 	<listitem>
@@ -420,6 +438,11 @@
 	</listitem>
 
 	<listitem>
+	  <para>&sun.fire; B100s (support for the on-board NICs first
+	    appeared in 8.1-RELEASE)</para>
+	</listitem>
+
+	<listitem>
 	  <para>&sun.fire; V100</para>
 	</listitem>
 
@@ -428,51 +451,55 @@
 	</listitem>
 
 	<listitem>
-	  <para>&netra; t1 105</para>
+	  <para>&sun; &netra; t1 100/105</para>
+	</listitem>
+
+	<listitem>
+	  <para>&sun; &netra; T1 AC200/DC200</para>
 	</listitem>
 
 	<listitem>
-	  <para>&netra; T1 AC200/DC200</para>
+	  <para>&sun; &netra; t 1100</para>
 	</listitem>
 
 	<listitem>
-	  <para>&netra; t 1100</para>
+	  <para>&sun; &netra; t 1120</para>
 	</listitem>
 
 	<listitem>
-	  <para>&netra; t 1120</para>
+	  <para>&sun; &netra; t 1125</para>
 	</listitem>
 
 	<listitem>
-	  <para>&netra; t 1125</para>
+	  <para>&sun; &netra; t 1400/1405</para>
 	</listitem>
 
 	<listitem>
-	  <para>&netra; t 1400/1405</para>
+	  <para>&sun; &netra; 120</para>
 	</listitem>
 
 	<listitem>
-	  <para>&netra; 120</para>
+	  <para>&sun; &netra; X1</para>
 	</listitem>
 
 	<listitem>
-	  <para>&netra; X1</para>
+	  <para>&sun; &sparcengine; Ultra AX1105</para>
 	</listitem>
 
 	<listitem>
-	  <para>&sparcengine; Ultra AX1105</para>
+	  <para>&sun; &sparcengine; Ultra AXe</para>
 	</listitem>
 
 	<listitem>
-	  <para>&sparcengine; Ultra AXe</para>
+	  <para>&sun; &sparcengine; Ultra AXi</para>
 	</listitem>
 
 	<listitem>
-	  <para>&sparcengine; Ultra AXi</para>
+	  <para>&sun; &sparcengine; Ultra AXmp</para>
 	</listitem>
 
 	<listitem>
-	  <para>&sparcengine; Ultra AXmp</para>
+	  <para>&sun; &sparcengine; CP1500</para>
 	</listitem>
 
 	<listitem>
@@ -528,7 +555,7 @@
 	</listitem>
       </itemizedlist>
 
-      <para>Starting with 7.2-RELEASE, &arch.sparc64; systems based on
+      <para>Starting with 7.2-RELEASE, &arch.sparc64; systems based on &sun;
 	&ultrasparc; III and beyond are also supported by &os;, which includes
 	the following known working systems:</para>
 
@@ -580,11 +607,16 @@
 	</listitem>
 
 	<listitem>
+	  <para>&sun.fire; V890 (support first appeared in 8.1-RELEASE,
+	    non-mixed &ultrasparc; IV/IV+ CPU-configurations only)</para>
+	</listitem>
+
+	<listitem>
 	  <para>&netra; 20/&netra; T4</para>
 	</listitem>
       </itemizedlist>
 
-      <para>The following &ultrasparc; IIIi systems are not tested but
+      <para>The following &sun; &ultrasparc; systems are not tested but
 	believed to be also supported by &os;:</para>
 
       <itemizedlist>
@@ -599,7 +631,40 @@
 	<listitem>
 	  <para>&sun.fire; V245 (support first appeared in 7.3-RELEASE)</para>
 	</listitem>
+
+	<listitem>
+	  <para>&sun.fire; V490 (support first appeared in 8.1-RELEASE,
+	    non-mixed &ultrasparc; IV/IV+ CPU-configurations only)</para>
+	</listitem>
+      </itemizedlist>
+
+      <para>Starting with 8.1-RELEASE, &arch.sparc64; systems based on
+	&fujitsu; &sparc64; V are also supported by &os;, which
+	includes the following known working systems:</para>
+
+      <itemizedlist>
+	<listitem>
+	  <para>&fujitsu; &primepower; 250</para>
+	</listitem>
       </itemizedlist>
+
+      <para>The following &fujitsu; &primepower; systems are not tested but
+	believed to be also supported by &os;:</para>
+
+      <itemizedlist>
+	<listitem>
+	  <para>&fujitsu; &primepower; 450</para>
+	</listitem>
+
+	<listitem>
+	  <para>&fujitsu; &primepower; 650</para>
+	</listitem>
+
+	<listitem>
+	  <para>&fujitsu; &primepower; 850</para>
+	</listitem>
+      </itemizedlist>
+
     </sect2>
   </sect1>
 

==== //depot/projects/scottl-camlock/src/share/man/man4/mvs.4#4 (text+ko) ====

@@ -23,7 +23,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/share/man/man4/ahci.4,v 1.6 2010/03/04 11:09:49 mav Exp $
+.\" $FreeBSD: src/share/man/man4/mvs.4,v 1.2 2010/05/23 14:11:27 mav Exp $
 .\"
 .Dd April 27, 2010
 .Dt MVS 4
@@ -171,6 +171,6 @@
 The
 .Nm
 driver first appeared in
-.Fx 9.0 .
+.Fx 8.1 .
 .Sh AUTHORS
 .An Alexander Motin Aq mav at FreeBSD.org .

==== //depot/projects/scottl-camlock/src/sys/amd64/amd64/elf_machdep.c#10 (text+ko) ====

@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/elf_machdep.c,v 1.33 2009/10/03 11:57:21 bz Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/elf_machdep.c,v 1.34 2010/05/23 18:32:02 kib Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -32,6 +32,7 @@
 #include <sys/exec.h>
 #include <sys/imgact.h>
 #include <sys/linker.h>
+#include <sys/proc.h>
 #include <sys/sysent.h>
 #include <sys/imgact_elf.h>
 #include <sys/syscall.h>
@@ -74,7 +75,10 @@
 	.sv_setregs	= exec_setregs,
 	.sv_fixlimit	= NULL,
 	.sv_maxssiz	= NULL,
-	.sv_flags	= SV_ABI_FREEBSD | SV_LP64
+	.sv_flags	= SV_ABI_FREEBSD | SV_LP64,
+	.sv_set_syscall_retval = cpu_set_syscall_retval,
+	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
+	.sv_syscallnames = syscallnames,
 };
 
 static Elf64_Brandinfo freebsd_brand_info = {

==== //depot/projects/scottl-camlock/src/sys/amd64/amd64/trap.c#29 (text+ko) ====

@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/trap.c,v 1.343 2010/05/12 10:29:06 kib Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/trap.c,v 1.344 2010/05/23 18:32:02 kib Exp $");
 
 /*
  * AMD64 Trap and System call handling
@@ -76,7 +76,6 @@
 #ifdef HWPMC_HOOKS
 #include <sys/pmckern.h>
 #endif
-#include <security/audit/audit.h>
 
 #include <vm/vm.h>
 #include <vm/vm_param.h>
@@ -170,8 +169,6 @@
 SYSCTL_INT(_machdep, OID_AUTO, prot_fault_translation, CTLFLAG_RW,
 	&prot_fault_translation, 0, "Select signal to deliver on protection fault");
 
-extern char *syscallnames[];
-
 /*
  * Exception, fault, and trap interface to the FreeBSD kernel.
  * This common code is called from assembly language IDT gate entry
@@ -805,19 +802,12 @@
 	panic("double fault");
 }
 
-struct syscall_args {
-	u_int code;
-	struct sysent *callp;
-	register_t args[8];
-	register_t *argp;
-	int narg;
-};
-
-static int
-fetch_syscall_args(struct thread *td, struct syscall_args *sa)
+int
+cpu_fetch_syscall_args(struct thread *td, struct syscall_args *sa)
 {
 	struct proc *p;
 	struct trapframe *frame;
+	register_t *argp;
 	caddr_t params;
 	int reg, regcnt, error;
 
@@ -829,15 +819,10 @@
 	params = (caddr_t)frame->tf_rsp + sizeof(register_t);
 	sa->code = frame->tf_rax;
 
-	if (p->p_sysent->sv_prepsyscall) {
-		(*p->p_sysent->sv_prepsyscall)(frame, (int *)sa->args,
-		    &sa->code, &params);
-	} else {
-		if (sa->code == SYS_syscall || sa->code == SYS___syscall) {
-			sa->code = frame->tf_rdi;
-			reg++;
-			regcnt--;
-		}
+	if (sa->code == SYS_syscall || sa->code == SYS___syscall) {
+		sa->code = frame->tf_rdi;
+		reg++;
+		regcnt--;
 	}
  	if (p->p_sysent->sv_mask)
  		sa->code &= p->p_sysent->sv_mask;
@@ -851,24 +836,20 @@
 	KASSERT(sa->narg <= sizeof(sa->args) / sizeof(sa->args[0]),
 	    ("Too many syscall arguments!"));
 	error = 0;
-	sa->argp = &frame->tf_rdi;
-	sa->argp += reg;
-	bcopy(sa->argp, sa->args, sizeof(sa->args[0]) * regcnt);
+	argp = &frame->tf_rdi;
+	argp += reg;
+	bcopy(argp, sa->args, sizeof(sa->args[0]) * regcnt);
 	if (sa->narg > regcnt) {
 		KASSERT(params != NULL, ("copyin args with no params!"));
 		error = copyin(params, &sa->args[regcnt],
 	    	    (sa->narg - regcnt) * sizeof(sa->args[0]));
 	}
-	sa->argp = &sa->args[0];
+
+	if (error == 0) {
+		td->td_retval[0] = 0;
+		td->td_retval[1] = frame->tf_rdx;
+	}
 
-	/*
-	 * This may result in two records if debugger modified
-	 * registers or memory during sleep at stop/ptrace point.
-	 */
-#ifdef KTRACE
-	if (KTRPOINT(td, KTR_SYSCALL))
-		ktrsyscall(sa->code, sa->narg, sa->argp);
-#endif
 	return (error);
 }
 
@@ -881,88 +862,23 @@
 syscall(struct trapframe *frame)
 {
 	struct thread *td;
-	struct proc *p;
 	struct syscall_args sa;
 	register_t orig_tf_rflags;
 	int error;
 	ksiginfo_t ksi;
 
-	PCPU_INC(cnt.v_syscall);
-	td = curthread;
-	p = td->td_proc;
-	td->td_syscalls++;
-
 #ifdef DIAGNOSTIC
 	if (ISPL(frame->tf_cs) != SEL_UPL) {
 		panic("syscall");
 		/* NOT REACHED */
 	}
 #endif
-
-	td->td_pticks = 0;
+	orig_tf_rflags = frame->tf_rflags;
+	td = curthread;
 	td->td_frame = frame;
-	if (td->td_ucred != p->p_ucred) 
-		cred_update_thread(td);
-	orig_tf_rflags = frame->tf_rflags;
-	if (p->p_flag & P_TRACED) {
-		PROC_LOCK(p);
-		td->td_dbgflags &= ~TDB_USERWR;
-		PROC_UNLOCK(p);
-	}
-	error = fetch_syscall_args(td, &sa);
 
-	CTR4(KTR_SYSC, "syscall enter thread %p pid %d proc %s code %d", td,
-	    td->td_proc->p_pid, td->td_name, sa.code);
-
-	if (error == 0) {
-		td->td_retval[0] = 0;
-		td->td_retval[1] = frame->tf_rdx;
+	error = syscallenter(td, &sa);
 
-		STOPEVENT(p, S_SCE, sa.narg);
-		PTRACESTOP_SC(p, td, S_PT_SCE);
-		if (td->td_dbgflags & TDB_USERWR) {
-			/*
-			 * Reread syscall number and arguments if
-			 * debugger modified registers or memory.
-			 */
-			error = fetch_syscall_args(td, &sa);
-			if (error != 0)
-				goto retval;
-			td->td_retval[1] = frame->tf_rdx;
-		}
-
-#ifdef KDTRACE_HOOKS
-		/*
-		 * If the systrace module has registered it's probe
-		 * callback and if there is a probe active for the
-		 * syscall 'entry', process the probe.
-		 */
-		if (systrace_probe_func != NULL && sa.callp->sy_entry != 0)
-			(*systrace_probe_func)(sa.callp->sy_entry, sa.code,
-			    sa.callp, sa.args);
-#endif
-
-		AUDIT_SYSCALL_ENTER(sa.code, td);
-		error = (*sa.callp->sy_call)(td, sa.argp);
-		AUDIT_SYSCALL_EXIT(error, td);
-
-		/* Save the latest error return value. */
-		td->td_errno = error;
-
-#ifdef KDTRACE_HOOKS
-		/*
-		 * If the systrace module has registered it's probe
-		 * callback and if there is a probe active for the
-		 * syscall 'return', process the probe.
-		 */
-		if (systrace_probe_func != NULL && sa.callp->sy_return != 0)
-			(*systrace_probe_func)(sa.callp->sy_return, sa.code,
-			    sa.callp, sa.args);
-#endif
-	}
- retval:
-	cpu_set_syscall_retval(td, error);
-
 	/*
 	 * Traced syscall.
 	 */
@@ -975,40 +891,5 @@
 		trapsignal(td, &ksi);
 	}
 
-	/*
-	 * Check for misbehavior.
-	 */
-	WITNESS_WARN(WARN_PANIC, NULL, "System call %s returning",
-	    (sa.code >= 0 && sa.code < SYS_MAXSYSCALL) ?
-	     syscallnames[sa.code] : "???");
-	KASSERT(td->td_critnest == 0,
-	    ("System call %s returning in a critical section",
-	    (sa.code >= 0 && sa.code < SYS_MAXSYSCALL) ?
-	     syscallnames[sa.code] : "???"));
-	KASSERT(td->td_locks == 0,
-	    ("System call %s returning with %d locks held",
-	    (sa.code >= 0 && sa.code < SYS_MAXSYSCALL) ?
-	     syscallnames[sa.code] : "???", td->td_locks));
-
-	/*
-	 * Handle reschedule and other end-of-syscall issues
-	 */
-	userret(td, frame);
-
-	CTR4(KTR_SYSC, "syscall exit thread %p pid %d proc %s code %d", td,
-	    td->td_proc->p_pid, td->td_name, sa.code);
-
-#ifdef KTRACE
-	if (KTRPOINT(td, KTR_SYSRET))
-		ktrsysret(sa.code, error, td->td_retval[0]);
-#endif
-
-	/*
-	 * This works because errno is findable through the
-	 * register set.  If we ever support an emulation where this
-	 * is not the case, this code will need to be revisited.
-	 */
-	STOPEVENT(p, S_SCX, sa.code);
-
-	PTRACESTOP_SC(p, td, S_PT_SCX);
+	syscallret(td, error, &sa);
 }

==== //depot/projects/scottl-camlock/src/sys/amd64/ia32/ia32_syscall.c#10 (text+ko) ====

@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/ia32/ia32_syscall.c,v 1.21 2010/01/23 11:45:35 kib Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/ia32/ia32_syscall.c,v 1.22 2010/05/23 18:32:02 kib Exp $");
 
 /*
  * 386 Trap and System call handling
@@ -56,6 +56,7 @@
 #include <sys/ktr.h>
 #include <sys/lock.h>
 #include <sys/mutex.h>
+#include <sys/proc.h>
 #include <sys/ptrace.h>
 #include <sys/resourcevar.h>
 #include <sys/signalvar.h>
@@ -81,62 +82,54 @@
 #include <machine/intr_machdep.h>
 #include <machine/md_var.h>
 
+#include <compat/freebsd32/freebsd32_util.h>
+
 #define	IDTVEC(name)	__CONCAT(X,name)
 
 extern inthand_t IDTVEC(int0x80_syscall), IDTVEC(rsvd);
-extern const char *freebsd32_syscallnames[];
 
 void ia32_syscall(struct trapframe *frame);	/* Called from asm code */
 
-struct ia32_syscall_args {
-	u_int code;
-	caddr_t params;
-	struct sysent *callp;
-	u_int64_t args64[8];
-	int narg;
-};
+void
+ia32_set_syscall_retval(struct thread *td, int error)
+{
+
+	cpu_set_syscall_retval(td, error);
+}
 
-static int
-fetch_ia32_syscall_args(struct thread *td, struct ia32_syscall_args *sa)
+int
+ia32_fetch_syscall_args(struct thread *td, struct syscall_args *sa)
 {
 	struct proc *p;
 	struct trapframe *frame;
+	caddr_t params;
 	u_int32_t args[8];
 	int error, i;
 
 	p = td->td_proc;
 	frame = td->td_frame;
 
-	sa->params = (caddr_t)frame->tf_rsp + sizeof(u_int32_t);
+	params = (caddr_t)frame->tf_rsp + sizeof(u_int32_t);
 	sa->code = frame->tf_rax;
 
-	if (p->p_sysent->sv_prepsyscall) {
+	/*
+	 * Need to check if this is a 32 bit or 64 bit syscall.
+	 */
+	if (sa->code == SYS_syscall) {
 		/*
-		 * The prep code is MP aware.
+		 * Code is first argument, followed by actual args.
 		 */
-		(*p->p_sysent->sv_prepsyscall)(frame, args, &sa->code,
-		    &sa->params);
-	} else {
+		sa->code = fuword32(params);
+		params += sizeof(int);
+	} else if (sa->code == SYS___syscall) {
 		/*
-		 * Need to check if this is a 32 bit or 64 bit syscall.
-		 * fuword is MP aware.
+		 * Like syscall, but code is a quad, so as to maintain
+		 * quad alignment for the rest of the arguments.
+		 * We use a 32-bit fetch in case params is not
+		 * aligned.
 		 */
-		if (sa->code == SYS_syscall) {
-			/*
-			 * Code is first argument, followed by actual args.
-			 */
-			sa->code = fuword32(sa->params);
-			sa->params += sizeof(int);
-		} else if (sa->code == SYS___syscall) {
-			/*
-			 * Like syscall, but code is a quad, so as to maintain
-			 * quad alignment for the rest of the arguments.
-			 * We use a 32-bit fetch in case params is not
-			 * aligned.
-			 */
-			sa->code = fuword32(sa->params);
-			sa->params += sizeof(quad_t);
-		}
+		sa->code = fuword32(params);
+		params += sizeof(quad_t);
 	}
  	if (p->p_sysent->sv_mask)
  		sa->code &= p->p_sysent->sv_mask;
@@ -146,19 +139,19 @@
  		sa->callp = &p->p_sysent->sv_table[sa->code];
 	sa->narg = sa->callp->sy_narg;
 
-	if (sa->params != NULL && sa->narg != 0)
-		error = copyin(sa->params, (caddr_t)args,
+	if (params != NULL && sa->narg != 0)
+		error = copyin(params, (caddr_t)args,
 		    (u_int)(sa->narg * sizeof(int)));
 	else
 		error = 0;
 
 	for (i = 0; i < sa->narg; i++)
-		sa->args64[i] = args[i];
+		sa->args[i] = args[i];
 
-#ifdef KTRACE
-	if (KTRPOINT(td, KTR_SYSCALL))
-		ktrsyscall(sa->code, sa->narg, sa->args64);
-#endif
+	if (error == 0) {
+		td->td_retval[0] = 0;
+		td->td_retval[1] = frame->tf_rdx;
+	}
 
 	return (error);
 }
@@ -167,59 +160,17 @@
 ia32_syscall(struct trapframe *frame)
 {
 	struct thread *td;
-	struct proc *p;
-	struct ia32_syscall_args sa;
+	struct syscall_args sa;
 	register_t orig_tf_rflags;
 	int error;
 	ksiginfo_t ksi;
 
-	PCPU_INC(cnt.v_syscall);
+	orig_tf_rflags = frame->tf_rflags;
 	td = curthread;
-	p = td->td_proc;
-	td->td_syscalls++;
-
-	td->td_pticks = 0;
 	td->td_frame = frame;
-	if (td->td_ucred != p->p_ucred) 
-		cred_update_thread(td);
-	orig_tf_rflags = frame->tf_rflags;
-	if (p->p_flag & P_TRACED) {
-		PROC_LOCK(p);
-		td->td_dbgflags &= ~TDB_USERWR;
-		PROC_UNLOCK(p);
-	}
-	error = fetch_ia32_syscall_args(td, &sa);
 
-	CTR4(KTR_SYSC, "syscall enter thread %p pid %d proc %s code %d", td,
-	    td->td_proc->p_pid, td->td_name, sa.code);
-
-	if (error == 0) {
-		td->td_retval[0] = 0;
-		td->td_retval[1] = frame->tf_rdx;
+	error = syscallenter(td, &sa);
 
-		STOPEVENT(p, S_SCE, sa.narg);
-		PTRACESTOP_SC(p, td, S_PT_SCE);
-		if (td->td_dbgflags & TDB_USERWR) {
-			/*
-			 * Reread syscall number and arguments if
-			 * debugger modified registers or memory.
-			 */
-			error = fetch_ia32_syscall_args(td, &sa);
-			if (error != 0)
-				goto retval;
-			td->td_retval[1] = frame->tf_rdx;
-		}
-
-		AUDIT_SYSCALL_ENTER(sa.code, td);
-		error = (*sa.callp->sy_call)(td, sa.args64);
-		AUDIT_SYSCALL_EXIT(error, td);
-
-		/* Save the latest error return value. */
-		td->td_errno = error;
-	}
- retval:
-	cpu_set_syscall_retval(td, error);
-
 	/*
 	 * Traced syscall.
 	 */
@@ -232,44 +183,9 @@
 		trapsignal(td, &ksi);
 	}
 
-	/*
-	 * Check for misbehavior.
-	 */
-	WITNESS_WARN(WARN_PANIC, NULL, "System call %s returning",
-	    (sa.code >= 0 && sa.code < SYS_MAXSYSCALL) ?
-	     freebsd32_syscallnames[sa.code] : "???");
-	KASSERT(td->td_critnest == 0,
-	    ("System call %s returning in a critical section",
-	    (sa.code >= 0 && sa.code < SYS_MAXSYSCALL) ?
-	     freebsd32_syscallnames[sa.code] : "???"));
-	KASSERT(td->td_locks == 0,
-	    ("System call %s returning with %d locks held",
-	    (sa.code >= 0 && sa.code < SYS_MAXSYSCALL) ?
-	     freebsd32_syscallnames[sa.code] : "???", td->td_locks));
-
-	/*
-	 * Handle reschedule and other end-of-syscall issues
-	 */
-	userret(td, frame);
-
-	CTR4(KTR_SYSC, "syscall exit thread %p pid %d proc %s code %d", td,
-	    td->td_proc->p_pid, td->td_proc->p_comm, sa.code);
-#ifdef KTRACE
-	if (KTRPOINT(td, KTR_SYSRET))
-		ktrsysret(sa.code, error, td->td_retval[0]);
-#endif
-
-	/*
-	 * This works because errno is findable through the
-	 * register set.  If we ever support an emulation where this
-	 * is not the case, this code will need to be revisited.
-	 */
-	STOPEVENT(p, S_SCX, sa.code);
- 
-	PTRACESTOP_SC(p, td, S_PT_SCX);
+	syscallret(td, error, &sa);
 }
 
-
 static void
 ia32_syscall_enable(void *dummy)
 {

==== //depot/projects/scottl-camlock/src/sys/amd64/include/proc.h#8 (text+ko) ====

@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)proc.h	7.1 (Berkeley) 5/15/91
- * $FreeBSD: src/sys/amd64/include/proc.h,v 1.28 2010/04/27 09:48:43 kib Exp $
+ * $FreeBSD: src/sys/amd64/include/proc.h,v 1.29 2010/05/23 18:32:02 kib Exp $
  */
 
 #ifndef _MACHINE_PROC_H_
@@ -79,6 +79,14 @@
 extern struct mtx dt_lock;
 extern int max_ldt_segment;
 
+struct syscall_args {
+	u_int code;
+	struct sysent *callp;
+	register_t args[8];
+	int narg;
+};
+#define	HAVE_SYSCALL_ARGS_DEF 1
+
 #endif  /* _KERNEL */
 
 #endif /* !_MACHINE_PROC_H_ */

==== //depot/projects/scottl-camlock/src/sys/amd64/linux32/linux32_sysvec.c#21 (text+ko) ====

@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/linux32/linux32_sysvec.c,v 1.56 2010/03/25 14:24:00 nwhitehorn Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/linux32/linux32_sysvec.c,v 1.57 2010/05/23 18:32:02 kib Exp $");
 #include "opt_compat.h"
 
 #ifndef COMPAT_FREEBSD32
@@ -121,8 +121,6 @@
 static int	elf_linux_fixup(register_t **stack_base,
 		    struct image_params *iparams);
 static register_t *linux_copyout_strings(struct image_params *imgp);
-static void	linux_prepsyscall(struct trapframe *tf, int *args, u_int *code,
-		    caddr_t *params);
 static void     linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask);
 static void	exec_linux_setregs(struct thread *td, 
 				   struct image_params *imgp, u_long stack);
@@ -764,19 +762,33 @@
 	return (EJUSTRETURN);
 }
 
-/*
- * MPSAFE
- */
-static void
-linux_prepsyscall(struct trapframe *tf, int *args, u_int *code, caddr_t *params)
+static int
+linux32_fetch_syscall_args(struct thread *td, struct syscall_args *sa)
 {
-	args[0] = tf->tf_rbx;
-	args[1] = tf->tf_rcx;
-	args[2] = tf->tf_rdx;
-	args[3] = tf->tf_rsi;
-	args[4] = tf->tf_rdi;
-	args[5] = tf->tf_rbp;	/* Unconfirmed */
-	*params = NULL;		/* no copyin */
+	struct proc *p;
+	struct trapframe *frame;
+
+	p = td->td_proc;
+	frame = td->td_frame;
+
+	sa->args[0] = frame->tf_rbx;
+	sa->args[1] = frame->tf_rcx;
+	sa->args[2] = frame->tf_rdx;
+	sa->args[3] = frame->tf_rsi;
+	sa->args[4] = frame->tf_rdi;
+	sa->args[5] = frame->tf_rbp;	/* Unconfirmed */
+	sa->code = frame->tf_rax;
+
+	if (sa->code >= p->p_sysent->sv_size)
+		sa->callp = &p->p_sysent->sv_table[0];
+	else
+		sa->callp = &p->p_sysent->sv_table[sa->code];
+	sa->narg = sa->callp->sy_narg;
+
+	td->td_retval[0] = 0;
+	td->td_retval[1] = frame->tf_rdx;
+
+	return (0);
 }
 
 /*
@@ -1039,7 +1051,7 @@
 	.sv_sendsig	= linux_sendsig,
 	.sv_sigcode	= linux_sigcode,
 	.sv_szsigcode	= &linux_szsigcode,
-	.sv_prepsyscall	= linux_prepsyscall,
+	.sv_prepsyscall	= NULL,
 	.sv_name	= "Linux ELF32",
 	.sv_coredump	= elf32_coredump,
 	.sv_imgact_try	= exec_linux_imgact_try,
@@ -1054,7 +1066,10 @@
 	.sv_setregs	= exec_linux_setregs,
 	.sv_fixlimit	= linux32_fixlimit,
 	.sv_maxssiz	= &linux32_maxssiz,
-	.sv_flags	= SV_ABI_LINUX | SV_ILP32 | SV_IA32
+	.sv_flags	= SV_ABI_LINUX | SV_ILP32 | SV_IA32,
+	.sv_set_syscall_retval = cpu_set_syscall_retval,
+	.sv_fetch_syscall_args = linux32_fetch_syscall_args,
+	.sv_syscallnames = NULL,
 };
 
 static char GNU_ABI_VENDOR[] = "GNU";

==== //depot/projects/scottl-camlock/src/sys/arm/arm/elf_machdep.c#9 (text+ko) ====

@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/arm/arm/elf_machdep.c,v 1.14 2009/10/03 11:57:21 bz Exp $");
+__FBSDID("$FreeBSD: src/sys/arm/arm/elf_machdep.c,v 1.15 2010/05/23 18:32:02 kib Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -34,6 +34,7 @@
 #include <sys/linker.h>

>>> TRUNCATED FOR MAIL (1000 lines) <<<


More information about the p4-projects mailing list