- 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.
This commit is contained in:
parent
777efd8cdc
commit
1eb36d23fd
@ -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 @@ struct clockframe {
|
||||
|
||||
#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 ? */
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.154 2001/01/11 18:44:29 thorpej Exp $");
|
||||
#include <sys/kgdb.h>
|
||||
#endif
|
||||
|
||||
int astpending;
|
||||
__volatile int astpending;
|
||||
int want_resched;
|
||||
|
||||
const char *trap_type[] = {
|
||||
@ -691,23 +691,34 @@ ast(pc)
|
||||
unsigned pc; /* program counter where to continue */
|
||||
{
|
||||
struct proc *p = curproc;
|
||||
int sig;
|
||||
|
||||
uvmexp.softs++;
|
||||
astpending = 0;
|
||||
while (astpending) {
|
||||
uvmexp.softs++;
|
||||
astpending = 0;
|
||||
|
||||
if (p->p_flag & P_OWEUPC) {
|
||||
p->p_flag &= ~P_OWEUPC;
|
||||
ADDUPROF(p);
|
||||
if (p->p_flag & P_OWEUPC) {
|
||||
p->p_flag &= ~P_OWEUPC;
|
||||
ADDUPROF(p);
|
||||
}
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
if (want_resched) {
|
||||
/*
|
||||
* We are being preempted.
|
||||
*/
|
||||
preempt(NULL);
|
||||
}
|
||||
|
||||
userret(p);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user