Module Name:    src
Committed By:   rmind
Date:           Mon Nov 23 00:46:07 UTC 2009

Modified Files:
        src/sys/compat/common: kern_sig_43.c
        src/sys/compat/freebsd: freebsd_ptrace.c
        src/sys/compat/irix: irix_signal.c
        src/sys/compat/linux/arch/alpha: linux_machdep.c
        src/sys/compat/linux/arch/amd64: linux_machdep.c
        src/sys/compat/linux/arch/arm: linux_machdep.c
        src/sys/compat/linux/arch/i386: linux_exec_machdep.c linux_machdep.c
        src/sys/compat/linux/arch/mips: linux_machdep.c
        src/sys/compat/linux/arch/powerpc: linux_machdep.c
        src/sys/compat/linux32/arch/amd64: linux32_machdep.c
        src/sys/compat/osf1: osf1_misc.c
        src/sys/compat/svr4: svr4_lwp.c
        src/sys/compat/svr4_32: svr4_32_lwp.c

Log Message:
Use lwp_getpcb() in compat code, clean from struct user.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/compat/common/kern_sig_43.c
cvs rdiff -u -r1.18 -r1.19 src/sys/compat/freebsd/freebsd_ptrace.c
cvs rdiff -u -r1.51 -r1.52 src/sys/compat/irix/irix_signal.c
cvs rdiff -u -r1.44 -r1.45 src/sys/compat/linux/arch/alpha/linux_machdep.c
cvs rdiff -u -r1.36 -r1.37 src/sys/compat/linux/arch/amd64/linux_machdep.c
cvs rdiff -u -r1.27 -r1.28 src/sys/compat/linux/arch/arm/linux_machdep.c
cvs rdiff -u -r1.13 -r1.14 \
    src/sys/compat/linux/arch/i386/linux_exec_machdep.c
cvs rdiff -u -r1.145 -r1.146 src/sys/compat/linux/arch/i386/linux_machdep.c
cvs rdiff -u -r1.38 -r1.39 src/sys/compat/linux/arch/mips/linux_machdep.c
cvs rdiff -u -r1.39 -r1.40 src/sys/compat/linux/arch/powerpc/linux_machdep.c
cvs rdiff -u -r1.22 -r1.23 \
    src/sys/compat/linux32/arch/amd64/linux32_machdep.c
cvs rdiff -u -r1.83 -r1.84 src/sys/compat/osf1/osf1_misc.c
cvs rdiff -u -r1.18 -r1.19 src/sys/compat/svr4/svr4_lwp.c
cvs rdiff -u -r1.16 -r1.17 src/sys/compat/svr4_32/svr4_32_lwp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/kern_sig_43.c
diff -u src/sys/compat/common/kern_sig_43.c:1.32 src/sys/compat/common/kern_sig_43.c:1.33
--- src/sys/compat/common/kern_sig_43.c:1.32	Mon Apr 28 20:23:41 2008
+++ src/sys/compat/common/kern_sig_43.c	Mon Nov 23 00:46:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_sig_43.c,v 1.32 2008/04/28 20:23:41 martin Exp $	*/
+/*	$NetBSD: kern_sig_43.c,v 1.33 2009/11/23 00:46:06 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sig_43.c,v 1.32 2008/04/28 20:23:41 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig_43.c,v 1.33 2009/11/23 00:46:06 rmind Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -61,8 +61,6 @@
 
 #include <sys/cpu.h>
 
-#include <sys/user.h>		/* for coredump */
-
 #include <compat/sys/signal.h>
 
 void compat_43_sigmask_to_sigset(const int *, sigset_t *);

