From 498ef96f103a7966262edb6ebe55e93c5f6b1ff7 Mon Sep 17 00:00:00 2001 From: rmind Date: Sat, 21 Nov 2009 05:35:40 +0000 Subject: [PATCH] - Use lwp_getpcb() on Alpha. - Replace and clean struct user usage, slightly simplify some code parts. - Include sys/user.h in MD proc.h . --- sys/arch/alpha/a12/a12dc.c | 7 +-- sys/arch/alpha/alpha/compat_13_machdep.c | 11 ++-- sys/arch/alpha/alpha/compat_16_machdep.c | 18 +++--- sys/arch/alpha/alpha/core_machdep.c | 10 ++-- sys/arch/alpha/alpha/cpu.c | 7 +-- sys/arch/alpha/alpha/db_trace.c | 7 +-- sys/arch/alpha/alpha/linux_syscall.c | 5 +- sys/arch/alpha/alpha/linux_trap.c | 5 +- sys/arch/alpha/alpha/machdep.c | 58 +++++++++++-------- sys/arch/alpha/alpha/osf1_syscall.c | 5 +- sys/arch/alpha/alpha/pmap.c | 18 +++--- sys/arch/alpha/alpha/process_machdep.c | 23 ++++---- sys/arch/alpha/alpha/prom.c | 10 ++-- sys/arch/alpha/alpha/promcons.c | 5 +- sys/arch/alpha/alpha/syscall.c | 5 +- sys/arch/alpha/alpha/trap.c | 66 ++++++++++++--------- sys/arch/alpha/alpha/vm_machdep.c | 74 ++++++++++++------------ sys/arch/alpha/include/proc.h | 3 +- sys/arch/alpha/jensenio/com_jensenio.c | 5 +- sys/arch/alpha/jensenio/lpt_jensenio.c | 5 +- sys/arch/alpha/sableio/com_sableio.c | 5 +- sys/arch/alpha/sableio/lpt_sableio.c | 5 +- 22 files changed, 185 insertions(+), 172 deletions(-) diff --git a/sys/arch/alpha/a12/a12dc.c b/sys/arch/alpha/a12/a12dc.c index 3225dea2ab29..6a93183f5ca5 100644 --- a/sys/arch/alpha/a12/a12dc.c +++ b/sys/arch/alpha/a12/a12dc.c @@ -1,4 +1,4 @@ -/* $NetBSD: a12dc.c,v 1.23 2009/03/18 10:22:22 cegger Exp $ */ +/* $NetBSD: a12dc.c,v 1.24 2009/11/21 05:35:40 rmind Exp $ */ /* [Notice revision 2.2] * Copyright (c) 1997, 1998 Avalon Computer Systems, Inc. @@ -64,7 +64,7 @@ #ifndef BSIDE #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: a12dc.c,v 1.23 2009/03/18 10:22:22 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: a12dc.c,v 1.24 2009/11/21 05:35:40 rmind Exp $"); #include #include @@ -73,7 +73,6 @@ __KERNEL_RCSID(0, "$NetBSD: a12dc.c,v 1.23 2009/03/18 10:22:22 cegger Exp $"); #include #include -#include #include #include #include @@ -159,7 +158,7 @@ a12dcattach(struct device *parent, struct device *self, void *aux) /* note that we've attached the chipset; can't have 2 A12Cs. */ a12dcfound = 1; - printf(": driver %s\n", "$Revision: 1.23 $"); + printf(": driver %s\n", "$Revision: 1.24 $"); tp = a12dc_tty[0] = ttymalloc(); tp->t_oproc = a12dcstart; diff --git a/sys/arch/alpha/alpha/compat_13_machdep.c b/sys/arch/alpha/alpha/compat_13_machdep.c index c752d57e53f7..30272bb7e453 100644 --- a/sys/arch/alpha/alpha/compat_13_machdep.c +++ b/sys/arch/alpha/alpha/compat_13_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: compat_13_machdep.c,v 1.17 2008/04/24 18:39:20 ad Exp $ */ +/* $NetBSD: compat_13_machdep.c,v 1.18 2009/11/21 05:35:40 rmind Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -29,14 +29,13 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.17 2008/04/24 18:39:20 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.18 2009/11/21 05:35:40 rmind Exp $"); #include #include #include #include #include -#include #include #include @@ -66,6 +65,7 @@ compat_13_sys_sigreturn(struct lwp *l, const struct compat_13_sys_sigreturn_args } */ struct sigcontext13 *scp, ksc; struct proc *p = l->l_proc; + struct pcb *pcb; sigset13_t mask13; sigset_t mask; @@ -93,9 +93,10 @@ compat_13_sys_sigreturn(struct lwp *l, const struct compat_13_sys_sigreturn_args alpha_pal_wrusp(ksc.sc_regs[R_SP]); /* XXX ksc.sc_ownedfp ? */ - if (l->l_addr->u_pcb.pcb_fpcpu != NULL) + pcb = lwp_getpcb(l); + if (pcb->pcb_fpcpu != NULL) fpusave_proc(l, 0); - memcpy(&l->l_addr->u_pcb.pcb_fp, (struct fpreg *)ksc.sc_fpregs, + memcpy(&pcb->pcb_fp, (struct fpreg *)ksc.sc_fpregs, sizeof(struct fpreg)); /* XXX ksc.sc_fp_control ? */ diff --git a/sys/arch/alpha/alpha/compat_16_machdep.c b/sys/arch/alpha/alpha/compat_16_machdep.c index be569cf8081e..3d9dfa17160b 100644 --- a/sys/arch/alpha/alpha/compat_16_machdep.c +++ b/sys/arch/alpha/alpha/compat_16_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: compat_16_machdep.c,v 1.15 2008/11/21 19:48:56 he Exp $ */ +/* $NetBSD: compat_16_machdep.c,v 1.16 2009/11/21 05:35:40 rmind Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -77,7 +77,6 @@ #include #include #include -#include #if defined(COMPAT_13) || defined(COMPAT_OSF1) #include @@ -87,7 +86,7 @@ #include #include -__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.15 2008/11/21 19:48:56 he Exp $"); +__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.16 2009/11/21 05:35:40 rmind Exp $"); #ifdef DEBUG @@ -106,6 +105,7 @@ sendsig_sigcontext(const ksiginfo_t *ksi, const sigset_t *mask) { struct lwp *l = curlwp; struct proc *p = l->l_proc; + struct pcb *pcb = lwp_getpcb(l); struct sigacts *ps = p->p_sigacts; int onstack, sig = ksi->ksi_signo, error; struct sigframe_sigcontext *fp, frame; @@ -132,10 +132,10 @@ sendsig_sigcontext(const ksiginfo_t *ksi, const sigset_t *mask) frame.sf_sc.sc_regs[R_SP] = alpha_pal_rdusp(); /* save the floating-point state, if necessary, then copy it. */ - if (l->l_addr->u_pcb.pcb_fpcpu != NULL) + if (pcb->pcb_fpcpu != NULL) fpusave_proc(l, 1); frame.sf_sc.sc_ownedfp = l->l_md.md_flags & MDP_FPUSED; - memcpy((struct fpreg *)frame.sf_sc.sc_fpregs, &l->l_addr->u_pcb.pcb_fp, + memcpy((struct fpreg *)frame.sf_sc.sc_fpregs, &pcb->pcb_fp, sizeof(struct fpreg)); frame.sf_sc.sc_fp_control = alpha_read_fp_c(l); memset(frame.sf_sc.sc_reserved, 0, sizeof frame.sf_sc.sc_reserved); @@ -252,6 +252,7 @@ compat_16_sys___sigreturn14(struct lwp *l, const struct compat_16_sys___sigretur } */ struct sigcontext *scp, ksc; struct proc *p = l->l_proc; + struct pcb *pcb; /* * The trampoline code hands us the context. @@ -281,11 +282,12 @@ compat_16_sys___sigreturn14(struct lwp *l, const struct compat_16_sys___sigretur alpha_pal_wrusp(ksc.sc_regs[R_SP]); /* XXX ksc.sc_ownedfp ? */ - if (l->l_addr->u_pcb.pcb_fpcpu != NULL) + pcb = lwp_getpcb(l); + if (pcb->pcb_fpcpu != NULL) fpusave_proc(l, 0); - memcpy(&l->l_addr->u_pcb.pcb_fp, (struct fpreg *)ksc.sc_fpregs, + memcpy(&pcb->pcb_fp, (struct fpreg *)ksc.sc_fpregs, sizeof(struct fpreg)); - l->l_addr->u_pcb.pcb_fp.fpr_cr = ksc.sc_fpcr; + pcb->pcb_fp.fpr_cr = ksc.sc_fpcr; l->l_md.md_flags = ksc.sc_fp_control & MDP_FP_C; mutex_enter(p->p_lock); diff --git a/sys/arch/alpha/alpha/core_machdep.c b/sys/arch/alpha/alpha/core_machdep.c index 33928f0e8d15..22173b57d900 100644 --- a/sys/arch/alpha/alpha/core_machdep.c +++ b/sys/arch/alpha/alpha/core_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: core_machdep.c,v 1.2 2009/08/15 23:44:57 matt Exp $ */ +/* $NetBSD: core_machdep.c,v 1.3 2009/11/21 05:35:40 rmind Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -29,7 +29,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: core_machdep.c,v 1.2 2009/08/15 23:44:57 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: core_machdep.c,v 1.3 2009/11/21 05:35:40 rmind Exp $"); #include #include @@ -37,7 +37,6 @@ __KERNEL_RCSID(0, "$NetBSD: core_machdep.c,v 1.2 2009/08/15 23:44:57 matt Exp $" #include #include #include -#include #include #include @@ -72,9 +71,10 @@ cpu_coredump(struct lwp *l, void *iocookie, struct core *chdr) cpustate.md_tf = *l->l_md.md_tf; cpustate.md_tf.tf_regs[FRAME_SP] = alpha_pal_rdusp(); /* XXX */ if (l->l_md.md_flags & MDP_FPUSED) { - if (l->l_addr->u_pcb.pcb_fpcpu != NULL) + struct pcb *pcb = lwp_getpcb(l); + if (pcb->pcb_fpcpu != NULL) fpusave_proc(l, 1); - cpustate.md_fpstate = l->l_addr->u_pcb.pcb_fp; + cpustate.md_fpstate = pcb->pcb_fp; } else memset(&cpustate.md_fpstate, 0, sizeof(cpustate.md_fpstate)); diff --git a/sys/arch/alpha/alpha/cpu.c b/sys/arch/alpha/alpha/cpu.c index fce8c1a0957a..720e554c1a9f 100644 --- a/sys/arch/alpha/alpha/cpu.c +++ b/sys/arch/alpha/alpha/cpu.c @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.86 2009/09/06 18:06:24 mhitch Exp $ */ +/* $NetBSD: cpu.c,v 1.87 2009/11/21 05:35:40 rmind Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.86 2009/09/06 18:06:24 mhitch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.87 2009/11/21 05:35:40 rmind Exp $"); #include "opt_ddb.h" #include "opt_multiprocessor.h" @@ -69,7 +69,6 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.86 2009/09/06 18:06:24 mhitch Exp $"); #include #include #include -#include #include #include @@ -425,7 +424,7 @@ cpu_boot_secondary(struct cpu_info *ci) struct pcb *pcb; u_long cpumask; - pcb = &ci->ci_data.cpu_idlelwp->l_addr->u_pcb; + pcb = lwp_getpcb(ci->ci_data.cpu_idlelwp); primary_pcsp = LOCATE_PCS(hwrpb, hwrpb->rpb_primary_cpu_id); pcsp = LOCATE_PCS(hwrpb, ci->ci_cpuid); cpumask = (1UL << ci->ci_cpuid); diff --git a/sys/arch/alpha/alpha/db_trace.c b/sys/arch/alpha/alpha/db_trace.c index 761800964789..f18c697f8dd1 100644 --- a/sys/arch/alpha/alpha/db_trace.c +++ b/sys/arch/alpha/alpha/db_trace.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_trace.c,v 1.25 2009/10/21 21:11:58 rmind Exp $ */ +/* $NetBSD: db_trace.c,v 1.26 2009/11/21 05:35:40 rmind Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -35,12 +35,11 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.25 2009/10/21 21:11:58 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.26 2009/11/21 05:35:40 rmind Exp $"); #include #include #include -#include #include #include @@ -230,7 +229,7 @@ db_stack_trace_print(db_expr_t addr, bool have_addr, db_expr_t count, KASSERT(l != NULL); } (*pr)("lid %d ", l->l_lid); - pcbp = &l->l_addr->u_pcb; + pcbp = lwp_getpcb(l); addr = (db_expr_t)pcbp->pcb_hw.apcb_ksp; callpc = pcbp->pcb_context[7]; (*pr)("at 0x%lx\n", addr); diff --git a/sys/arch/alpha/alpha/linux_syscall.c b/sys/arch/alpha/alpha/linux_syscall.c index 46fa75a6c29d..fa6700c46ff8 100644 --- a/sys/arch/alpha/alpha/linux_syscall.c +++ b/sys/arch/alpha/alpha/linux_syscall.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_syscall.c,v 1.29 2008/10/21 12:16:58 ad Exp $ */ +/* $NetBSD: linux_syscall.c,v 1.30 2009/11/21 05:35:40 rmind Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -89,12 +89,11 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.29 2008/10/21 12:16:58 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.30 2009/11/21 05:35:40 rmind Exp $"); #include #include #include -#include #include #include #include diff --git a/sys/arch/alpha/alpha/linux_trap.c b/sys/arch/alpha/alpha/linux_trap.c index 648873a43978..d195df5584fb 100644 --- a/sys/arch/alpha/alpha/linux_trap.c +++ b/sys/arch/alpha/alpha/linux_trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_trap.c,v 1.7 2008/04/28 20:23:10 martin Exp $ */ +/* $NetBSD: linux_trap.c,v 1.8 2009/11/21 05:35:40 rmind Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -30,12 +30,11 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_trap.c,v 1.7 2008/04/28 20:23:10 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_trap.c,v 1.8 2009/11/21 05:35:40 rmind Exp $"); #include #include #include -#include #include #include #include diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c index 1a54f3548e28..053860aa0d41 100644 --- a/sys/arch/alpha/alpha/machdep.c +++ b/sys/arch/alpha/alpha/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.321 2009/10/25 20:39:45 mhitch Exp $ */ +/* $NetBSD: machdep.c,v 1.322 2009/11/21 05:35:40 rmind Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.321 2009/10/25 20:39:45 mhitch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.322 2009/11/21 05:35:40 rmind Exp $"); #include #include @@ -1597,6 +1597,7 @@ void setregs(register struct lwp *l, struct exec_package *pack, u_long stack) { struct trapframe *tfp = l->l_md.md_tf; + struct pcb *pcb; #ifdef DEBUG int i; #endif @@ -1615,7 +1616,8 @@ setregs(register struct lwp *l, struct exec_package *pack, u_long stack) #else memset(tfp->tf_regs, 0, FRAME_SIZE * sizeof tfp->tf_regs[0]); #endif - memset(&l->l_addr->u_pcb.pcb_fp, 0, sizeof l->l_addr->u_pcb.pcb_fp); + pcb = lwp_getpcb(l); + memset(&pcb->pcb_fp, 0, sizeof(pcb->pcb_fp)); alpha_pal_wrusp(stack); tfp->tf_regs[FRAME_PS] = ALPHA_PSL_USERSET; tfp->tf_regs[FRAME_PC] = pack->ep_entry & ~3; @@ -1629,9 +1631,9 @@ setregs(register struct lwp *l, struct exec_package *pack, u_long stack) l->l_md.md_flags &= ~MDP_FPUSED; if (__predict_true((l->l_md.md_flags & IEEE_INHERIT) == 0)) { l->l_md.md_flags &= ~MDP_FP_C; - l->l_addr->u_pcb.pcb_fp.fpr_cr = FPCR_DYN(FP_RN); + pcb->pcb_fp.fpr_cr = FPCR_DYN(FP_RN); } - if (l->l_addr->u_pcb.pcb_fpcpu != NULL) + if (pcb->pcb_fpcpu != NULL) fpusave_proc(l, 0); } @@ -1642,6 +1644,7 @@ void fpusave_cpu(struct cpu_info *ci, int save) { struct lwp *l; + struct pcb *pcb; #if defined(MULTIPROCESSOR) int s; #endif @@ -1657,19 +1660,20 @@ fpusave_cpu(struct cpu_info *ci, int save) if (l == NULL) goto out; + pcb = lwp_getpcb(l); if (save) { alpha_pal_wrfen(1); - savefpstate(&l->l_addr->u_pcb.pcb_fp); + savefpstate(&pcb->pcb_fp); } alpha_pal_wrfen(0); - FPCPU_LOCK(&l->l_addr->u_pcb); + FPCPU_LOCK(pcb); - l->l_addr->u_pcb.pcb_fpcpu = NULL; + pcb->pcb_fpcpu = NULL; ci->ci_fpcurlwp = NULL; - FPCPU_UNLOCK(&l->l_addr->u_pcb); + FPCPU_UNLOCK(pcb); out: #if defined(MULTIPROCESSOR) @@ -1687,21 +1691,23 @@ fpusave_proc(struct lwp *l, int save) { struct cpu_info *ci = curcpu(); struct cpu_info *oci; + struct pcb *pcb; #if defined(MULTIPROCESSOR) u_long ipi = save ? ALPHA_IPI_SYNCH_FPU : ALPHA_IPI_DISCARD_FPU; int s, spincount; #endif - KDASSERT(l->l_addr != NULL); + pcb = lwp_getpcb(l); + KDASSERT(pcb != NULL); #if defined(MULTIPROCESSOR) s = splhigh(); /* block IPIs for the duration */ #endif - FPCPU_LOCK(&l->l_addr->u_pcb); + FPCPU_LOCK(pcb); - oci = l->l_addr->u_pcb.pcb_fpcpu; + oci = pcb->pcb_fpcpu; if (oci == NULL) { - FPCPU_UNLOCK(&l->l_addr->u_pcb); + FPCPU_UNLOCK(pcb); #if defined(MULTIPROCESSOR) splx(s); #endif @@ -1711,7 +1717,7 @@ fpusave_proc(struct lwp *l, int save) #if defined(MULTIPROCESSOR) if (oci == ci) { KASSERT(ci->ci_fpcurlwp == l); - FPCPU_UNLOCK(&l->l_addr->u_pcb); + FPCPU_UNLOCK(pcb); splx(s); fpusave_cpu(ci, save); return; @@ -1719,10 +1725,10 @@ fpusave_proc(struct lwp *l, int save) KASSERT(oci->ci_fpcurlwp == l); alpha_send_ipi(oci->ci_cpuid, ipi); - FPCPU_UNLOCK(&l->l_addr->u_pcb); + FPCPU_UNLOCK(pcb); spincount = 0; - while (l->l_addr->u_pcb.pcb_fpcpu != NULL) { + while (pcb->pcb_fpcpu != NULL) { spincount++; delay(1000); /* XXX */ if (spincount > 10000) @@ -1730,7 +1736,7 @@ fpusave_proc(struct lwp *l, int save) } #else KASSERT(ci->ci_fpcurlwp == l); - FPCPU_UNLOCK(&l->l_addr->u_pcb); + FPCPU_UNLOCK(pcb); fpusave_cpu(ci, save); #endif /* MULTIPROCESSOR */ } @@ -1869,6 +1875,7 @@ void cpu_getmcontext(struct lwp *l, mcontext_t *mcp, unsigned int *flags) { struct trapframe *frame = l->l_md.md_tf; + struct pcb *pcb = lwp_getpcb(l); __greg_t *gr = mcp->__gregs; __greg_t ras_pc; @@ -1882,8 +1889,8 @@ cpu_getmcontext(struct lwp *l, mcontext_t *mcp, unsigned int *flags) gr[_REG_SP] = alpha_pal_rdusp(); gr[_REG_UNIQUE] = alpha_pal_rdunique(); } else { - gr[_REG_SP] = l->l_addr->u_pcb.pcb_hw.apcb_usp; - gr[_REG_UNIQUE] = l->l_addr->u_pcb.pcb_hw.apcb_unique; + gr[_REG_SP] = pcb->pcb_hw.apcb_usp; + gr[_REG_UNIQUE] = pcb->pcb_hw.apcb_unique; } gr[_REG_PC] = frame->tf_regs[FRAME_PC]; gr[_REG_PS] = frame->tf_regs[FRAME_PS]; @@ -1897,7 +1904,7 @@ cpu_getmcontext(struct lwp *l, mcontext_t *mcp, unsigned int *flags) /* Save floating point register context, if any, and copy it. */ if (l->l_md.md_flags & MDP_FPUSED) { fpusave_proc(l, 1); - (void)memcpy(&mcp->__fpregs, &l->l_addr->u_pcb.pcb_fp, + (void)memcpy(&mcp->__fpregs, &pcb->pcb_fp, sizeof (mcp->__fpregs)); mcp->__fpregs.__fp_fpcr = alpha_read_fp_c(l); *flags |= _UC_FPU; @@ -1909,6 +1916,7 @@ int cpu_setmcontext(struct lwp *l, const mcontext_t *mcp, unsigned int flags) { struct trapframe *frame = l->l_md.md_tf; + struct pcb *pcb = lwp_getpcb(l); const __greg_t *gr = mcp->__gregs; /* Restore register context, if any. */ @@ -1922,7 +1930,7 @@ cpu_setmcontext(struct lwp *l, const mcontext_t *mcp, unsigned int flags) if (l == curlwp) alpha_pal_wrusp(gr[_REG_SP]); else - l->l_addr->u_pcb.pcb_hw.apcb_usp = gr[_REG_SP]; + pcb->pcb_hw.apcb_usp = gr[_REG_SP]; frame->tf_regs[FRAME_PC] = gr[_REG_PC]; frame->tf_regs[FRAME_PS] = gr[_REG_PS]; } @@ -1930,15 +1938,15 @@ cpu_setmcontext(struct lwp *l, const mcontext_t *mcp, unsigned int flags) if (l == curlwp) alpha_pal_wrunique(gr[_REG_UNIQUE]); else - l->l_addr->u_pcb.pcb_hw.apcb_unique = gr[_REG_UNIQUE]; + pcb->pcb_hw.apcb_unique = gr[_REG_UNIQUE]; } /* Restore floating point register context, if any. */ if (flags & _UC_FPU) { /* If we have an FP register context, get rid of it. */ - if (l->l_addr->u_pcb.pcb_fpcpu != NULL) + if (pcb->pcb_fpcpu != NULL) fpusave_proc(l, 0); - (void)memcpy(&l->l_addr->u_pcb.pcb_fp, &mcp->__fpregs, - sizeof (l->l_addr->u_pcb.pcb_fp)); + (void)memcpy(&pcb->pcb_fp, &mcp->__fpregs, + sizeof (pcb->pcb_fp)); l->l_md.md_flags = mcp->__fpregs.__fp_fpcr & MDP_FP_C; l->l_md.md_flags |= MDP_FPUSED; } diff --git a/sys/arch/alpha/alpha/osf1_syscall.c b/sys/arch/alpha/alpha/osf1_syscall.c index 519b2af6b959..21e192f53a5e 100644 --- a/sys/arch/alpha/alpha/osf1_syscall.c +++ b/sys/arch/alpha/alpha/osf1_syscall.c @@ -1,4 +1,4 @@ -/* $NetBSD: osf1_syscall.c,v 1.31 2008/10/21 12:16:58 ad Exp $ */ +/* $NetBSD: osf1_syscall.c,v 1.32 2009/11/21 05:35:40 rmind Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -89,12 +89,11 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: osf1_syscall.c,v 1.31 2008/10/21 12:16:58 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: osf1_syscall.c,v 1.32 2009/11/21 05:35:40 rmind Exp $"); #include #include #include -#include #include #include #include diff --git a/sys/arch/alpha/alpha/pmap.c b/sys/arch/alpha/alpha/pmap.c index 2322b3138095..c7386dc75a35 100644 --- a/sys/arch/alpha/alpha/pmap.c +++ b/sys/arch/alpha/alpha/pmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.250 2009/11/09 04:31:03 mhitch Exp $ */ +/* $NetBSD: pmap.c,v 1.251 2009/11/21 05:35:40 rmind Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008 The NetBSD Foundation, Inc. @@ -140,7 +140,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.250 2009/11/09 04:31:03 mhitch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.251 2009/11/21 05:35:40 rmind Exp $"); #include #include @@ -148,7 +148,6 @@ __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.250 2009/11/09 04:31:03 mhitch Exp $"); #include #include #include -#include #include #include #include @@ -584,12 +583,12 @@ do { \ */ #define PMAP_ACTIVATE(pmap, l, cpu_id) \ do { \ + struct pcb *pcb = lwp_getpcb(l); \ PMAP_ACTIVATE_ASN_SANITY(pmap, cpu_id); \ \ - (l)->l_addr->u_pcb.pcb_hw.apcb_ptbr = \ + pcb->pcb_hw.apcb_ptbr = \ ALPHA_K0SEG_TO_PHYS((vaddr_t)(pmap)->pm_lev1map) >> PGSHIFT; \ - (l)->l_addr->u_pcb.pcb_hw.apcb_asn = \ - (pmap)->pm_asni[(cpu_id)].pma_asn; \ + pcb->pcb_hw.apcb_asn = (pmap)->pm_asni[(cpu_id)].pma_asn; \ \ if ((l) == curlwp) { \ /* \ @@ -749,6 +748,7 @@ pmap_bootstrap(paddr_t ptaddr, u_int maxasn, u_long ncpuids) pt_entry_t *lev2map, *lev3map; pt_entry_t pte; vsize_t bufsz; + struct pcb *pcb; int i; #ifdef DEBUG @@ -949,10 +949,10 @@ pmap_bootstrap(paddr_t ptaddr, u_int maxasn, u_long ncpuids) * Set up proc0's PCB such that the ptbr points to the right place * and has the kernel pmap's (really unused) ASN. */ - lwp0.l_addr->u_pcb.pcb_hw.apcb_ptbr = + pcb = lwp_getpcb(&lwp0); + pcb->pcb_hw.apcb_ptbr = ALPHA_K0SEG_TO_PHYS((vaddr_t)kernel_lev1map) >> PGSHIFT; - lwp0.l_addr->u_pcb.pcb_hw.apcb_asn = - pmap_kernel()->pm_asni[cpu_number()].pma_asn; + pcb->pcb_hw.apcb_asn = pmap_kernel()->pm_asni[cpu_number()].pma_asn; /* * Mark the kernel pmap `active' on this processor. diff --git a/sys/arch/alpha/alpha/process_machdep.c b/sys/arch/alpha/alpha/process_machdep.c index 57b16509b757..7945e13ce8ec 100644 --- a/sys/arch/alpha/alpha/process_machdep.c +++ b/sys/arch/alpha/alpha/process_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: process_machdep.c,v 1.24 2007/03/04 05:59:10 christos Exp $ */ +/* $NetBSD: process_machdep.c,v 1.25 2009/11/21 05:35:40 rmind Exp $ */ /* * Copyright (c) 1994 Christopher G. Demetriou @@ -54,13 +54,12 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.24 2007/03/04 05:59:10 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.25 2009/11/21 05:35:40 rmind Exp $"); #include #include #include #include -#include #include #include @@ -70,26 +69,26 @@ __KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.24 2007/03/04 05:59:10 christo #include #define lwp_frame(l) ((l)->l_md.md_tf) -#define lwp_pcb(l) (&(l)->l_addr->u_pcb) -#define lwp_fpframe(l) (&(lwp_pcb(l)->pcb_fp)) int process_read_regs(struct lwp *l, struct reg *regs) { + struct pcb *pcb = lwp_getpcb(l); frametoreg(lwp_frame(l), regs); regs->r_regs[R_ZERO] = lwp_frame(l)->tf_regs[FRAME_PC]; - regs->r_regs[R_SP] = lwp_pcb(l)->pcb_hw.apcb_usp; + regs->r_regs[R_SP] = pcb->pcb_hw.apcb_usp; return (0); } int process_write_regs(struct lwp *l, const struct reg *regs) { + struct pcb *pcb = lwp_getpcb(l); regtoframe(regs, lwp_frame(l)); lwp_frame(l)->tf_regs[FRAME_PC] = regs->r_regs[R_ZERO]; - lwp_pcb(l)->pcb_hw.apcb_usp = regs->r_regs[R_SP]; + pcb->pcb_hw.apcb_usp = regs->r_regs[R_SP]; return (0); } @@ -115,21 +114,23 @@ process_set_pc(struct lwp *l, void *addr) int process_read_fpregs(struct lwp *l, struct fpreg *regs) { + struct pcb *pcb = lwp_getpcb(l); - if (l->l_addr->u_pcb.pcb_fpcpu != NULL) + if (pcb->pcb_fpcpu != NULL) fpusave_proc(l, 1); - memcpy(regs, lwp_fpframe(l), sizeof(struct fpreg)); + memcpy(regs, &pcb->pcb_fp, sizeof(struct fpreg)); return (0); } int process_write_fpregs(struct lwp *l, const struct fpreg *regs) { + struct pcb *pcb = lwp_getpcb(l); - if (l->l_addr->u_pcb.pcb_fpcpu != NULL) + if (pcb->pcb_fpcpu != NULL) fpusave_proc(l, 0); - memcpy(lwp_fpframe(l), regs, sizeof(struct fpreg)); + memcpy(&pcb->pcb_fp, regs, sizeof(struct fpreg)); return (0); } diff --git a/sys/arch/alpha/alpha/prom.c b/sys/arch/alpha/alpha/prom.c index 717547dbd945..801899fde377 100644 --- a/sys/arch/alpha/alpha/prom.c +++ b/sys/arch/alpha/alpha/prom.c @@ -1,4 +1,4 @@ -/* $NetBSD: prom.c,v 1.45 2008/01/05 00:31:50 ad Exp $ */ +/* $NetBSD: prom.c,v 1.46 2009/11/21 05:35:40 rmind Exp $ */ /* * Copyright (c) 1992, 1994, 1995, 1996 Carnegie Mellon University @@ -27,7 +27,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.45 2008/01/05 00:31:50 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.46 2009/11/21 05:35:40 rmind Exp $"); #include "opt_multiprocessor.h" @@ -35,7 +35,6 @@ __KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.45 2008/01/05 00:31:50 ad Exp $"); #include #include #include -#include #include #include @@ -302,13 +301,14 @@ hwrpb_checksum(void) void hwrpb_primary_init(void) { + struct pcb *pcb; struct pcs *p; p = LOCATE_PCS(hwrpb, hwrpb->rpb_primary_cpu_id); /* Initialize the primary's HWPCB and the Virtual Page Table Base. */ - memcpy(p->pcs_hwpcb, &lwp0.l_addr->u_pcb.pcb_hw, - sizeof lwp0.l_addr->u_pcb.pcb_hw); + pcb = lwp_getpcb(&lwp0); + memcpy(p->pcs_hwpcb, &pcb->pcb_hw, sizeof(pcb->pcb_hw)); hwrpb->rpb_vptb = VPTBASE; hwrpb->rpb_checksum = hwrpb_checksum(); diff --git a/sys/arch/alpha/alpha/promcons.c b/sys/arch/alpha/alpha/promcons.c index 5f811277f429..fcadb5a351bc 100644 --- a/sys/arch/alpha/alpha/promcons.c +++ b/sys/arch/alpha/alpha/promcons.c @@ -1,4 +1,4 @@ -/* $NetBSD: promcons.c,v 1.34 2007/11/19 18:51:36 ad Exp $ */ +/* $NetBSD: promcons.c,v 1.35 2009/11/21 05:35:40 rmind Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -29,7 +29,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: promcons.c,v 1.34 2007/11/19 18:51:36 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: promcons.c,v 1.35 2009/11/21 05:35:40 rmind Exp $"); #include #include @@ -37,7 +37,6 @@ __KERNEL_RCSID(0, "$NetBSD: promcons.c,v 1.34 2007/11/19 18:51:36 ad Exp $"); #include #include #include -#include #include #include #include diff --git a/sys/arch/alpha/alpha/syscall.c b/sys/arch/alpha/alpha/syscall.c index dc7ff1826f1c..5d2d39fd4718 100644 --- a/sys/arch/alpha/alpha/syscall.c +++ b/sys/arch/alpha/alpha/syscall.c @@ -1,4 +1,4 @@ -/* $NetBSD: syscall.c,v 1.34 2008/10/21 12:16:58 ad Exp $ */ +/* $NetBSD: syscall.c,v 1.35 2009/11/21 05:35:41 rmind Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -89,7 +89,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.34 2008/10/21 12:16:58 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.35 2009/11/21 05:35:41 rmind Exp $"); #include "opt_sa.h" @@ -98,7 +98,6 @@ __KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.34 2008/10/21 12:16:58 ad Exp $"); #include #include #include -#include #include #include #include diff --git a/sys/arch/alpha/alpha/trap.c b/sys/arch/alpha/alpha/trap.c index 6c6fa2dedca2..8cca0ce3eda6 100644 --- a/sys/arch/alpha/alpha/trap.c +++ b/sys/arch/alpha/alpha/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.120 2008/10/15 06:51:17 wrstuden Exp $ */ +/* $NetBSD: trap.c,v 1.121 2009/11/21 05:35:41 rmind Exp $ */ /*- * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. @@ -93,14 +93,13 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.120 2008/10/15 06:51:17 wrstuden Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.121 2009/11/21 05:35:41 rmind Exp $"); #include #include #include #include #include -#include #include #include #include @@ -396,6 +395,7 @@ trap(const u_long a0, const u_long a1, const u_long a2, const u_long entry, vaddr_t va; struct vmspace *vm = NULL; struct vm_map *map; + struct pcb *pcb; int rv; switch (a2) { @@ -442,12 +442,12 @@ trap(const u_long a0, const u_long a1, const u_long a2, const u_long entry, * [fs]uswintr, in case another fault happens * when they are running. */ - if (l->l_addr->u_pcb.pcb_onfault == - (unsigned long)fswintrberr && - l->l_addr->u_pcb.pcb_accessaddr == a0) { + pcb = lwp_getpcb(l); + if (pcb->pcb_onfault == (u_long)fswintrberr && + pcb->pcb_accessaddr == a0) { framep->tf_regs[FRAME_PC] = - l->l_addr->u_pcb.pcb_onfault; - l->l_addr->u_pcb.pcb_onfault = 0; + pcb->pcb_onfault; + pcb->pcb_onfault = 0; goto out; } @@ -468,8 +468,9 @@ trap(const u_long a0, const u_long a1, const u_long a2, const u_long entry, * argument space is lazy-allocated. */ do_fault: + pcb = lwp_getpcb(l); if (user == 0 && (a0 >= VM_MIN_KERNEL_ADDRESS || - l->l_addr->u_pcb.pcb_onfault == 0)) + pcb->pcb_onfault == 0)) map = kernel_map; else { vm = l->l_proc->p_vmspace; @@ -503,12 +504,15 @@ do_fault: if (user == 0) { /* Check for copyin/copyout fault */ - if (l != NULL && - l->l_addr->u_pcb.pcb_onfault != 0) { + if (l == NULL) { + goto dopanic; + } + pcb = lwp_getpcb(l); + if (pcb->pcb_onfault != 0) { framep->tf_regs[FRAME_PC] = - l->l_addr->u_pcb.pcb_onfault; + pcb->pcb_onfault; framep->tf_regs[FRAME_V0] = rv; - l->l_addr->u_pcb.pcb_onfault = 0; + pcb->pcb_onfault = 0; goto out; } goto dopanic; @@ -581,6 +585,7 @@ alpha_enable_fp(struct lwp *l, int check) int s; #endif struct cpu_info *ci = curcpu(); + struct pcb *pcb; if (check && ci->ci_fpcurlwp == l) { alpha_pal_wrfen(1); @@ -594,22 +599,23 @@ alpha_enable_fp(struct lwp *l, int check) KDASSERT(ci->ci_fpcurlwp == NULL); + pcb = lwp_getpcb(l); #if defined(MULTIPROCESSOR) - if (l->l_addr->u_pcb.pcb_fpcpu != NULL) + if (pcb->pcb_fpcpu != NULL) fpusave_proc(l, 1); #else - KDASSERT(l->l_addr->u_pcb.pcb_fpcpu == NULL); + KDASSERT(pcb->pcb_fpcpu == NULL); #endif #if defined(MULTIPROCESSOR) s = splhigh(); /* block IPIs */ #endif - FPCPU_LOCK(&l->l_addr->u_pcb); + FPCPU_LOCK(pcb); - l->l_addr->u_pcb.pcb_fpcpu = ci; + pcb->pcb_fpcpu = ci; ci->ci_fpcurlwp = l; - FPCPU_UNLOCK(&l->l_addr->u_pcb); + FPCPU_UNLOCK(pcb); #if defined(MULTIPROCESSOR) splx(s); #endif @@ -629,7 +635,7 @@ alpha_enable_fp(struct lwp *l, int check) atomic_inc_ulong(&fpevent_reuse.ev_count); alpha_pal_wrfen(1); - restorefpstate(&l->l_addr->u_pcb.pcb_fp); + restorefpstate(&pcb->pcb_fp); } /* @@ -690,10 +696,10 @@ static const int reg_to_framereg[32] = { &(l)->l_md.md_tf->tf_regs[reg_to_framereg[(reg)]]) #define frp(l, reg) \ - (&(l)->l_addr->u_pcb.pcb_fp.fpr_regs[(reg)]) + (&pcb->pcb_fp.fpr_regs[(reg)]) -#define dump_fp_regs() \ - if (l->l_addr->u_pcb.pcb_fpcpu != NULL) \ +#define dump_fp_regs(pcb) \ + if (pcb->pcb_fpcpu != NULL) \ fpusave_proc(l, 1) #define unaligned_load(storage, ptrf, mod) \ @@ -718,13 +724,17 @@ static const int reg_to_framereg[32] = { #define unaligned_store_integer(storage) \ unaligned_store(storage, irp, ) -#define unaligned_load_floating(storage, mod) \ - dump_fp_regs(); \ - unaligned_load(storage, frp, mod) +#define unaligned_load_floating(storage, mod) do { \ + struct pcb *pcb = lwp_getpcb(l); \ + dump_fp_regs(pcb); \ + unaligned_load(storage, frp, mod) \ +} while (/*CONSTCOND*/0) -#define unaligned_store_floating(storage, mod) \ - dump_fp_regs(); \ - unaligned_store(storage, frp, mod) +#define unaligned_store_floating(storage, mod) do { \ + struct pcb *pcb = lwp_getpcb(l); \ + dump_fp_regs(pcb); \ + unaligned_store(storage, frp, mod) \ +} while (/*CONSTCOND*/0) static unsigned long Sfloat_to_reg(u_int s) diff --git a/sys/arch/alpha/alpha/vm_machdep.c b/sys/arch/alpha/alpha/vm_machdep.c index 9d76a03cdb4e..e87db5cc6e41 100644 --- a/sys/arch/alpha/alpha/vm_machdep.c +++ b/sys/arch/alpha/alpha/vm_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.101 2009/10/21 21:11:58 rmind Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.102 2009/11/21 05:35:41 rmind Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -29,7 +29,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.101 2009/10/21 21:11:58 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.102 2009/11/21 05:35:41 rmind Exp $"); #include #include @@ -37,7 +37,6 @@ __KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.101 2009/10/21 21:11:58 rmind Exp $ #include #include #include -#include #include #include @@ -51,8 +50,9 @@ __KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.101 2009/10/21 21:11:58 rmind Exp $ void cpu_lwp_free(struct lwp *l, int proc) { + struct pcb *pcb = lwp_getpcb(l); - if (l->l_addr->u_pcb.pcb_fpcpu != NULL) + if (pcb->pcb_fpcpu != NULL) fpusave_proc(l, 0); } @@ -84,9 +84,12 @@ void cpu_lwp_fork(struct lwp *l1, struct lwp *l2, void *stack, size_t stacksize, void (*func)(void *), void *arg) { - struct user *up = l2->l_addr; + struct pcb *pcb1, *pcb2; extern void lwp_trampoline(void); + pcb1 = lwp_getpcb(l1); + pcb2 = lwp_getpcb(l2); + l2->l_md.md_tf = l1->l_md.md_tf; l2->l_md.md_flags = l1->l_md.md_flags & (MDP_FPUSED | MDP_FP_C); l2->l_md.md_astpending = 0; @@ -95,25 +98,25 @@ cpu_lwp_fork(struct lwp *l1, struct lwp *l2, void *stack, size_t stacksize, * Cache the physical address of the pcb, so we can * swap to it easily. */ - l2->l_md.md_pcbpaddr = (void *)vtophys((vaddr_t)&up->u_pcb); + l2->l_md.md_pcbpaddr = (void *)vtophys((vaddr_t)pcb2); /* * Copy floating point state from the FP chip to the PCB * if this process has state stored there. */ - if (l1->l_addr->u_pcb.pcb_fpcpu != NULL) + if (pcb1->pcb_fpcpu != NULL) fpusave_proc(l1, 1); /* * Copy pcb and user stack pointer from proc p1 to p2. * If specificed, give the child a different stack. */ - l2->l_addr->u_pcb = l1->l_addr->u_pcb; + *pcb2 = *pcb1; if (stack != NULL) - l2->l_addr->u_pcb.pcb_hw.apcb_usp = (u_long)stack + stacksize; + pcb2->pcb_hw.apcb_usp = (u_long)stack + stacksize; else - l2->l_addr->u_pcb.pcb_hw.apcb_usp = alpha_pal_rdusp(); - simple_lock_init(&l2->l_addr->u_pcb.pcb_fpcpu_slock); + pcb2->pcb_hw.apcb_usp = alpha_pal_rdusp(); + simple_lock_init(&pcb2->pcb_fpcpu_slock); /* * Arrange for a non-local goto when the new process @@ -151,39 +154,38 @@ cpu_lwp_fork(struct lwp *l1, struct lwp *l2, void *stack, size_t stacksize, l2tf->tf_regs[FRAME_A3] = 0; /* no error */ l2tf->tf_regs[FRAME_A4] = 1; /* is child */ - up = l2->l_addr; - up->u_pcb.pcb_hw.apcb_ksp = - (u_int64_t)l2->l_md.md_tf; - up->u_pcb.pcb_context[0] = - (u_int64_t)func; /* s0: pc */ - up->u_pcb.pcb_context[1] = - (u_int64_t)exception_return; /* s1: ra */ - up->u_pcb.pcb_context[2] = - (u_int64_t)arg; /* s2: arg */ - up->u_pcb.pcb_context[3] = - (u_int64_t)l2; /* s3: lwp */ - up->u_pcb.pcb_context[7] = - (u_int64_t)lwp_trampoline; /* ra: assembly magic */ + pcb2->pcb_hw.apcb_ksp = + (uint64_t)l2->l_md.md_tf; + pcb2->pcb_context[0] = + (uint64_t)func; /* s0: pc */ + pcb2->pcb_context[1] = + (uint64_t)exception_return; /* s1: ra */ + pcb2->pcb_context[2] = + (uint64_t)arg; /* s2: arg */ + pcb2->pcb_context[3] = + (uint64_t)l2; /* s3: lwp */ + pcb2->pcb_context[7] = + (uint64_t)lwp_trampoline; /* ra: assembly magic */ } } void cpu_setfunc(struct lwp *l, void (*func)(void *), void *arg) { - struct user *up = l->l_addr; + struct pcb *pcb = lwp_getpcb(l); extern void setfunc_trampoline(void); - up->u_pcb.pcb_hw.apcb_ksp = - (u_int64_t)l->l_md.md_tf; - up->u_pcb.pcb_context[0] = - (u_int64_t)func; /* s0: pc */ - up->u_pcb.pcb_context[1] = - (u_int64_t)exception_return; /* s1: ra */ - up->u_pcb.pcb_context[2] = - (u_int64_t)arg; /* s2: arg */ - up->u_pcb.pcb_context[7] = - (u_int64_t)setfunc_trampoline; /* ra: assembly magic */ -} + pcb->pcb_hw.apcb_ksp = + (uint64_t)l->l_md.md_tf; + pcb->pcb_context[0] = + (uint64_t)func; /* s0: pc */ + pcb->pcb_context[1] = + (uint64_t)exception_return; /* s1: ra */ + pcb->pcb_context[2] = + (uint64_t)arg; /* s2: arg */ + pcb->pcb_context[7] = + (uint64_t)setfunc_trampoline; /* ra: assembly magic */ +} /* * Map a user I/O request into kernel virtual address space. diff --git a/sys/arch/alpha/include/proc.h b/sys/arch/alpha/include/proc.h index b6ead9413488..1cb4fc2ac5b3 100644 --- a/sys/arch/alpha/include/proc.h +++ b/sys/arch/alpha/include/proc.h @@ -1,4 +1,4 @@ -/* $NetBSD: proc.h,v 1.17 2007/02/09 21:55:01 ad Exp $ */ +/* $NetBSD: proc.h,v 1.18 2009/11/21 05:35:41 rmind Exp $ */ /* * Copyright (c) 1994, 1995 Carnegie-Mellon University. @@ -30,6 +30,7 @@ #ifndef _ALPHA_PROC_H #define _ALPHA_PROC_H +#include /* for sizeof(struct user) */ #include /* diff --git a/sys/arch/alpha/jensenio/com_jensenio.c b/sys/arch/alpha/jensenio/com_jensenio.c index 6fc2feb31714..461cc81f9ec9 100644 --- a/sys/arch/alpha/jensenio/com_jensenio.c +++ b/sys/arch/alpha/jensenio/com_jensenio.c @@ -1,4 +1,4 @@ -/* $NetBSD: com_jensenio.c,v 1.10 2008/04/28 20:23:11 martin Exp $ */ +/* $NetBSD: com_jensenio.c,v 1.11 2009/11/21 05:35:41 rmind Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: com_jensenio.c,v 1.10 2008/04/28 20:23:11 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: com_jensenio.c,v 1.11 2009/11/21 05:35:41 rmind Exp $"); #include #include @@ -39,7 +39,6 @@ __KERNEL_RCSID(0, "$NetBSD: com_jensenio.c,v 1.10 2008/04/28 20:23:11 martin Exp #include #include #include -#include #include #include #include diff --git a/sys/arch/alpha/jensenio/lpt_jensenio.c b/sys/arch/alpha/jensenio/lpt_jensenio.c index f1ab992cb755..c42783f3686d 100644 --- a/sys/arch/alpha/jensenio/lpt_jensenio.c +++ b/sys/arch/alpha/jensenio/lpt_jensenio.c @@ -1,4 +1,4 @@ -/* $NetBSD: lpt_jensenio.c,v 1.9 2008/04/28 20:23:11 martin Exp $ */ +/* $NetBSD: lpt_jensenio.c,v 1.10 2009/11/21 05:35:41 rmind Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: lpt_jensenio.c,v 1.9 2008/04/28 20:23:11 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lpt_jensenio.c,v 1.10 2009/11/21 05:35:41 rmind Exp $"); #include #include @@ -39,7 +39,6 @@ __KERNEL_RCSID(0, "$NetBSD: lpt_jensenio.c,v 1.9 2008/04/28 20:23:11 martin Exp #include #include #include -#include #include #include #include diff --git a/sys/arch/alpha/sableio/com_sableio.c b/sys/arch/alpha/sableio/com_sableio.c index 72060d78da7b..35da27a5516f 100644 --- a/sys/arch/alpha/sableio/com_sableio.c +++ b/sys/arch/alpha/sableio/com_sableio.c @@ -1,4 +1,4 @@ -/* $NetBSD: com_sableio.c,v 1.8 2008/04/28 20:23:12 martin Exp $ */ +/* $NetBSD: com_sableio.c,v 1.9 2009/11/21 05:35:41 rmind Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: com_sableio.c,v 1.8 2008/04/28 20:23:12 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: com_sableio.c,v 1.9 2009/11/21 05:35:41 rmind Exp $"); #include #include @@ -39,7 +39,6 @@ __KERNEL_RCSID(0, "$NetBSD: com_sableio.c,v 1.8 2008/04/28 20:23:12 martin Exp $ #include #include #include -#include #include #include #include diff --git a/sys/arch/alpha/sableio/lpt_sableio.c b/sys/arch/alpha/sableio/lpt_sableio.c index 034b0c815c07..e44c85945499 100644 --- a/sys/arch/alpha/sableio/lpt_sableio.c +++ b/sys/arch/alpha/sableio/lpt_sableio.c @@ -1,4 +1,4 @@ -/* $NetBSD: lpt_sableio.c,v 1.6 2008/04/28 20:23:12 martin Exp $ */ +/* $NetBSD: lpt_sableio.c,v 1.7 2009/11/21 05:35:41 rmind Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: lpt_sableio.c,v 1.6 2008/04/28 20:23:12 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lpt_sableio.c,v 1.7 2009/11/21 05:35:41 rmind Exp $"); #include #include @@ -39,7 +39,6 @@ __KERNEL_RCSID(0, "$NetBSD: lpt_sableio.c,v 1.6 2008/04/28 20:23:12 martin Exp $ #include #include #include -#include #include #include #include