Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Refactor ps_strings access. Based on PK_32, write either...
details: https://anonhg.NetBSD.org/src/rev/0dc27b570d44
branches: trunk
changeset: 762889:0dc27b570d44
user: joerg <joerg%NetBSD.org@localhost>
date: Fri Mar 04 22:25:24 2011 +0000
description:
Refactor ps_strings access. Based on PK_32, write either the normal
version or the 32bit compat layout in execve1. Introduce a new function
copyin_psstrings for reading it back from userland and converting it to
the native layout. Refactor procfs to share most of the code with the
kern.proc_args sysctl handler.
This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
diffstat:
sys/arch/alpha/alpha/machdep.c | 6 +-
sys/arch/amd64/amd64/machdep.c | 6 +-
sys/arch/amd64/amd64/netbsd32_machdep.c | 6 +-
sys/arch/amiga/amiga/machdep.c | 6 +-
sys/arch/arm/arm/arm_machdep.c | 6 +-
sys/arch/atari/atari/machdep.c | 6 +-
sys/arch/cesfic/cesfic/machdep.c | 6 +-
sys/arch/hp300/hp300/machdep.c | 6 +-
sys/arch/hp700/hp700/machdep.c | 6 +-
sys/arch/i386/i386/machdep.c | 6 +-
sys/arch/ia64/ia64/machdep.c | 6 +-
sys/arch/luna68k/luna68k/machdep.c | 6 +-
sys/arch/mac68k/mac68k/machdep.c | 6 +-
sys/arch/mips/mips/mips_machdep.c | 6 +-
sys/arch/mvme68k/mvme68k/machdep.c | 6 +-
sys/arch/news68k/news68k/machdep.c | 6 +-
sys/arch/powerpc/powerpc/powerpc_machdep.c | 8 +-
sys/arch/sh3/sh3/sh3_machdep.c | 6 +-
sys/arch/sparc/sparc/machdep.c | 8 +-
sys/arch/sparc64/sparc64/machdep.c | 8 +-
sys/arch/sparc64/sparc64/netbsd32_machdep.c | 10 +-
sys/arch/sparc64/sparc64/sunos32_machdep.c | 8 +-
sys/arch/sparc64/sparc64/svr4_32_machdep.c | 6 +-
sys/arch/sparc64/sparc64/svr4_machdep.c | 6 +-
sys/arch/sun2/sun2/machdep.c | 6 +-
sys/arch/sun3/sun3/machdep.c | 6 +-
sys/arch/sun3/sun3x/machdep.c | 6 +-
sys/arch/vax/vax/trap.c | 6 +-
sys/arch/x68k/x68k/machdep.c | 6 +-
sys/compat/darwin/darwin_sysctl.c | 20 +-
sys/compat/linux/arch/alpha/linux_machdep.c | 8 +-
sys/compat/linux/arch/i386/linux_machdep.c | 6 +-
sys/compat/linux32/arch/amd64/linux32_machdep.c | 6 +-
sys/kern/kern_exec.c | 49 +++--
sys/kern/kern_proc.c | 215 ++++++++++++++---------
sys/miscfs/procfs/procfs_cmdline.c | 144 ++++-----------
sys/sys/exec.h | 14 +-
sys/sys/exec_elf.h | 4 +-
sys/sys/proc.h | 9 +-
39 files changed, 326 insertions(+), 335 deletions(-)
diffs (truncated from 1684 to 300 lines):
diff -r 4eda0955d7e9 -r 0dc27b570d44 sys/arch/alpha/alpha/machdep.c
--- a/sys/arch/alpha/alpha/machdep.c Fri Mar 04 17:56:53 2011 +0000
+++ b/sys/arch/alpha/alpha/machdep.c Fri Mar 04 22:25:24 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.329 2011/02/24 04:28:44 joerg Exp $ */
+/* $NetBSD: machdep.c,v 1.330 2011/03/04 22:25:24 joerg Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.329 2011/02/24 04:28:44 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.330 2011/03/04 22:25:24 joerg Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1619,7 +1619,7 @@
tfp->tf_regs[FRAME_A0] = stack; /* a0 = sp */
tfp->tf_regs[FRAME_A1] = 0; /* a1 = rtld cleanup */
tfp->tf_regs[FRAME_A2] = 0; /* a2 = rtld object */
- tfp->tf_regs[FRAME_A3] = (u_int64_t)l->l_proc->p_psstr; /* a3 = ps_strings */
+ tfp->tf_regs[FRAME_A3] = l->l_proc->p_psstrp; /* a3 = ps_strings */
tfp->tf_regs[FRAME_T12] = tfp->tf_regs[FRAME_PC]; /* a.k.a. PV */
l->l_md.md_flags &= ~MDP_FPUSED;
diff -r 4eda0955d7e9 -r 0dc27b570d44 sys/arch/amd64/amd64/machdep.c
--- a/sys/arch/amd64/amd64/machdep.c Fri Mar 04 17:56:53 2011 +0000
+++ b/sys/arch/amd64/amd64/machdep.c Fri Mar 04 22:25:24 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.159 2011/02/24 04:28:44 joerg Exp $ */
+/* $NetBSD: machdep.c,v 1.160 2011/03/04 22:25:24 joerg Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008
@@ -107,7 +107,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.159 2011/02/24 04:28:44 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.160 2011/03/04 22:25:24 joerg Exp $");
/* #define XENDEBUG_LOW */
@@ -1034,7 +1034,7 @@
tf->tf_rdi = 0;
tf->tf_rsi = 0;
tf->tf_rbp = 0;
- tf->tf_rbx = (uint64_t)l->l_proc->p_psstr;
+ tf->tf_rbx = l->l_proc->p_psstrp;
tf->tf_rdx = 0;
tf->tf_rcx = 0;
tf->tf_rax = 0;
diff -r 4eda0955d7e9 -r 0dc27b570d44 sys/arch/amd64/amd64/netbsd32_machdep.c
--- a/sys/arch/amd64/amd64/netbsd32_machdep.c Fri Mar 04 17:56:53 2011 +0000
+++ b/sys/arch/amd64/amd64/netbsd32_machdep.c Fri Mar 04 22:25:24 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_machdep.c,v 1.73 2011/02/24 04:28:44 joerg Exp $ */
+/* $NetBSD: netbsd32_machdep.c,v 1.74 2011/03/04 22:25:24 joerg Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.73 2011/02/24 04:28:44 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.74 2011/03/04 22:25:24 joerg Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -161,7 +161,7 @@
tf->tf_rdi = 0;
tf->tf_rsi = 0;
tf->tf_rbp = 0;
- tf->tf_rbx = (uint64_t)p->p_psstr;
+ tf->tf_rbx = (uint32_t)p->p_psstrp;
tf->tf_rdx = 0;
tf->tf_rcx = 0;
tf->tf_rax = 0;
diff -r 4eda0955d7e9 -r 0dc27b570d44 sys/arch/amiga/amiga/machdep.c
--- a/sys/arch/amiga/amiga/machdep.c Fri Mar 04 17:56:53 2011 +0000
+++ b/sys/arch/amiga/amiga/machdep.c Fri Mar 04 22:25:24 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.230 2011/02/08 20:20:08 rmind Exp $ */
+/* $NetBSD: machdep.c,v 1.231 2011/03/04 22:25:24 joerg Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -48,7 +48,7 @@
#include "opt_m68k_arch.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.230 2011/02/08 20:20:08 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.231 2011/03/04 22:25:24 joerg Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -303,7 +303,7 @@
frame->f_regs[D7] = 0;
frame->f_regs[A0] = 0;
frame->f_regs[A1] = 0;
- frame->f_regs[A2] = (int)l->l_proc->p_psstr;
+ frame->f_regs[A2] = l->l_proc->p_psstrp;
frame->f_regs[A3] = 0;
frame->f_regs[A4] = 0;
frame->f_regs[A5] = 0;
diff -r 4eda0955d7e9 -r 0dc27b570d44 sys/arch/arm/arm/arm_machdep.c
--- a/sys/arch/arm/arm/arm_machdep.c Fri Mar 04 17:56:53 2011 +0000
+++ b/sys/arch/arm/arm/arm_machdep.c Fri Mar 04 22:25:24 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arm_machdep.c,v 1.29 2010/07/07 01:17:26 chs Exp $ */
+/* $NetBSD: arm_machdep.c,v 1.30 2011/03/04 22:25:25 joerg Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@@ -79,7 +79,7 @@
#include <sys/param.h>
-__KERNEL_RCSID(0, "$NetBSD: arm_machdep.c,v 1.29 2010/07/07 01:17:26 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm_machdep.c,v 1.30 2011/03/04 22:25:25 joerg Exp $");
#include <sys/exec.h>
#include <sys/proc.h>
@@ -155,7 +155,7 @@
tf = pcb->pcb_tf;
memset(tf, 0, sizeof(*tf));
- tf->tf_r0 = (u_int)l->l_proc->p_psstr;
+ tf->tf_r0 = l->l_proc->p_psstrp;
tf->tf_r12 = stack; /* needed by pre 1.4 crt0.c */
tf->tf_usr_sp = stack;
tf->tf_usr_lr = pack->ep_entry;
diff -r 4eda0955d7e9 -r 0dc27b570d44 sys/arch/atari/atari/machdep.c
--- a/sys/arch/atari/atari/machdep.c Fri Mar 04 17:56:53 2011 +0000
+++ b/sys/arch/atari/atari/machdep.c Fri Mar 04 22:25:24 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.169 2011/02/08 20:20:09 rmind Exp $ */
+/* $NetBSD: machdep.c,v 1.170 2011/03/04 22:25:25 joerg Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.169 2011/02/08 20:20:09 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.170 2011/03/04 22:25:25 joerg Exp $");
#include "opt_ddb.h"
#include "opt_compat_netbsd.h"
@@ -252,7 +252,7 @@
frame->f_regs[D7] = 0;
frame->f_regs[A0] = 0;
frame->f_regs[A1] = 0;
- frame->f_regs[A2] = (int)l->l_proc->p_psstr;
+ frame->f_regs[A2] = l->l_proc->p_psstrp;
frame->f_regs[A3] = 0;
frame->f_regs[A4] = 0;
frame->f_regs[A5] = 0;
diff -r 4eda0955d7e9 -r 0dc27b570d44 sys/arch/cesfic/cesfic/machdep.c
--- a/sys/arch/cesfic/cesfic/machdep.c Fri Mar 04 17:56:53 2011 +0000
+++ b/sys/arch/cesfic/cesfic/machdep.c Fri Mar 04 22:25:24 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.57 2011/02/08 20:20:10 rmind Exp $ */
+/* $NetBSD: machdep.c,v 1.58 2011/03/04 22:25:25 joerg Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.57 2011/02/08 20:20:10 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.58 2011/03/04 22:25:25 joerg Exp $");
#include "opt_bufcache.h"
#include "opt_ddb.h"
@@ -301,7 +301,7 @@
frame->f_regs[D7] = 0;
frame->f_regs[A0] = 0;
frame->f_regs[A1] = 0;
- frame->f_regs[A2] = (int)l->l_proc->p_psstr;
+ frame->f_regs[A2] = l->l_proc->p_psstrp;
frame->f_regs[A3] = 0;
frame->f_regs[A4] = 0;
frame->f_regs[A5] = 0;
diff -r 4eda0955d7e9 -r 0dc27b570d44 sys/arch/hp300/hp300/machdep.c
--- a/sys/arch/hp300/hp300/machdep.c Fri Mar 04 17:56:53 2011 +0000
+++ b/sys/arch/hp300/hp300/machdep.c Fri Mar 04 22:25:24 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.218 2011/02/09 09:32:49 tsutsui Exp $ */
+/* $NetBSD: machdep.c,v 1.219 2011/03/04 22:25:25 joerg Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.218 2011/02/09 09:32:49 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.219 2011/03/04 22:25:25 joerg Exp $");
#include "opt_ddb.h"
#include "opt_compat_netbsd.h"
@@ -361,7 +361,7 @@
frame->f_regs[D7] = 0;
frame->f_regs[A0] = 0;
frame->f_regs[A1] = 0;
- frame->f_regs[A2] = (int)l->l_proc->p_psstr;
+ frame->f_regs[A2] = l->l_proc->p_psstrp;
frame->f_regs[A3] = 0;
frame->f_regs[A4] = 0;
frame->f_regs[A5] = 0;
diff -r 4eda0955d7e9 -r 0dc27b570d44 sys/arch/hp700/hp700/machdep.c
--- a/sys/arch/hp700/hp700/machdep.c Fri Mar 04 17:56:53 2011 +0000
+++ b/sys/arch/hp700/hp700/machdep.c Fri Mar 04 22:25:24 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.98 2011/01/23 21:53:40 skrll Exp $ */
+/* $NetBSD: machdep.c,v 1.99 2011/03/04 22:25:26 joerg Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.98 2011/01/23 21:53:40 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.99 2011/03/04 22:25:26 joerg Exp $");
#include "opt_cputype.h"
#include "opt_ddb.h"
@@ -1884,7 +1884,7 @@
tf->tf_iioq_tail = 4 +
(tf->tf_iioq_head = pack->ep_entry | HPPA_PC_PRIV_USER);
tf->tf_rp = 0;
- tf->tf_arg0 = (u_long)p->p_psstr;
+ tf->tf_arg0 = p->p_psstrp;
tf->tf_arg1 = tf->tf_arg2 = 0; /* XXX dynload stuff */
tf->tf_sr7 = HPPA_SID_KERNEL;
diff -r 4eda0955d7e9 -r 0dc27b570d44 sys/arch/i386/i386/machdep.c
--- a/sys/arch/i386/i386/machdep.c Fri Mar 04 17:56:53 2011 +0000
+++ b/sys/arch/i386/i386/machdep.c Fri Mar 04 22:25:24 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.700 2011/02/24 04:28:46 joerg Exp $ */
+/* $NetBSD: machdep.c,v 1.701 2011/03/04 22:25:26 joerg Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.700 2011/02/24 04:28:46 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.701 2011/03/04 22:25:26 joerg Exp $");
#include "opt_beep.h"
#include "opt_compat_ibcs2.h"
@@ -1034,7 +1034,7 @@
tf->tf_edi = 0;
tf->tf_esi = 0;
tf->tf_ebp = 0;
- tf->tf_ebx = (int)l->l_proc->p_psstr;
+ tf->tf_ebx = l->l_proc->p_psstrp;
tf->tf_edx = 0;
tf->tf_ecx = 0;
tf->tf_eax = 0;
diff -r 4eda0955d7e9 -r 0dc27b570d44 sys/arch/ia64/ia64/machdep.c
--- a/sys/arch/ia64/ia64/machdep.c Fri Mar 04 17:56:53 2011 +0000
+++ b/sys/arch/ia64/ia64/machdep.c Fri Mar 04 22:25:24 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.27 2010/11/13 04:16:38 uebayasi Exp $ */
+/* $NetBSD: machdep.c,v 1.28 2011/03/04 22:25:26 joerg Exp $ */
/*-
* Copyright (c) 2003,2004 Marcel Moolenaar
@@ -723,7 +723,7 @@
kst = ksttop - 1;
if (((uintptr_t)kst & 0x1ff) == 0x1f8)
*kst-- = 0;
- *kst-- = (uint64_t)l->l_proc->p_psstr; /* in3 = ps_strings */
+ *kst-- = l->l_proc->p_psstrp; /* in3 = ps_strings */
if (((uintptr_t)kst & 0x1ff) == 0x1f8)
*kst-- = 0;
*kst-- = 0; /* in2 = *obj */
@@ -755,7 +755,7 @@
/* in3 = ps_strings */
suword((char *)tf->tf_special.bspstore - 8,
- (uint64_t)l->l_proc->p_psstr);
+ l->l_proc->p_psstrp);
}
diff -r 4eda0955d7e9 -r 0dc27b570d44 sys/arch/luna68k/luna68k/machdep.c
--- a/sys/arch/luna68k/luna68k/machdep.c Fri Mar 04 17:56:53 2011 +0000
+++ b/sys/arch/luna68k/luna68k/machdep.c Fri Mar 04 22:25:24 2011 +0000
Home |
Main Index |
Thread Index |
Old Index