Index: src/sys/compat/freebsd/freebsd_ptrace.c
diff -u src/sys/compat/freebsd/freebsd_ptrace.c:1.18 src/sys/compat/freebsd/freebsd_ptrace.c:1.19
--- src/sys/compat/freebsd/freebsd_ptrace.c:1.18	Wed Nov 12 12:36:10 2008
+++ src/sys/compat/freebsd/freebsd_ptrace.c	Mon Nov 23 00:46:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: freebsd_ptrace.c,v 1.18 2008/11/12 12:36:10 ad Exp $	*/
+/*	$NetBSD: freebsd_ptrace.c,v 1.19 2009/11/23 00:46:06 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: freebsd_ptrace.c,v 1.18 2008/11/12 12:36:10 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: freebsd_ptrace.c,v 1.19 2009/11/23 00:46:06 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -79,7 +79,6 @@
 #include <sys/errno.h>
 #include <sys/ptrace.h>
 #include <sys/uio.h>
-#include <sys/user.h>
 #include <sys/mount.h>
 #include <sys/syscall.h>
 #include <sys/syscallargs.h>

Index: src/sys/compat/irix/irix_signal.c
diff -u src/sys/compat/irix/irix_signal.c:1.51 src/sys/compat/irix/irix_signal.c:1.52
--- src/sys/compat/irix/irix_signal.c:1.51	Wed Nov  4 21:23:02 2009
+++ src/sys/compat/irix/irix_signal.c	Mon Nov 23 00:46:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: irix_signal.c,v 1.51 2009/11/04 21:23:02 rmind Exp $ */
+/*	$NetBSD: irix_signal.c,v 1.52 2009/11/23 00:46:06 rmind Exp $ */
 
 /*-
  * Copyright (c) 1994, 2001-2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: irix_signal.c,v 1.51 2009/11/04 21:23:02 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irix_signal.c,v 1.52 2009/11/23 00:46:06 rmind Exp $");
 
 #include <sys/types.h>
 #include <sys/signal.h>
@@ -43,7 +43,6 @@
 #include <sys/systm.h>
 #include <sys/vnode.h>
 #include <sys/wait.h>
-#include <sys/user.h>
 
 #include <machine/regnum.h>
 #include <machine/trap.h>
@@ -370,10 +369,12 @@
 }
 
 static void
-irix_set_sigcontext (struct irix_sigcontext *scp, const sigset_t *mask, int code, struct lwp *l)
+irix_set_sigcontext (struct irix_sigcontext *scp, const sigset_t *mask,
+    int code, struct lwp *l)
 {
-	int i;
 	struct frame *f;
+	struct pcb *pcb;
+	int i;
 
 	KASSERT(mutex_owned(l->l_proc->p_lock));
 
@@ -400,19 +401,19 @@
 	/*
 	 * Save the floating-pointstate, if necessary, then copy it.
 	 */
+	pcb = lwp_getpcb(l);
 #ifndef SOFTFLOAT
 	scp->isc_ownedfp = l->l_md.md_flags & MDP_FPUSED;
 	if (scp->isc_ownedfp) {
 		/* if FPU has current state, save it first */
 		if (l == fpcurlwp)
 			savefpregs(l);
-		(void)memcpy(&scp->isc_fpregs, &l->l_addr->u_pcb.pcb_fpregs,
+		memcpy(&scp->isc_fpregs, &pcb->pcb_fpregs,
 		    sizeof(scp->isc_fpregs));
-		scp->isc_fpc_csr = l->l_addr->u_pcb.pcb_fpregs.r_regs[32];
+		scp->isc_fpc_csr = pcb->pcb_fpregs.r_regs[32];
 	}
 #else
-	(void)memcpy(&scp->isc_fpregs, &l->l_addr->u_pcb.pcb_fpregs,
-	    sizeof(scp->isc_fpregs));
+	memcpy(&scp->isc_fpregs, &pcb->pcb_fpregs, sizeof(scp->isc_fpregs));
 #endif
 	/*
 	 * Save signal stack
@@ -424,9 +425,11 @@
 }
 
 void
-irix_set_ucontext(struct irix_ucontext *ucp, const sigset_t *mask, int code, struct lwp *l)
+irix_set_ucontext(struct irix_ucontext *ucp, const sigset_t *mask,
+    int code, struct lwp *l)
 {
 	struct frame *f;
+	struct pcb *pcb;
 
 	KASSERT(mutex_owned(l->l_proc->p_lock));
 
@@ -450,21 +453,20 @@
 	/*
 	 * Save the floating-pointstate, if necessary, then copy it.
 	 */
+	pcb = lwp_getpcb(l);
 #ifndef SOFTFLOAT
 	if (l->l_md.md_flags & MDP_FPUSED) {
 		/* if FPU has current state, save it first */
 		if (l == fpcurlwp)
 			savefpregs(l);
-		(void)memcpy(&ucp->iuc_mcontext.svr4___fpregs,
-		    &l->l_addr->u_pcb.pcb_fpregs,
-		    sizeof(ucp->iuc_mcontext.svr4___fpregs));
+		memcpy(&ucp->iuc_mcontext.svr4___fpregs,
+		    &pcb->pcb_fpregs, sizeof(ucp->iuc_mcontext.svr4___fpregs));
 		ucp->iuc_mcontext.svr4___fpregs.svr4___fp_csr =
-		    l->l_addr->u_pcb.pcb_fpregs.r_regs[32];
+		    pcb->pcb_fpregs.r_regs[32];
 	}
 #else
-	(void)memcpy(&ucp->iuc_mcontext.svr4___fpregs,
-	    &l->l_addr->u_pcb.pcb_fpregs,
-	    sizeof(ucp->iuc_mcontext.svr4___fpregs));
+	memcpy(&ucp->iuc_mcontext.svr4___fpregs,
+	    &pcb->pcb_fpregs, sizeof(ucp->iuc_mcontext.svr4___fpregs));
 #endif
 	/*
 	 * Save signal stack
@@ -570,20 +572,19 @@
 	}
 
 	if (ucp->iuc_flags & IRIX_UC_MAU) {
+		struct pcb *pcb = lwp_getpcb(l);
 #ifndef SOFTFLOAT
 		/* Disable the FPU to fault in FP registers. */
 		f->f_regs[_R_SR] &= ~MIPS_SR_COP_1_BIT;
 		if (l == fpcurlwp)
 			fpcurlwp = NULL;
-		(void)memcpy(&l->l_addr->u_pcb.pcb_fpregs,
-		    &ucp->iuc_mcontext.svr4___fpregs,
-		    sizeof(l->l_addr->u_pcb.pcb_fpregs));
-		l->l_addr->u_pcb.pcb_fpregs.r_regs[32] =
+		memcpy(&pcb->pcb_fpregs, &ucp->iuc_mcontext.svr4___fpregs,
+		    sizeof(pcb->pcb_fpregs));
+		pcb->pcb_fpregs.r_regs[32] =
 		     ucp->iuc_mcontext.svr4___fpregs.svr4___fp_csr;
 #else
-		(void)memcpy(&l->l_addr->u_pcb.pcb_fpregs,
-		    &ucp->iuc_mcontext.svr4___fpregs,
-		    sizeof(l->l_addr->u_pcb.pcb_fpregs));
+		memcpy(&pcb->pcb_fpregs, &ucp->iuc_mcontext.svr4___fpregs,
+		    sizeof(pcb->pcb_fpregs));
 #endif
 	}
 
