Date: Mon, 2 Mar 2009 18:43:50 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r189282 - in head/sys: amd64/amd64 fs/procfs kern Message-ID: <200903021843.n22Iho8d083201@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <sys/sf_buf.h> #include <sys/smp.h> #include <sys/sysctl.h> +#include <sys/sysent.h> #include <sys/unistd.h> #include <sys/vnode.h> #include <sys/vmmeter.h> @@ -80,12 +81,6 @@ __FBSDID("$FreeBSD$"); #include <amd64/isa/isa.h> -#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 <sys/mutex.h> #include <sys/proc.h> #include <sys/ptrace.h> +#include <sys/sysent.h> #include <sys/uio.h> #include <machine/reg.h> @@ -63,7 +64,6 @@ #include <machine/fpu.h> #include <compat/ia32/ia32_reg.h> -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 <sys/mutex.h> #include <sys/proc.h> #include <sys/ptrace.h> +#include <sys/sysent.h> #include <sys/uio.h> #include <machine/reg.h> @@ -57,7 +58,6 @@ #include <machine/fpu.h> #include <compat/ia32/ia32_reg.h> -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 <sys/mutex.h> #include <sys/proc.h> #include <sys/ptrace.h> +#include <sys/sysent.h> #include <sys/uio.h> #include <machine/reg.h> @@ -57,7 +58,6 @@ #include <machine/fpu.h> #include <compat/ia32/ia32_reg.h> -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 <sys/lock.h> #include <sys/mutex.h> #include <sys/syscallsubr.h> +#include <sys/sysent.h> #include <sys/sysproto.h> #include <sys/proc.h> #include <sys/vnode.h> @@ -64,8 +65,6 @@ __FBSDID("$FreeBSD$"); #include <machine/fpu.h> #include <compat/ia32/ia32_reg.h> -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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903021843.n22Iho8d083201>