svn commit: r219144 - in stable/8/sys: amd64/amd64 amd64/linux32
compat/linprocfs fs/procfs i386/linux kern sys
Dmitry Chagin
dchagin at FreeBSD.org
Tue Mar 1 20:44:15 UTC 2011
Author: dchagin
Date: Tue Mar 1 20:44:14 2011
New Revision: 219144
URL: http://svn.freebsd.org/changeset/base/219144
Log:
MFC r217896:
Add macro to test the sv_flags of any process. Change some places to test
the flags instead of explicit comparing with address of known sysentvec
structures.
Modified:
stable/8/sys/amd64/amd64/vm_machdep.c
stable/8/sys/amd64/linux32/linux32_machdep.c
stable/8/sys/compat/linprocfs/linprocfs.c
stable/8/sys/fs/procfs/procfs_dbregs.c
stable/8/sys/fs/procfs/procfs_fpregs.c
stable/8/sys/fs/procfs/procfs_map.c
stable/8/sys/fs/procfs/procfs_regs.c
stable/8/sys/i386/linux/linux_machdep.c
stable/8/sys/kern/kern_jail.c
stable/8/sys/kern/sys_process.c
stable/8/sys/sys/sysent.h
Directory Properties:
stable/8/sys/ (props changed)
stable/8/sys/amd64/include/xen/ (props changed)
stable/8/sys/cddl/contrib/opensolaris/ (props changed)
stable/8/sys/contrib/dev/acpica/ (props changed)
stable/8/sys/contrib/pf/ (props changed)
Modified: stable/8/sys/amd64/amd64/vm_machdep.c
==============================================================================
--- stable/8/sys/amd64/amd64/vm_machdep.c Tue Mar 1 20:27:02 2011 (r219143)
+++ stable/8/sys/amd64/amd64/vm_machdep.c Tue Mar 1 20:44:14 2011 (r219144)
@@ -445,7 +445,7 @@ cpu_set_upcall_kse(struct thread *td, vo
cpu_thread_clean(td);
#ifdef COMPAT_FREEBSD32
- if (td->td_proc->p_sysent->sv_flags & SV_ILP32) {
+ if (SV_PROC_FLAG(td->td_proc, SV_ILP32)) {
/*
* Set the trap frame to point at the beginning of the uts
* function.
@@ -496,7 +496,7 @@ cpu_set_user_tls(struct thread *td, void
return (EINVAL);
#ifdef COMPAT_FREEBSD32
- if (td->td_proc->p_sysent->sv_flags & SV_ILP32) {
+ if (SV_PROC_FLAG(td->td_proc, SV_ILP32)) {
td->td_pcb->pcb_gsbase = (register_t)tls_base;
return (0);
}
Modified: stable/8/sys/amd64/linux32/linux32_machdep.c
==============================================================================
--- stable/8/sys/amd64/linux32/linux32_machdep.c Tue Mar 1 20:27:02 2011 (r219143)
+++ stable/8/sys/amd64/linux32/linux32_machdep.c Tue Mar 1 20:44:14 2011 (r219144)
@@ -231,7 +231,7 @@ linux_execve(struct thread *td, struct l
* linux_proc_init, this leads to a panic on KASSERT
* because such process has p->p_emuldata == NULL.
*/
- if (td->td_proc->p_sysent == &elf_linux_sysvec)
+ if (SV_PROC_ABI(td->td_proc) == SV_ABI_LINUX)
error = linux_proc_init(td, 0, 0);
return (error);
}
Modified: stable/8/sys/compat/linprocfs/linprocfs.c
==============================================================================
--- stable/8/sys/compat/linprocfs/linprocfs.c Tue Mar 1 20:27:02 2011 (r219143)
+++ stable/8/sys/compat/linprocfs/linprocfs.c Tue Mar 1 20:44:14 2011 (r219144)
@@ -927,7 +927,7 @@ do { \
#ifdef COMPAT_FREEBSD32
env_vector32 = NULL;
- if ((p->p_sysent->sv_flags & SV_ILP32) != 0) {
+ if (SV_PROC_FLAG(p, SV_ILP32) != 0) {
env_vector32 = malloc(sizeof(*env_vector32) * MAX_ARGV_STR,
M_TEMP, M_WAITOK);
elm_len = sizeof(int32_t);
Modified: stable/8/sys/fs/procfs/procfs_dbregs.c
==============================================================================
--- stable/8/sys/fs/procfs/procfs_dbregs.c Tue Mar 1 20:27:02 2011 (r219143)
+++ stable/8/sys/fs/procfs/procfs_dbregs.c Tue Mar 1 20:44:14 2011 (r219144)
@@ -107,7 +107,7 @@ procfs_doprocdbregs(PFS_FILL_ARGS)
td2 = FIRST_THREAD_IN_PROC(p);
#ifdef COMPAT_FREEBSD32
if (SV_CURPROC_FLAG(SV_ILP32)) {
- if ((td2->td_proc->p_sysent->sv_flags & SV_ILP32) == 0) {
+ if (SV_PROC_FLAG(td2->td_proc, SV_ILP32) == 0) {
PROC_UNLOCK(p);
return (EINVAL);
}
Modified: stable/8/sys/fs/procfs/procfs_fpregs.c
==============================================================================
--- stable/8/sys/fs/procfs/procfs_fpregs.c Tue Mar 1 20:27:02 2011 (r219143)
+++ stable/8/sys/fs/procfs/procfs_fpregs.c Tue Mar 1 20:44:14 2011 (r219144)
@@ -106,7 +106,7 @@ procfs_doprocfpregs(PFS_FILL_ARGS)
td2 = FIRST_THREAD_IN_PROC(p);
#ifdef COMPAT_FREEBSD32
if (SV_CURPROC_FLAG(SV_ILP32)) {
- if ((td2->td_proc->p_sysent->sv_flags & SV_ILP32) == 0) {
+ if (SV_PROC_FLAG(td2->td_proc, SV_ILP32) == 0) {
PROC_UNLOCK(p);
return (EINVAL);
}
Modified: stable/8/sys/fs/procfs/procfs_map.c
==============================================================================
--- stable/8/sys/fs/procfs/procfs_map.c Tue Mar 1 20:27:02 2011 (r219143)
+++ stable/8/sys/fs/procfs/procfs_map.c Tue Mar 1 20:44:14 2011 (r219144)
@@ -100,8 +100,8 @@ procfs_doprocmap(PFS_FILL_ARGS)
return (EOPNOTSUPP);
#ifdef COMPAT_FREEBSD32
- if (curproc->p_sysent->sv_flags & SV_ILP32) {
- if (!(p->p_sysent->sv_flags & SV_ILP32))
+ if (SV_CURPROC_FLAG(SV_ILP32)) {
+ if (!(SV_PROC_FLAG(p, SV_ILP32)))
return (EOPNOTSUPP);
wrap32 = 1;
}
Modified: stable/8/sys/fs/procfs/procfs_regs.c
==============================================================================
--- stable/8/sys/fs/procfs/procfs_regs.c Tue Mar 1 20:27:02 2011 (r219143)
+++ stable/8/sys/fs/procfs/procfs_regs.c Tue Mar 1 20:44:14 2011 (r219144)
@@ -106,7 +106,7 @@ procfs_doprocregs(PFS_FILL_ARGS)
td2 = FIRST_THREAD_IN_PROC(p);
#ifdef COMPAT_FREEBSD32
if (SV_CURPROC_FLAG(SV_ILP32)) {
- if ((td2->td_proc->p_sysent->sv_flags & SV_ILP32) == 0) {
+ if ((SV_PROC_FLAG(td2->td_proc, SV_ILP32)) == 0) {
PROC_UNLOCK(p);
return (EINVAL);
}
Modified: stable/8/sys/i386/linux/linux_machdep.c
==============================================================================
--- stable/8/sys/i386/linux/linux_machdep.c Tue Mar 1 20:27:02 2011 (r219143)
+++ stable/8/sys/i386/linux/linux_machdep.c Tue Mar 1 20:44:14 2011 (r219144)
@@ -146,8 +146,8 @@ linux_execve(struct thread *td, struct l
* linux_proc_init, this leads to a panic on KASSERT
* because such process has p->p_emuldata == NULL
*/
- if (td->td_proc->p_sysent == &elf_linux_sysvec)
- error = linux_proc_init(td, 0, 0);
+ if (SV_PROC_ABI(td->td_proc) == SV_ABI_LINUX)
+ error = linux_proc_init(td, 0, 0);
return (error);
}
Modified: stable/8/sys/kern/kern_jail.c
==============================================================================
--- stable/8/sys/kern/kern_jail.c Tue Mar 1 20:27:02 2011 (r219143)
+++ stable/8/sys/kern/kern_jail.c Tue Mar 1 20:44:14 2011 (r219144)
@@ -745,7 +745,7 @@ kern_jail_set(struct thread *td, struct
}
#ifdef COMPAT_FREEBSD32
- if (td->td_proc->p_sysent->sv_flags & SV_ILP32) {
+ if (SV_PROC_FLAG(td->td_proc, SV_ILP32)) {
uint32_t hid32;
error = vfs_copyopt(opts, "host.hostid", &hid32, sizeof(hid32));
@@ -1972,7 +1972,7 @@ kern_jail_get(struct thread *td, struct
if (error != 0 && error != ENOENT)
goto done_deref;
#ifdef COMPAT_FREEBSD32
- if (td->td_proc->p_sysent->sv_flags & SV_ILP32) {
+ if (SV_PROC_FLAG(td->td_proc, SV_ILP32)) {
uint32_t hid32 = pr->pr_hostid;
error = vfs_setopt(opts, "host.hostid", &hid32, sizeof(hid32));
Modified: stable/8/sys/kern/sys_process.c
==============================================================================
--- stable/8/sys/kern/sys_process.c Tue Mar 1 20:27:02 2011 (r219143)
+++ stable/8/sys/kern/sys_process.c Tue Mar 1 20:44:14 2011 (r219144)
@@ -781,7 +781,7 @@ kern_ptrace(struct thread *td, int req,
* Set the wrap controls accordingly.
*/
if (SV_CURPROC_FLAG(SV_ILP32)) {
- if (td2->td_proc->p_sysent->sv_flags & SV_ILP32)
+ if (SV_PROC_FLAG(td2->td_proc, SV_ILP32))
safe = 1;
wrap32 = 1;
}
Modified: stable/8/sys/sys/sysent.h
==============================================================================
--- stable/8/sys/sys/sysent.h Tue Mar 1 20:27:02 2011 (r219143)
+++ stable/8/sys/sys/sysent.h Tue Mar 1 20:44:14 2011 (r219144)
@@ -116,8 +116,10 @@ struct sysentvec {
#define SV_AOUT 0x008000
#define SV_ABI_MASK 0xff
-#define SV_CURPROC_FLAG(x) (curproc->p_sysent->sv_flags & (x))
-#define SV_CURPROC_ABI() (curproc->p_sysent->sv_flags & SV_ABI_MASK)
+#define SV_PROC_FLAG(p, x) ((p)->p_sysent->sv_flags & (x))
+#define SV_PROC_ABI(p) ((p)->p_sysent->sv_flags & SV_ABI_MASK)
+#define SV_CURPROC_FLAG(x) SV_PROC_FLAG(curproc, x)
+#define SV_CURPROC_ABI() SV_PROC_ABI(curproc)
/* same as ELFOSABI_XXX, to prevent header pollution */
#define SV_ABI_LINUX 3
#define SV_ABI_FREEBSD 9
More information about the svn-src-stable-8
mailing list