diff --git a/sys/arch/powerpc/booke/trap.c b/sys/arch/powerpc/booke/trap.c index ed3eb825b524..199af745027c 100644 --- a/sys/arch/powerpc/booke/trap.c +++ b/sys/arch/powerpc/booke/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.9 2011/06/13 21:12:50 matt Exp $ */ +/* $NetBSD: trap.c,v 1.10 2011/06/14 05:50:24 matt Exp $ */ /*- * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -39,7 +39,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.9 2011/06/13 21:12:50 matt Exp $"); +__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.10 2011/06/14 05:50:24 matt Exp $"); #include #include @@ -51,7 +51,6 @@ __KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.9 2011/06/13 21:12:50 matt Exp $"); #include #endif #include -#include #include #include @@ -897,26 +896,3 @@ trap(enum ppc_booke_exceptions trap_code, struct trapframe *tf) userret(l, tf); } } - -void -upcallret(struct lwp *l) -{ - - mi_userret(l); /* Invoke MI userret code */ -} - -/* - * Start a new LWP - */ -void -startlwp(void *arg) -{ - ucontext_t * const uc = arg; - struct lwp * const l = curlwp; - - int error = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags); - KASSERT(error == 0); - (void)error; - kmem_free(uc, sizeof(ucontext_t)); - upcallret(l); -} diff --git a/sys/arch/powerpc/ibm4xx/trap.c b/sys/arch/powerpc/ibm4xx/trap.c index f02941e37ffb..152fda8ac37d 100644 --- a/sys/arch/powerpc/ibm4xx/trap.c +++ b/sys/arch/powerpc/ibm4xx/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.59 2011/06/05 16:52:25 matt Exp $ */ +/* $NetBSD: trap.c,v 1.60 2011/06/14 05:50:24 matt Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.59 2011/06/05 16:52:25 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.60 2011/06/14 05:50:24 matt Exp $"); #include "opt_altivec.h" #include "opt_ddb.h" @@ -82,7 +82,6 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.59 2011/06/05 16:52:25 matt Exp $"); #include #include #include -#include #if defined(KGDB) #include @@ -707,31 +706,3 @@ fix_unaligned(struct lwp *l, struct trapframe *tf) return -1; } - -/* - * Start a new LWP - */ -void -startlwp(void *arg) -{ - ucontext_t *uc = arg; - lwp_t *l = curlwp; - int error; - - error = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags); - KASSERT(error == 0); - - kmem_free(uc, sizeof(ucontext_t)); - upcallret(l); -} - -/* - * XXX This is a terrible name. - */ -void -upcallret(struct lwp *l) -{ - - /* Invoke MI userret code */ - mi_userret(l); -} diff --git a/sys/arch/powerpc/powerpc/powerpc_machdep.c b/sys/arch/powerpc/powerpc/powerpc_machdep.c index c0eac7cd1dae..92a471271cbe 100644 --- a/sys/arch/powerpc/powerpc/powerpc_machdep.c +++ b/sys/arch/powerpc/powerpc/powerpc_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: powerpc_machdep.c,v 1.53 2011/06/14 03:12:43 matt Exp $ */ +/* $NetBSD: powerpc_machdep.c,v 1.54 2011/06/14 05:50:25 matt Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: powerpc_machdep.c,v 1.53 2011/06/14 03:12:43 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: powerpc_machdep.c,v 1.54 2011/06/14 05:50:25 matt Exp $"); #include "opt_altivec.h" #include "opt_modular.h" @@ -55,11 +55,13 @@ __KERNEL_RCSID(0, "$NetBSD: powerpc_machdep.c,v 1.53 2011/06/14 03:12:43 matt Ex #include #include #include +#include #include #include #include +#include #include #if defined(ALTIVEC) || defined(PPC_HAVE_SPE) #include @@ -299,6 +301,33 @@ cpu_dumpconf(void) dumplo = nblks - ctod(dumpsize); } +/* + * Start a new LWP + */ +void +startlwp(void *arg) +{ + ucontext_t * const uc = arg; + lwp_t * const l = curlwp; + struct trapframe * const tf = l->l_md.md_utf; + int error; + + error = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags); + KASSERT(error == 0); + + kmem_free(uc, sizeof(ucontext_t)); + userret(l, tf); +} + +void +upcallret(struct lwp *l) +{ + struct trapframe * const tf = l->l_md.md_utf; + + KERNEL_UNLOCK_LAST(l); + userret(l, tf); +} + void cpu_upcall(struct lwp *l, int type, int nevents, int ninterrupted, void *sas, void *ap, void *sp, sa_upcall_t upcall) @@ -377,9 +406,9 @@ cpu_need_resched(struct cpu_info *ci, int flags) atomic_or_uint(&l->l_dopreempt, DOPREEMPT_ACTIVE); if (ci == cur_ci) { softint_trigger(SOFTINT_KPREEMPT); - } else { - cpu_send_ipi(cpu_index(ci), IPI_KPREEMPT); - } + } else { + cpu_send_ipi(cpu_index(ci), IPI_KPREEMPT); + } return; } #endif diff --git a/sys/arch/powerpc/powerpc/trap.c b/sys/arch/powerpc/powerpc/trap.c index ec4b9e4b002a..2ca5d37de37a 100644 --- a/sys/arch/powerpc/powerpc/trap.c +++ b/sys/arch/powerpc/powerpc/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.141 2011/06/05 16:52:26 matt Exp $ */ +/* $NetBSD: trap.c,v 1.142 2011/06/14 05:50:25 matt Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.141 2011/06/05 16:52:26 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.142 2011/06/14 05:50:25 matt Exp $"); #include "opt_altivec.h" #include "opt_ddb.h" @@ -47,7 +47,6 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.141 2011/06/05 16:52:26 matt Exp $"); #include #include #include -#include #include @@ -908,30 +907,3 @@ copyoutstr(const void *kaddr, void *udaddr, size_t len, size_t *done) curpcb->pcb_onfault = 0; return rv; } - -/* - * Start a new LWP - */ -void -startlwp(void *arg) -{ - ucontext_t * const uc = arg; - lwp_t * const l = curlwp; - struct trapframe * const tf = l->l_md.md_utf; - int error; - - error = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags); - KASSERT(error == 0); - - kmem_free(uc, sizeof(ucontext_t)); - userret(l, tf); -} - -void -upcallret(struct lwp *l) -{ - struct trapframe * const tf = l->l_md.md_utf; - - KERNEL_UNLOCK_LAST(l); - userret(l, tf); -}