Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Reduce code duplication by adding mi_userret() in sys/us...
details: https://anonhg.NetBSD.org/src/rev/ecb9a4744864
branches: trunk
changeset: 554671:ecb9a4744864
user: cl <cl%NetBSD.org@localhost>
date: Fri Oct 31 16:44:34 2003 +0000
description:
Reduce code duplication by adding mi_userret() in sys/userret.h
containing signal posting, kernel-exit handling and sa_upcall processing.
XXX the pc532, sparc, sparc64 and vax ports should have their
XXX userret() code rearranged to use this.
diffstat:
sys/arch/alpha/include/userret.h | 18 +----
sys/arch/amd64/include/userret.h | 16 +----
sys/arch/amiga/amiga/trap.c | 19 +-----
sys/arch/arm/arm/ast.c | 21 ++-----
sys/arch/arm/arm/undefined.c | 20 +-----
sys/arch/atari/atari/trap.c | 19 +-----
sys/arch/cesfic/cesfic/trap.c | 17 +----
sys/arch/hp300/hp300/trap.c | 18 +----
sys/arch/i386/include/userret.h | 20 +-----
sys/arch/luna68k/luna68k/trap.c | 19 +-----
sys/arch/mac68k/mac68k/trap.c | 18 +----
sys/arch/mips/include/userret.h | 19 +-----
sys/arch/mvme68k/mvme68k/trap.c | 18 +----
sys/arch/news68k/news68k/trap.c | 18 +----
sys/arch/next68k/next68k/trap.c | 18 +----
sys/arch/powerpc/ibm4xx/trap.c | 36 ++----------
sys/arch/powerpc/include/userret.h | 19 +-----
sys/arch/sh3/include/userret.h | 19 +-----
sys/arch/sh5/sh5/trap.c | 19 +-----
sys/arch/sun2/sun2/trap.c | 19 +-----
sys/arch/sun3/sun3/trap.c | 19 +-----
sys/arch/x68k/x68k/trap.c | 18 +----
sys/sys/userret.h | 100 +++++++++++++++++++++++++++++++++++++
23 files changed, 213 insertions(+), 314 deletions(-)
diffs (truncated from 1129 to 300 lines):
diff -r 04cd7eb074c6 -r ecb9a4744864 sys/arch/alpha/include/userret.h
--- a/sys/arch/alpha/include/userret.h Fri Oct 31 16:32:36 2003 +0000
+++ b/sys/arch/alpha/include/userret.h Fri Oct 31 16:44:34 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: userret.h,v 1.2 2003/01/17 22:11:17 thorpej Exp $ */
+/* $NetBSD: userret.h,v 1.3 2003/10/31 16:44:34 cl Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -97,6 +97,8 @@
#ifndef _ALPHA_USERRET_H_
#define _ALPHA_USERRET_H_
+#include <sys/userret.h>
+
/*
* Define the code needed before returning to user mode, for
* trap and syscall.
@@ -104,23 +106,13 @@
static __inline void
userret(struct lwp *l)
{
- int sig;
struct proc *p = l->l_proc;
/* Do any deferred user pmap operations. */
PMAP_USERRET(vm_map_pmap(&p->p_vmspace->vm_map));
- /* take pending signals */
- while ((sig = CURSIG(l)) != 0)
- postsig(sig);
-
- /* Invoke per-process kernel-exit handling, if any */
- if (p->p_userret)
- (p->p_userret)(l, p->p_userret_arg);
-
- /* Invoke any pending upcalls. */
- while (l->l_flag & L_SA_UPCALL)
- sa_upcall_userret(l);
+ /* Invoke MI userret code */
+ mi_userret(l);
curcpu()->ci_schedstate.spc_curpriority = l->l_priority = l->l_usrpri;
}
diff -r 04cd7eb074c6 -r ecb9a4744864 sys/arch/amd64/include/userret.h
--- a/sys/arch/amd64/include/userret.h Fri Oct 31 16:32:36 2003 +0000
+++ b/sys/arch/amd64/include/userret.h Fri Oct 31 16:44:34 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: userret.h,v 1.2 2003/08/07 16:26:36 agc Exp $ */
+/* $NetBSD: userret.h,v 1.3 2003/10/31 16:44:34 cl Exp $ */
/*
* XXXfvdl same as i386 counterpart, but should probably be independent.
@@ -73,6 +73,8 @@
*
*/
+#include <sys/userret.h>
+
static __inline void userret __P((register struct lwp *));
/*
@@ -83,17 +85,9 @@
userret(l)
register struct lwp *l;
{
- int sig;
- struct proc *p = l->l_proc;
- while ((sig = CURSIG(l)) != 0)
- postsig(sig);
-
- if (p->p_userret)
- (p->p_userret)(l, p->p_userret_arg);
-
- while (l->l_flag & L_SA_UPCALL)
- sa_upcall_userret(l);
+ /* Invoke MI userret code */
+ mi_userret(l);
curcpu()->ci_schedstate.spc_curpriority = l->l_priority = l->l_usrpri;
}
diff -r 04cd7eb074c6 -r ecb9a4744864 sys/arch/amiga/amiga/trap.c
--- a/sys/arch/amiga/amiga/trap.c Fri Oct 31 16:32:36 2003 +0000
+++ b/sys/arch/amiga/amiga/trap.c Fri Oct 31 16:44:34 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.97 2003/10/21 00:49:34 fvdl Exp $ */
+/* $NetBSD: trap.c,v 1.98 2003/10/31 16:44:34 cl Exp $ */
/*
* Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -83,7 +83,7 @@
#include "opt_fpu_emulate.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.97 2003/10/21 00:49:34 fvdl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.98 2003/10/31 16:44:34 cl Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -96,8 +96,8 @@
#include <sys/syscall.h>
#include <sys/sa.h>
#include <sys/savar.h>
-
#include <sys/user.h>
+#include <sys/userret.h>
#include <uvm/uvm_extern.h>
@@ -242,18 +242,9 @@
u_quad_t oticks;
{
struct proc *p = l->l_proc;
- int sig;
- while ((sig = CURSIG(l)) != 0)
- postsig(sig);
-
- /* Invoke per-process kernel-exit handling, if any */
- if (p->p_userret)
- (p->p_userret)(l, p->p_userret_arg);
-
- /* Invoke any pending upcalls. */
- if (l->l_flag & L_SA_UPCALL)
- sa_upcall_userret(l);
+ /* Invoke MI userret code */
+ mi_userret(l);
/*
* If profiling, charge recent system time.
diff -r 04cd7eb074c6 -r ecb9a4744864 sys/arch/arm/arm/ast.c
--- a/sys/arch/arm/arm/ast.c Fri Oct 31 16:32:36 2003 +0000
+++ b/sys/arch/arm/arm/ast.c Fri Oct 31 16:44:34 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ast.c,v 1.5 2003/07/15 00:24:37 lukem Exp $ */
+/* $NetBSD: ast.c,v 1.6 2003/10/31 16:44:34 cl Exp $ */
/*
* Copyright (c) 1994,1995 Mark Brinicombe
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ast.c,v 1.5 2003/07/15 00:24:37 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ast.c,v 1.6 2003/10/31 16:44:34 cl Exp $");
#include "opt_ddb.h"
@@ -54,6 +54,8 @@
#include <sys/signal.h>
#include <sys/savar.h>
#include <sys/vmmeter.h>
+#include <sys/userret.h>
+
#include <machine/cpu.h>
#include <machine/frame.h>
#include <machine/cpu.h>
@@ -77,20 +79,9 @@
void
userret(struct lwp *l)
{
- struct proc *p = l->l_proc;
- int sig;
- /* Take pending signals. */
- while ((sig = (CURSIG(l))) != 0)
- postsig(sig);
-
- /* Invoke per-process kernel-exit handling, if any */
- if (p->p_userret)
- (p->p_userret)(l, p->p_userret_arg);
-
- /* Invoke any pending upcalls. */
- while (l->l_flag & L_SA_UPCALL)
- sa_upcall_userret(l);
+ /* Invoke MI userret code */
+ mi_userret(l);
curcpu()->ci_schedstate.spc_curpriority = l->l_priority = l->l_usrpri;
}
diff -r 04cd7eb074c6 -r ecb9a4744864 sys/arch/arm/arm/undefined.c
--- a/sys/arch/arm/arm/undefined.c Fri Oct 31 16:32:36 2003 +0000
+++ b/sys/arch/arm/arm/undefined.c Fri Oct 31 16:44:34 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: undefined.c,v 1.19 2003/10/08 00:28:41 thorpej Exp $ */
+/* $NetBSD: undefined.c,v 1.20 2003/10/31 16:44:35 cl Exp $ */
/*
* Copyright (c) 2001 Ben Harris.
@@ -54,7 +54,7 @@
#include <sys/kgdb.h>
#endif
-__KERNEL_RCSID(0, "$NetBSD: undefined.c,v 1.19 2003/10/08 00:28:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: undefined.c,v 1.20 2003/10/31 16:44:35 cl Exp $");
#include <sys/malloc.h>
#include <sys/queue.h>
@@ -68,6 +68,7 @@
#ifdef FAST_FPE
#include <sys/acct.h>
#endif
+#include <sys/userret.h>
#include <uvm/uvm_extern.h>
@@ -298,7 +299,6 @@
#ifdef FAST_FPE
/* Optimised exit code */
{
- int sig;
/*
* Check for reschedule request, at the moment there is only
@@ -312,18 +312,8 @@
preempt(0);
}
- /* take pending signals */
- while ((sig = (CURSIG(l))) != 0) {
- postsig(sig);
- }
-
- /* Invoke per-process kernel-exit handling, if any */
- if (p->p_userret)
- (p->p_userret)(l, p->p_userret_arg);
-
- /* Invoke any pending upcalls. */
- while (l->l_flag & L_SA_UPCALL)
- sa_upcall_userret(l);
+ /* Invoke MI userret code */
+ mi_userret(l);
l->l_priority = l->l_usrpri;
diff -r 04cd7eb074c6 -r ecb9a4744864 sys/arch/atari/atari/trap.c
--- a/sys/arch/atari/atari/trap.c Fri Oct 31 16:32:36 2003 +0000
+++ b/sys/arch/atari/atari/trap.c Fri Oct 31 16:44:34 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.72 2003/10/08 00:28:41 thorpej Exp $ */
+/* $NetBSD: trap.c,v 1.73 2003/10/31 16:44:35 cl Exp $ */
/*
* Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.72 2003/10/08 00:28:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.73 2003/10/31 16:44:35 cl Exp $");
#include "opt_ddb.h"
#include "opt_execfmt.h"
@@ -96,8 +96,8 @@
#include <sys/syscall.h>
#include <sys/sa.h>
#include <sys/savar.h>
-
#include <sys/user.h>
+#include <sys/userret.h>
#include <uvm/uvm_extern.h>
@@ -233,17 +233,8 @@
again:
#endif
- /* take pending signals */
- while ((sig = CURSIG(l)) != 0)
- postsig(sig);
-
- /* Invoke per-process kernel-exit handling, if any */
- if (p->p_userret)
- (p->p_userret)(l, p->p_userret_arg);
-
- /* Invoke any pending upcalls. */
- while (l->l_flag & L_SA_UPCALL)
- sa_upcall_userret(l);
+ /* Invoke MI userret code */
+ mi_userret(l);
/*
* If profiling, charge system time to the trapped pc.
diff -r 04cd7eb074c6 -r ecb9a4744864 sys/arch/cesfic/cesfic/trap.c
--- a/sys/arch/cesfic/cesfic/trap.c Fri Oct 31 16:32:36 2003 +0000
+++ b/sys/arch/cesfic/cesfic/trap.c Fri Oct 31 16:44:34 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.15 2003/10/08 00:28:41 thorpej Exp $ */
+/* $NetBSD: trap.c,v 1.16 2003/10/31 16:44:35 cl Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.15 2003/10/08 00:28:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.16 2003/10/31 16:44:35 cl Exp $");
Home |
Main Index |
Thread Index |
Old Index