@@ -620,9 +621,10 @@
 static void
 irix_get_sigcontext(struct irix_sigcontext *scp, struct lwp *l)
 {
-	int i;
 	struct frame *f;
+	struct pcb *pcb;
 	sigset_t mask;
+	int i;
 
 	KASSERT(mutex_owned(l->l_proc->p_lock));
 
@@ -635,19 +637,19 @@
 	f->f_regs[_R_MULHI] = scp->isc_mdhi;
 	f->f_regs[_R_PC] = scp->isc_pc;
 
+	pcb = lwp_getpcb(l);
 #ifndef SOFTFLOAT
 	if (scp->isc_ownedfp) {
 		/* Disable the FPU to fault in FP registers. */
 		f->f_regs[_R_SR] &= ~MIPS_SR_COP_1_BIT;
 		if (l == fpcurlwp)
 			fpcurlwp = NULL;
-		(void)memcpy(&l->l_addr->u_pcb.pcb_fpregs, &scp->isc_fpregs,
+		memcpy(&pcb->pcb_fpregs, &scp->isc_fpregs,
 		    sizeof(scp->isc_fpregs));
-		l->l_addr->u_pcb.pcb_fpregs.r_regs[32] = scp->isc_fpc_csr;
+		pcb->pcb_fpregs.r_regs[32] = scp->isc_fpc_csr;
 	}
 #else
-	(void)memcpy(&l->l_addr->u_pcb.pcb_fpregs, &scp->isc_fpregs,
-	    sizeof(l->l_addr->u_pcb.pcb_fpregs));
+	memcpy(&pcb->pcb_fpregs, &scp->isc_fpregs, sizeof(pcb->pcb_fpregs));
 #endif
 
 	/* Restore signal stack. */

Index: src/sys/compat/linux/arch/alpha/linux_machdep.c
diff -u src/sys/compat/linux/arch/alpha/linux_machdep.c:1.44 src/sys/compat/linux/arch/alpha/linux_machdep.c:1.45
--- src/sys/compat/linux/arch/alpha/linux_machdep.c:1.44	Wed Mar 18 17:06:48 2009
+++ src/sys/compat/linux/arch/alpha/linux_machdep.c	Mon Nov 23 00:46:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_machdep.c,v 1.44 2009/03/18 17:06:48 cegger Exp $	*/
+/*	$NetBSD: linux_machdep.c,v 1.45 2009/11/23 00:46:06 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,14 +35,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.44 2009/03/18 17:06:48 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.45 2009/11/23 00:46:06 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/signalvar.h>
 #include <sys/kernel.h>
 #include <sys/proc.h>
-#include <sys/user.h>
 #include <sys/buf.h>
 #include <sys/reboot.h>
 #include <sys/conf.h>
@@ -256,11 +255,13 @@
 	sigframe.sf_sc.sc_regs[R_SP] = alpha_pal_rdusp();
 
 	if (l == fpcurlwp) {
-	    alpha_pal_wrfen(1);
-	    savefpstate(&l->l_addr->u_pcb.pcb_fp);
-	    alpha_pal_wrfen(0);
-	    sigframe.sf_sc.sc_fpcr = l->l_addr->u_pcb.pcb_fp.fpr_cr;
-	    fpcurlwp = NULL;
+		struct pcb *pcb = lwp_getpcb(l);
+
+		alpha_pal_wrfen(1);
+		savefpstate(&pcb->pcb_fp);
+		alpha_pal_wrfen(0);
+		sigframe.sf_sc.sc_fpcr = pcb->pcb_fp.fpr_cr;
+		fpcurlwp = NULL;
 	}
 	/* XXX ownedfp ? etc...? */
 
@@ -374,6 +375,7 @@
 			 sigset_t *mask)
 {
 	struct proc *p = l->l_proc;
+	struct pcb *pcb;
 
 	/*
 	 * Linux doesn't (yet) have alternate signal stacks.
@@ -407,7 +409,8 @@
 	    fpcurlwp = NULL;
 
 	/* Restore fp regs and fpr_cr */
-	memcpy( &l->l_addr->u_pcb.pcb_fp, (struct fpreg *)context.sc_fpregs,
+	pcb = lwp_getpcb(l);
+	memcpy(&pcb->pcb_fp, (struct fpreg *)context.sc_fpregs,
 	    sizeof(struct fpreg));
 	/* XXX sc_ownedfp ? */
 	/* XXX sc_fp_control ? */

Index: src/sys/compat/linux/arch/amd64/linux_machdep.c
diff -u src/sys/compat/linux/arch/amd64/linux_machdep.c:1.36 src/sys/compat/linux/arch/amd64/linux_machdep.c:1.37
--- src/sys/compat/linux/arch/amd64/linux_machdep.c:1.36	Fri May 29 14:19:12 2009
+++ src/sys/compat/linux/arch/amd64/linux_machdep.c	Mon Nov 23 00:46:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_machdep.c,v 1.36 2009/05/29 14:19:12 njoly Exp $ */
+/*	$NetBSD: linux_machdep.c,v 1.37 2009/11/23 00:46:06 rmind Exp $ */
 
 /*-
  * Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved.
@@ -33,7 +33,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.36 2009/05/29 14:19:12 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.37 2009/11/23 00:46:06 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -42,7 +42,6 @@
 #include <sys/exec.h>
 #include <sys/proc.h>
 #include <sys/ptrace.h> /* for process_read_fpregs() */
-#include <sys/user.h>
 #include <sys/ucontext.h>
 #include <sys/conf.h>
 
@@ -82,11 +81,11 @@
 void
 linux_setregs(struct lwp *l, struct exec_package *epp, u_long stack)
 {
-	struct pcb *pcb = &l->l_addr->u_pcb;
+	struct pcb *pcb = lwp_getpcb(l);
 	struct trapframe *tf;
 
 	/* If we were using the FPU, forget about it. */
-	if (l->l_addr->u_pcb.pcb_fpcpu != NULL)
+	if (pcb->pcb_fpcpu != NULL)
 		fpusave_lwp(l, 0);
 
 	l->l_md.md_flags &= ~MDP_USEDFPU;
@@ -133,6 +132,7 @@
 {
 	struct lwp *l = curlwp;
 	struct proc *p = l->l_proc;
+	struct pcb *pcb = lwp_getpcb(l);
 	struct sigacts *ps = p->p_sigacts;
 	int onstack, error;
 	int sig = ksi->ksi_signo;
@@ -220,7 +220,7 @@
 	sigframe.uc.luc_mcontext.trapno = tf->tf_trapno;
 	native_to_linux_sigset(&lmask, mask);
 	sigframe.uc.luc_mcontext.oldmask = lmask.sig[0];
-	sigframe.uc.luc_mcontext.cr2 = (long)l->l_addr->u_pcb.pcb_onfault;
+	sigframe.uc.luc_mcontext.cr2 = (long)pcb->pcb_onfault;
 	sigframe.uc.luc_mcontext.fpstate = fpsp;
 	native_to_linux_sigset(&sigframe.uc.luc_sigmask, mask);
 
@@ -482,13 +482,14 @@
 }
 
 int
-linux_sys_arch_prctl(struct lwp *l, const struct linux_sys_arch_prctl_args *uap, register_t *retval)
+linux_sys_arch_prctl(struct lwp *l,
+    const struct linux_sys_arch_prctl_args *uap, register_t *retval)
 {
 	/* {
 		syscallarg(int) code;
 		syscallarg(unsigned long) addr;
 	} */
-	struct pcb *pcb = &l->l_addr->u_pcb;
+	struct pcb *pcb = lwp_getpcb(l);
 	struct trapframe *tf = l->l_md.md_regs;
 	int error;
 	uint64_t taddr;

Index: src/sys/compat/linux/arch/arm/linux_machdep.c
diff -u src/sys/compat/linux/arch/arm/linux_machdep.c:1.27 src/sys/compat/linux/arch/arm/linux_machdep.c:1.28
--- src/sys/compat/linux/arch/arm/linux_machdep.c:1.27	Mon Apr 28 20:23:42 2008
+++ src/sys/compat/linux/arch/arm/linux_machdep.c	Mon Nov 23 00:46:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_machdep.c,v 1.27 2008/04/28 20:23:42 martin Exp $	*/
+/*	$NetBSD: linux_machdep.c,v 1.28 2009/11/23 00:46:06 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1995, 2000 The NetBSD Foundation, Inc.
@@ -31,14 +31,13 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.27 2008/04/28 20:23:42 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.28 2009/11/23 00:46:06 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/signalvar.h>
 #include <sys/kernel.h>
 #include <sys/proc.h>
-#include <sys/user.h>
 #include <sys/buf.h>
 #include <sys/reboot.h>
 #include <sys/conf.h>

Index: src/sys/compat/linux/arch/i386/linux_exec_machdep.c
diff -u src/sys/compat/linux/arch/i386/linux_exec_machdep.c:1.13 src/sys/compat/linux/arch/i386/linux_exec_machdep.c:1.14
--- src/sys/compat/linux/arch/i386/linux_exec_machdep.c:1.13	Sun Sep 20 10:29:30 2009
+++ src/sys/compat/linux/arch/i386/linux_exec_machdep.c	Mon Nov 23 00:46:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_exec_machdep.c,v 1.13 2009/09/20 10:29:30 taca Exp $	*/
+/*	$NetBSD: linux_exec_machdep.c,v 1.14 2009/11/23 00:46:06 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_exec_machdep.c,v 1.13 2009/09/20 10:29:30 taca Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_exec_machdep.c,v 1.14 2009/11/23 00:46:06 rmind Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vm86.h"
@@ -145,7 +145,7 @@
 linux_init_thread_area(struct lwp *l, struct lwp *l2)
 {
 	struct trapframe *tf = l->l_md.md_regs, *tf2 = l2->l_md.md_regs;
-	struct pcb *pcb2 = &l2->l_addr->u_pcb;
+	struct pcb *pcb2 = lwp_getpcb(l2);
 	struct linux_user_desc info;
 	struct segment_descriptor sd;
 	int error, idx, a[2];
@@ -195,7 +195,7 @@
 linux_sys_set_thread_area(struct lwp *l,
     const struct linux_sys_set_thread_area_args *uap, register_t *retval)
 {
-	struct pcb *pcb = &l->l_addr->u_pcb;
+	struct pcb *pcb = lwp_getpcb(l);
 	struct linux_user_desc info;
 	struct segment_descriptor sd;
 	int error, idx, a[2];
@@ -277,7 +277,7 @@
 linux_sys_get_thread_area(struct lwp *l,
     const struct linux_sys_get_thread_area_args *uap, register_t *retval)
 {
-	struct pcb *pcb = &l->l_addr->u_pcb;
+	struct pcb *pcb = lwp_getpcb(l);
 	struct linux_user_desc info;
 	struct linux_desc_struct desc;
 	struct segment_descriptor sd;

Index: src/sys/compat/linux/arch/i386/linux_machdep.c
diff -u src/sys/compat/linux/arch/i386/linux_machdep.c:1.145 src/sys/compat/linux/arch/i386/linux_machdep.c:1.146
--- src/sys/compat/linux/arch/i386/linux_machdep.c:1.145	Fri May 29 14:19:13 2009
+++ src/sys/compat/linux/arch/i386/linux_machdep.c	Mon Nov 23 00:46:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_machdep.c,v 1.145 2009/05/29 14:19:13 njoly Exp $	*/
+/*	$NetBSD: linux_machdep.c,v 1.146 2009/11/23 00:46:06 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1995, 2000, 2008, 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.145 2009/05/29 14:19:13 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.146 2009/11/23 00:46:06 rmind Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vm86.h"
@@ -42,7 +42,6 @@
 #include <sys/signalvar.h>
 #include <sys/kernel.h>
 #include <sys/proc.h>
-#include <sys/user.h>
 #include <sys/buf.h>
 #include <sys/reboot.h>
 #include <sys/conf.h>
@@ -126,7 +125,7 @@
 void
 linux_setregs(struct lwp *l, struct exec_package *epp, u_long stack)
 {
-	struct pcb *pcb = &l->l_addr->u_pcb;
+	struct pcb *pcb = lwp_getpcb(l);
 	struct trapframe *tf;
 
 #if NNPX > 0
@@ -199,8 +198,11 @@
 }
 
 static void
-linux_save_sigcontext(struct lwp *l, struct trapframe *tf, const sigset_t *mask, struct linux_sigcontext *sc)
+linux_save_sigcontext(struct lwp *l, struct trapframe *tf,
+    const sigset_t *mask, struct linux_sigcontext *sc)
 {
+	struct pcb *pcb = lwp_getpcb(l);
+
 	/* Save register context. */
 #ifdef VM86
 	if (tf->tf_eflags & PSL_VM) {
@@ -232,7 +234,7 @@
 	sc->sc_ss = tf->tf_ss;
 	sc->sc_err = tf->tf_err;
 	sc->sc_trapno = tf->tf_trapno;
-	sc->sc_cr2 = l->l_addr->u_pcb.pcb_cr2;
+	sc->sc_cr2 = pcb->pcb_cr2;
 	sc->sc_387 = NULL;
 
 	/* Save signal stack. */
@@ -270,7 +272,8 @@
 	fp--;
 
 	DPRINTF(("rt: onstack = %d, fp = %p sig = %d eip = 0x%x cr2 = 0x%x\n",
-	    onstack, fp, sig, tf->tf_eip, l->l_addr->u_pcb.pcb_cr2));
+	    onstack, fp, sig, tf->tf_eip,
+	    ((struct pcb *)lwp_getpcb(l))->pcb_cr2));
 
 	/* Build stack frame for signal trampoline. */
 	frame.sf_handler = catcher;
@@ -377,7 +380,8 @@
 	fp--;
 
 	DPRINTF(("old: onstack = %d, fp = %p sig = %d eip = 0x%x cr2 = 0x%x\n",
-	    onstack, fp, sig, tf->tf_eip, l->l_addr->u_pcb.pcb_cr2));
+	    onstack, fp, sig, tf->tf_eip,
+	    ((struct pcb *)lwp_getpcb(l))->pcb_cr2));
 
 	/* Build stack frame for signal trampoline. */
 	frame.sf_handler = catcher;

Index: src/sys/compat/linux/arch/mips/linux_machdep.c
diff -u src/sys/compat/linux/arch/mips/linux_machdep.c:1.38 src/sys/compat/linux/arch/mips/linux_machdep.c:1.39
--- src/sys/compat/linux/arch/mips/linux_machdep.c:1.38	Mon Apr 28 20:23:43 2008
+++ src/sys/compat/linux/arch/mips/linux_machdep.c	Mon Nov 23 00:46:07 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_machdep.c,v 1.38 2008/04/28 20:23:43 martin Exp $ */
+/*	$NetBSD: linux_machdep.c,v 1.39 2009/11/23 00:46:07 rmind Exp $ */
 
 /*-
  * Copyright (c) 1995, 2000, 2001 The NetBSD Foundation, Inc.
@@ -30,14 +30,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.38 2008/04/28 20:23:43 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.39 2009/11/23 00:46:07 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/signalvar.h>
 #include <sys/kernel.h>
 #include <sys/proc.h>
-#include <sys/user.h>
 #include <sys/buf.h>
 #include <sys/reboot.h>
 #include <sys/conf.h>

Index: src/sys/compat/linux/arch/powerpc/linux_machdep.c
diff -u src/sys/compat/linux/arch/powerpc/linux_machdep.c:1.39 src/sys/compat/linux/arch/powerpc/linux_machdep.c:1.40
--- src/sys/compat/linux/arch/powerpc/linux_machdep.c:1.39	Mon Apr 28 20:23:43 2008
+++ src/sys/compat/linux/arch/powerpc/linux_machdep.c	Mon Nov 23 00:46:07 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_machdep.c,v 1.39 2008/04/28 20:23:43 martin Exp $ */
+/*	$NetBSD: linux_machdep.c,v 1.40 2009/11/23 00:46:07 rmind Exp $ */
 
 /*-
  * Copyright (c) 1995, 2000, 2001 The NetBSD Foundation, Inc.
@@ -30,14 +30,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.39 2008/04/28 20:23:43 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.40 2009/11/23 00:46:07 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/signalvar.h>
 #include <sys/kernel.h>
 #include <sys/proc.h>
-#include <sys/user.h>
 #include <sys/buf.h>
 #include <sys/reboot.h>
 #include <sys/conf.h>

Index: src/sys/compat/linux32/arch/amd64/linux32_machdep.c
diff -u src/sys/compat/linux32/arch/amd64/linux32_machdep.c:1.22 src/sys/compat/linux32/arch/amd64/linux32_machdep.c:1.23
--- src/sys/compat/linux32/arch/amd64/linux32_machdep.c:1.22	Fri May 29 14:19:13 2009
+++ src/sys/compat/linux32/arch/amd64/linux32_machdep.c	Mon Nov 23 00:46:07 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_machdep.c,v 1.22 2009/05/29 14:19:13 njoly Exp $ */
+/*	$NetBSD: linux32_machdep.c,v 1.23 2009/11/23 00:46:07 rmind Exp $ */
 
 /*-
  * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -31,14 +31,13 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux32_machdep.c,v 1.22 2009/05/29 14:19:13 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_machdep.c,v 1.23 2009/11/23 00:46:07 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/signalvar.h>
 #include <sys/kernel.h>
 #include <sys/proc.h>
-#include <sys/user.h>
 #include <sys/buf.h>
 #include <sys/reboot.h>
 #include <sys/conf.h>
@@ -281,13 +280,13 @@
 void
 linux32_setregs(struct lwp *l, struct exec_package *pack, u_long stack)
 {
-	struct pcb *pcb = &l->l_addr->u_pcb;
+	struct pcb *pcb = lwp_getpcb(l);
 	struct trapframe *tf;
 	struct proc *p = l->l_proc;
 	void **retaddr;
 
 	/* If we were using the FPU, forget about it. */
-	if (l->l_addr->u_pcb.pcb_fpcpu != NULL)
+	if (pcb->pcb_fpcpu != NULL)
 		fpusave_lwp(l, 0);
 
 #if defined(USER_LDT) && 0
@@ -340,8 +339,10 @@
 }
 
 static void
-linux32_save_ucontext(struct lwp *l, struct trapframe *tf, const sigset_t *mask, struct sigaltstack *sas, struct linux32_ucontext *uc)
+linux32_save_ucontext(struct lwp *l, struct trapframe *tf,
+    const sigset_t *mask, struct sigaltstack *sas, struct linux32_ucontext *uc)
 {
+
 	uc->uc_flags = 0;
 	NETBSD32PTR32(uc->uc_link, NULL);
 	native_to_linux32_sigaltstack(&uc->uc_stack, sas);
@@ -354,6 +355,8 @@
 linux32_save_sigcontext(struct lwp *l, struct trapframe *tf,
 			const sigset_t *mask, struct linux32_sigcontext *sc)
 {
+	struct pcb *pcb = lwp_getpcb(l);
+
 	/* Save register context. */
 	sc->sc_gs = tf->tf_gs;
 	sc->sc_fs = tf->tf_fs;
@@ -374,7 +377,7 @@
 	sc->sc_ss = tf->tf_ss;
 	sc->sc_err = tf->tf_err;
 	sc->sc_trapno = tf->tf_trapno;
-	sc->sc_cr2 = l->l_addr->u_pcb.pcb_cr2;
+	sc->sc_cr2 = pcb->pcb_cr2;
 	NETBSD32PTR32(sc->sc_387, NULL);
 
 	/* Save signal stack. */
@@ -385,7 +388,8 @@
 }
 
 int
-linux32_sys_sigreturn(struct lwp *l, const struct linux32_sys_sigreturn_args *uap, register_t *retval)
+linux32_sys_sigreturn(struct lwp *l,
+    const struct linux32_sys_sigreturn_args *uap, register_t *retval)
 {
 	/* {
 		syscallarg(linux32_sigcontextp_t) scp;
@@ -400,7 +404,8 @@
 }
 
 int
-linux32_sys_rt_sigreturn(struct lwp *l, const struct linux32_sys_rt_sigreturn_args *uap, register_t *retval)
+linux32_sys_rt_sigreturn(struct lwp *l,
+    const struct linux32_sys_rt_sigreturn_args *uap, register_t *retval)
 {
 	/* {
 		syscallarg(linux32_ucontextp_t) ucp;

Index: src/sys/compat/osf1/osf1_misc.c
diff -u src/sys/compat/osf1/osf1_misc.c:1.83 src/sys/compat/osf1/osf1_misc.c:1.84
--- src/sys/compat/osf1/osf1_misc.c:1.83	Wed Nov  4 21:23:03 2009
+++ src/sys/compat/osf1/osf1_misc.c	Mon Nov 23 00:46:07 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_misc.c,v 1.83 2009/11/04 21:23:03 rmind Exp $ */
+/* $NetBSD: osf1_misc.c,v 1.84 2009/11/23 00:46:07 rmind Exp $ */
 
 /*
  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: osf1_misc.c,v 1.83 2009/11/04 21:23:03 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: osf1_misc.c,v 1.84 2009/11/23 00:46:07 rmind Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_syscall_debug.h"
@@ -84,7 +84,6 @@
 #include <sys/socketvar.h>
 #include <sys/resource.h>
 #include <sys/resourcevar.h>
-#include <sys/user.h>
 #include <sys/wait.h>
 
 #include <machine/alpha.h>

Index: src/sys/compat/svr4/svr4_lwp.c
diff -u src/sys/compat/svr4/svr4_lwp.c:1.18 src/sys/compat/svr4/svr4_lwp.c:1.19
--- src/sys/compat/svr4/svr4_lwp.c:1.18	Mon Apr 28 20:23:45 2008
+++ src/sys/compat/svr4/svr4_lwp.c	Mon Nov 23 00:46:07 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_lwp.c,v 1.18 2008/04/28 20:23:45 martin Exp $	*/
+/*	$NetBSD: svr4_lwp.c,v 1.19 2009/11/23 00:46:07 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: svr4_lwp.c,v 1.18 2008/04/28 20:23:45 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_lwp.c,v 1.19 2009/11/23 00:46:07 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -42,7 +42,6 @@
 #include <sys/time.h>
 #include <sys/resourcevar.h>
 #include <sys/proc.h>
-#include <sys/user.h>
 #include <sys/socket.h>
 #include <sys/socketvar.h>
 #include <sys/syscallargs.h>

Index: src/sys/compat/svr4_32/svr4_32_lwp.c
diff -u src/sys/compat/svr4_32/svr4_32_lwp.c:1.16 src/sys/compat/svr4_32/svr4_32_lwp.c:1.17
--- src/sys/compat/svr4_32/svr4_32_lwp.c:1.16	Mon Apr 28 20:23:46 2008
+++ src/sys/compat/svr4_32/svr4_32_lwp.c	Mon Nov 23 00:46:07 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_32_lwp.c,v 1.16 2008/04/28 20:23:46 martin Exp $	*/
+/*	$NetBSD: svr4_32_lwp.c,v 1.17 2009/11/23 00:46:07 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: svr4_32_lwp.c,v 1.16 2008/04/28 20:23:46 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_32_lwp.c,v 1.17 2009/11/23 00:46:07 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -42,7 +42,6 @@
 #include <sys/time.h>
 #include <sys/resourcevar.h>
 #include <sys/proc.h>
-#include <sys/user.h>
 #include <sys/socket.h>
 #include <sys/socketvar.h>
 #include <sys/syscallargs.h>

Reply via email to