From owner-svn-src-all@FreeBSD.ORG Mon Mar 2 18:43:51 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E0ED410658D7; Mon, 2 Mar 2009 18:43:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B8B5B8FC29; Mon, 2 Mar 2009 18:43:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n22Ihow4083206; Mon, 2 Mar 2009 18:43:50 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n22Iho8d083201; Mon, 2 Mar 2009 18:43:50 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200903021843.n22Iho8d083201@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 2 Mar 2009 18:43:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189282 - in head/sys: amd64/amd64 fs/procfs kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Mar 2009 18:44:03 -0000 Author: kib Date: Mon Mar 2 18:43:50 2009 New Revision: 189282 URL: http://svn.freebsd.org/changeset/base/189282 Log: Use the p_sysent->sv_flags flag SV_ILP32 to detect 32bit process executing on 64bit kernel. This eliminates the direct comparisions of p_sysent with &ia32_freebsd_sysvec, that were left intact after r185169. Modified: head/sys/amd64/amd64/vm_machdep.c head/sys/fs/procfs/procfs_dbregs.c head/sys/fs/procfs/procfs_fpregs.c head/sys/fs/procfs/procfs_regs.c head/sys/kern/sys_process.c Modified: head/sys/amd64/amd64/vm_machdep.c ============================================================================== --- head/sys/amd64/amd64/vm_machdep.c Mon Mar 2 16:55:19 2009 (r189281) +++ head/sys/amd64/amd64/vm_machdep.c Mon Mar 2 18:43:50 2009 (r189282) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -80,12 +81,6 @@ __FBSDID("$FreeBSD$"); #include -#ifdef COMPAT_IA32 - -extern struct sysentvec ia32_freebsd_sysvec; - -#endif - static void cpu_reset_real(void); #ifdef SMP static void cpu_reset_proxy(void); @@ -331,7 +326,7 @@ cpu_set_upcall_kse(struct thread *td, vo cpu_thread_clean(td); #ifdef COMPAT_IA32 - if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) { + if (td->td_proc->p_sysent->sv_flags & SV_ILP32) { /* * Set the trap frame to point at the beginning of the uts * function. @@ -377,7 +372,7 @@ cpu_set_user_tls(struct thread *td, void return (EINVAL); #ifdef COMPAT_IA32 - if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) { + if (td->td_proc->p_sysent->sv_flags & SV_ILP32) { if (td == curthread) { critical_enter(); td->td_pcb->pcb_gsbase = (register_t)tls_base; Modified: head/sys/fs/procfs/procfs_dbregs.c ============================================================================== --- head/sys/fs/procfs/procfs_dbregs.c Mon Mar 2 16:55:19 2009 (r189281) +++ head/sys/fs/procfs/procfs_dbregs.c Mon Mar 2 18:43:50 2009 (r189282) @@ -51,6 +51,7 @@ #include #include #include +#include #include #include @@ -63,7 +64,6 @@ #include #include -extern struct sysentvec ia32_freebsd_sysvec; /* * PROC(write, dbregs, td2, &r) becomes * proc_write_dbregs(td2, &r) or @@ -107,8 +107,8 @@ procfs_doprocdbregs(PFS_FILL_ARGS) td2 = FIRST_THREAD_IN_PROC(p); #ifdef COMPAT_IA32 - if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) { - if (td2->td_proc->p_sysent != &ia32_freebsd_sysvec) { + if (SV_CURPROC_FLAG(SV_ILP32)) { + if ((td2->td_proc->p_sysent->sv_flags & SV_ILP32) == 0) { PROC_UNLOCK(p); return (EINVAL); } Modified: head/sys/fs/procfs/procfs_fpregs.c ============================================================================== --- head/sys/fs/procfs/procfs_fpregs.c Mon Mar 2 16:55:19 2009 (r189281) +++ head/sys/fs/procfs/procfs_fpregs.c Mon Mar 2 18:43:50 2009 (r189282) @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -57,7 +58,6 @@ #include #include -extern struct sysentvec ia32_freebsd_sysvec; /* * PROC(write, fpregs, td2, &r) becomes * proc_write_fpregs(td2, &r) or @@ -102,8 +102,8 @@ procfs_doprocfpregs(PFS_FILL_ARGS) /* XXXKSE: */ td2 = FIRST_THREAD_IN_PROC(p); #ifdef COMPAT_IA32 - if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) { - if (td2->td_proc->p_sysent != &ia32_freebsd_sysvec) { + if (SV_CURPROC_FLAG(SV_ILP32)) { + if ((td2->td_proc->p_sysent->sv_flags & SV_ILP32) == 0) { PROC_UNLOCK(p); return (EINVAL); } Modified: head/sys/fs/procfs/procfs_regs.c ============================================================================== --- head/sys/fs/procfs/procfs_regs.c Mon Mar 2 16:55:19 2009 (r189281) +++ head/sys/fs/procfs/procfs_regs.c Mon Mar 2 18:43:50 2009 (r189282) @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -57,7 +58,6 @@ #include #include -extern struct sysentvec ia32_freebsd_sysvec; /* * PROC(write, regs, td2, &r) becomes * proc_write_regs(td2, &r) or @@ -102,8 +102,8 @@ procfs_doprocregs(PFS_FILL_ARGS) /* XXXKSE: */ td2 = FIRST_THREAD_IN_PROC(p); #ifdef COMPAT_IA32 - if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) { - if (td2->td_proc->p_sysent != &ia32_freebsd_sysvec) { + if (SV_CURPROC_FLAG(SV_ILP32)) { + if ((td2->td_proc->p_sysent->sv_flags & SV_ILP32) == 0) { PROC_UNLOCK(p); return (EINVAL); } Modified: head/sys/kern/sys_process.c ============================================================================== --- head/sys/kern/sys_process.c Mon Mar 2 16:55:19 2009 (r189281) +++ head/sys/kern/sys_process.c Mon Mar 2 18:43:50 2009 (r189282) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -64,8 +65,6 @@ __FBSDID("$FreeBSD$"); #include #include -extern struct sysentvec ia32_freebsd_sysvec; - struct ptrace_io_desc32 { int piod_op; u_int32_t piod_offs; @@ -394,7 +393,7 @@ ptrace(struct thread *td, struct ptrace_ #ifdef COMPAT_IA32 int wrap32 = 0; - if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) + if (SV_CURPROC_FLAG(SV_ILP32)) wrap32 = 1; #endif AUDIT_ARG(pid, uap->pid); @@ -581,8 +580,8 @@ kern_ptrace(struct thread *td, int req, * Test if we're a 32 bit client and what the target is. * Set the wrap controls accordingly. */ - if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) { - if (td2->td_proc->p_sysent == &ia32_freebsd_sysvec) + if (SV_CURPROC_FLAG(SV_ILP32)) { + if (td2->td_proc->p_sysent->sv_flags & SV_ILP32) safe = 1; wrap32 = 1; }