From owner-p4-projects@FreeBSD.ORG Mon May 24 04:03:39 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 52EE21065672; Mon, 24 May 2010 04:03:39 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 169B5106566B for ; Mon, 24 May 2010 04:03:39 +0000 (UTC) (envelope-from mav@freebsd.org) Received: from repoman.freebsd.org (unknown [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 01E208FC0C for ; Mon, 24 May 2010 04:03:39 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o4O43cPl059708 for ; Mon, 24 May 2010 04:03:38 GMT (envelope-from mav@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o4O43c8w059704 for perforce@freebsd.org; Mon, 24 May 2010 04:03:38 GMT (envelope-from mav@freebsd.org) Date: Mon, 24 May 2010 04:03:38 GMT Message-Id: <201005240403.o4O43c8w059704@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to mav@freebsd.org using -f From: Alexander Motin To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 178688 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 May 2010 04:03:39 -0000 http://p4web.freebsd.org/@@178688?ac=10 Change 178688 by mav@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 @@ The &os; Documentation Project - $FreeBSD: src/release/doc/en_US.ISO8859-1/hardware/article.sgml,v 1.362 2010/05/13 03:56:57 brueffer Exp $ + $FreeBSD: src/release/doc/en_US.ISO8859-1/hardware/article.sgml,v 1.364 2010/05/23 20:00:12 nwhitehorn Exp $ 2000 @@ -36,6 +36,7 @@ &tm-attrib.freebsd; &tm-attrib.amd; + &tm-attrib.fujitsu; &tm-attrib.ibm; &tm-attrib.intel; &tm-attrib.sparc; @@ -326,12 +327,18 @@ 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. + some Power Macintosh G5 models. SMP is supported on all systems + with more than 1 processor. - Apple iMac + Apple iMac G3 + + + Apple iMac G4 + + + Apple iMac G5 Apple Power Macintosh G3 (Blue & White) @@ -340,10 +347,16 @@ Apple Power Macintosh G4 - Apple Power Macintosh G5 (non-970MP models) + Apple Power Macintosh G5 + + + Apple iBook G3 + + + Apple iBook G4 - Apple iBook + Apple PowerBook G3 (Lombard and Pismo) Apple PowerBook G4 @@ -367,7 +380,8 @@ sparc64 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 Sun System Handbook. @@ -392,6 +406,10 @@ + Naturetech GENIALstation 777S + + + &sun.blade; 100 @@ -400,7 +418,7 @@ - &sun.enterprise; 100 + &sun.enterprise; 150 @@ -420,6 +438,11 @@ + &sun.fire; B100s (support for the on-board NICs first + appeared in 8.1-RELEASE) + + + &sun.fire; V100 @@ -428,51 +451,55 @@ - &netra; t1 105 + &sun; &netra; t1 100/105 + + + + &sun; &netra; T1 AC200/DC200 - &netra; T1 AC200/DC200 + &sun; &netra; t 1100 - &netra; t 1100 + &sun; &netra; t 1120 - &netra; t 1120 + &sun; &netra; t 1125 - &netra; t 1125 + &sun; &netra; t 1400/1405 - &netra; t 1400/1405 + &sun; &netra; 120 - &netra; 120 + &sun; &netra; X1 - &netra; X1 + &sun; &sparcengine; Ultra AX1105 - &sparcengine; Ultra AX1105 + &sun; &sparcengine; Ultra AXe - &sparcengine; Ultra AXe + &sun; &sparcengine; Ultra AXi - &sparcengine; Ultra AXi + &sun; &sparcengine; Ultra AXmp - &sparcengine; Ultra AXmp + &sun; &sparcengine; CP1500 @@ -528,7 +555,7 @@ - Starting with 7.2-RELEASE, &arch.sparc64; systems based on + 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: @@ -580,11 +607,16 @@ + &sun.fire; V890 (support first appeared in 8.1-RELEASE, + non-mixed &ultrasparc; IV/IV+ CPU-configurations only) + + + &netra; 20/&netra; T4 - The following &ultrasparc; IIIi systems are not tested but + The following &sun; &ultrasparc; systems are not tested but believed to be also supported by &os;: @@ -599,7 +631,40 @@ &sun.fire; V245 (support first appeared in 7.3-RELEASE) + + + &sun.fire; V490 (support first appeared in 8.1-RELEASE, + non-mixed &ultrasparc; IV/IV+ CPU-configurations only) + + + + 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: + + + + &fujitsu; &primepower; 250 + + + The following &fujitsu; &primepower; systems are not tested but + believed to be also supported by &os;: + + + + &fujitsu; &primepower; 450 + + + + &fujitsu; &primepower; 650 + + + + &fujitsu; &primepower; 850 + + + ==== //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@FreeBSD.org . ==== //depot/projects/scottl-camlock/src/sys/amd64/amd64/elf_machdep.c#10 (text+ko) ==== @@ -24,7 +24,7 @@ */ #include -__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 #include @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -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 -__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 #endif -#include #include #include @@ -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, ¶ms); - } 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 -__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 #include #include +#include #include #include #include @@ -81,62 +82,54 @@ #include #include +#include + #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 -__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 -__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 #include @@ -34,6 +34,7 @@ #include >>> TRUNCATED FOR MAIL (1000 lines) <<<