Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/mips - Make ast() loop around astpending; it's poss...
details: https://anonhg.NetBSD.org/src/rev/4f334ee8d025
branches: trunk
changeset: 502217:4f334ee8d025
user: thorpej <thorpej%NetBSD.org@localhost>
date: Sun Jan 14 00:10:28 2001 +0000
description:
- Make ast() loop around astpending; it's possible for a new
AST to be posted when delivering signals, or after a process
is preempted.
- Move all signal posting to ast(). userret() is now a one-liner.
diffstat:
sys/arch/mips/include/cpu.h | 6 ++--
sys/arch/mips/include/userret.h | 7 +-----
sys/arch/mips/mips/trap.c | 45 +++++++++++++++++++++++++---------------
3 files changed, 32 insertions(+), 26 deletions(-)
diffs (117 lines):
diff -r 70ecec37b960 -r 4f334ee8d025 sys/arch/mips/include/cpu.h
--- a/sys/arch/mips/include/cpu.h Sat Jan 13 23:49:12 2001 +0000
+++ b/sys/arch/mips/include/cpu.h Sun Jan 14 00:10:28 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.48 2001/01/11 21:08:18 thorpej Exp $ */
+/* $NetBSD: cpu.h,v 1.49 2001/01/14 00:10:28 thorpej Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -183,8 +183,8 @@
#define aston() (astpending = 1)
-extern int astpending; /* need to trap before returning to user mode */
-extern int want_resched; /* resched() was called */
+extern __volatile int astpending; /* AST pending on return to user mode */
+extern int want_resched; /* resched() was called */
#ifdef MIPS3
extern u_int mips_L2CacheSize;
extern int mips_L2CacheIsSnooping; /* L2 cache snoops uncached writes ? */
diff -r 70ecec37b960 -r 4f334ee8d025 sys/arch/mips/include/userret.h
--- a/sys/arch/mips/include/userret.h Sat Jan 13 23:49:12 2001 +0000
+++ b/sys/arch/mips/include/userret.h Sun Jan 14 00:10:28 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: userret.h,v 1.1 2001/01/11 18:44:30 thorpej Exp $ */
+/* $NetBSD: userret.h,v 1.2 2001/01/14 00:10:28 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -48,11 +48,6 @@
static __inline void
userret(struct proc *p)
{
- int sig;
-
- /* take pending signals */
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
curcpu()->ci_schedstate.spc_curpriority = p->p_priority = p->p_usrpri;
}
diff -r 70ecec37b960 -r 4f334ee8d025 sys/arch/mips/mips/trap.c
--- a/sys/arch/mips/mips/trap.c Sat Jan 13 23:49:12 2001 +0000
+++ b/sys/arch/mips/mips/trap.c Sun Jan 14 00:10:28 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.154 2001/01/11 18:44:29 thorpej Exp $ */
+/* $NetBSD: trap.c,v 1.155 2001/01/14 00:10:29 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -44,7 +44,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.154 2001/01/11 18:44:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.155 2001/01/14 00:10:29 thorpej Exp $");
#include "opt_cputype.h" /* which mips CPU levels do we support? */
#include "opt_ktrace.h"
@@ -91,7 +91,7 @@
#include <sys/kgdb.h>
#endif
-int astpending;
+__volatile int astpending;
int want_resched;
const char *trap_type[] = {
@@ -691,23 +691,34 @@
unsigned pc; /* program counter where to continue */
{
struct proc *p = curproc;
-
- uvmexp.softs++;
- astpending = 0;
+ int sig;
- if (p->p_flag & P_OWEUPC) {
- p->p_flag &= ~P_OWEUPC;
- ADDUPROF(p);
- }
+ while (astpending) {
+ uvmexp.softs++;
+ astpending = 0;
+
+ if (p->p_flag & P_OWEUPC) {
+ p->p_flag &= ~P_OWEUPC;
+ ADDUPROF(p);
+ }
- if (want_resched) {
- /*
- * We are being preempted.
- */
- preempt(NULL);
+ /* Take pending signals. */
+ while ((sig = CURSIG(p)) != 0)
+ postsig(sig);
+
+ if (want_resched) {
+ /*
+ * We are being preempted.
+ */
+ preempt(NULL);
+
+ /* Running again; take any new pending signals. */
+ while ((sig = CURSIG(p)) != 0)
+ postsig(sig);
+ }
+
+ userret(p);
}
-
- userret(p);
}
/*
Home |
Main Index |
Thread Index |
Old Index