Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/powerpc Make startlwp and upcallret common instead ...
details: https://anonhg.NetBSD.org/src/rev/35554645864f
branches: trunk
changeset: 766046:35554645864f
user: matt <matt%NetBSD.org@localhost>
date: Tue Jun 14 05:50:24 2011 +0000
description:
Make startlwp and upcallret common instead of having 3 mostly identical copies.
diffstat:
sys/arch/powerpc/booke/trap.c | 28 +--------------------
sys/arch/powerpc/ibm4xx/trap.c | 33 +-----------------------
sys/arch/powerpc/powerpc/powerpc_machdep.c | 39 ++++++++++++++++++++++++++---
sys/arch/powerpc/powerpc/trap.c | 32 +-----------------------
4 files changed, 40 insertions(+), 92 deletions(-)
diffs (247 lines):
diff -r 63618280640a -r 35554645864f sys/arch/powerpc/booke/trap.c
--- a/sys/arch/powerpc/booke/trap.c Tue Jun 14 05:49:14 2011 +0000
+++ b/sys/arch/powerpc/booke/trap.c Tue Jun 14 05:50:24 2011 +0000
@@ -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 <sys/cdefs.h>
-__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 <sys/param.h>
#include <sys/systm.h>
@@ -51,7 +51,6 @@
#include <sys/savar.h>
#endif
#include <sys/kauth.h>
-#include <sys/kmem.h>
#include <sys/ras.h>
#include <uvm/uvm_extern.h>
@@ -897,26 +896,3 @@
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 -r 63618280640a -r 35554645864f sys/arch/powerpc/ibm4xx/trap.c
--- a/sys/arch/powerpc/ibm4xx/trap.c Tue Jun 14 05:49:14 2011 +0000
+++ b/sys/arch/powerpc/ibm4xx/trap.c Tue Jun 14 05:50:24 2011 +0000
@@ -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 <sys/cdefs.h>
-__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 @@
#include <sys/savar.h>
#include <sys/userret.h>
#include <sys/kauth.h>
-#include <sys/kmem.h>
#if defined(KGDB)
#include <sys/kgdb.h>
@@ -707,31 +706,3 @@
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 -r 63618280640a -r 35554645864f sys/arch/powerpc/powerpc/powerpc_machdep.c
--- a/sys/arch/powerpc/powerpc/powerpc_machdep.c Tue Jun 14 05:49:14 2011 +0000
+++ b/sys/arch/powerpc/powerpc/powerpc_machdep.c Tue Jun 14 05:50:24 2011 +0000
@@ -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 <sys/cdefs.h>
-__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 @@
#include <sys/device.h>
#include <sys/pcu.h>
#include <sys/atomic.h>
+#include <sys/kmem.h>
#include <sys/xcall.h>
#include <dev/mm.h>
#include <powerpc/pcb.h>
+#include <powerpc/userret.h>
#include <powerpc/fpu.h>
#if defined(ALTIVEC) || defined(PPC_HAVE_SPE)
#include <powerpc/altivec.h>
@@ -299,6 +301,33 @@
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 @@
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 -r 63618280640a -r 35554645864f sys/arch/powerpc/powerpc/trap.c
--- a/sys/arch/powerpc/powerpc/trap.c Tue Jun 14 05:49:14 2011 +0000
+++ b/sys/arch/powerpc/powerpc/trap.c Tue Jun 14 05:50:24 2011 +0000
@@ -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 <sys/cdefs.h>
-__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 @@
#include <sys/savar.h>
#include <sys/systm.h>
#include <sys/kauth.h>
-#include <sys/kmem.h>
#include <uvm/uvm_extern.h>
@@ -908,30 +907,3 @@
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);
-}
Home |
Main Index |
Thread Index |
Old Index