Make the astpending flag per-process.

This commit is contained in:
thorpej 2001-01-14 21:18:39 +00:00
parent 139c9e6bf2
commit 53d2115d66
6 changed files with 39 additions and 23 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.49 2001/01/14 00:10:28 thorpej Exp $ */
/* $NetBSD: cpu.h,v 1.50 2001/01/14 21:18:39 thorpej Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -166,24 +166,32 @@ struct clockframe {
* Preempt the current process if in interrupt from user mode,
* or after the current trap/syscall if in system mode.
*/
#define need_resched(ci) { want_resched = 1; aston(); }
#define need_resched(ci) \
do { \
want_resched = 1; \
if (curproc != NULL) \
aston(curproc); \
} while (/*CONSTCOND*/0)
/*
* Give a profiling tick to the current process when the user profiling
* buffer pages are invalid. On the MIPS, request an ast to send us
* through trap, marking the proc as needing a profiling tick.
*/
#define need_proftick(p) { (p)->p_flag |= P_OWEUPC; aston(); }
#define need_proftick(p) \
do { \
(p)->p_flag |= P_OWEUPC; \
aston(p); \
} while (/*CONSTCOND*/0)
/*
* Notify the current process (p) that it has a signal pending,
* process as soon as possible.
*/
#define signotify(p) aston()
#define signotify(p) aston(p)
#define aston() (astpending = 1)
#define aston(p) ((p)->p_md.md_astpending = 1)
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;

View File

@ -1,4 +1,4 @@
/* $NetBSD: proc.h,v 1.10 2000/03/28 02:58:46 simonb Exp $ */
/* $NetBSD: proc.h,v 1.11 2001/01/14 21:18:39 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
@ -44,11 +44,12 @@
* Machine-dependent part of the proc structure for MIPS
*/
struct mdproc {
void *md_regs; /* registers on current frame */
void *md_regs; /* registers on current frame */
int md_flags; /* machine-dependent flags */
int md_upte[UPAGES]; /* ptes for mapping u page */
int md_ss_addr; /* single step address for ptrace */
int md_ss_instr; /* single step instruction for ptrace */
__volatile int md_astpending; /* AST pending on return to userland */
};
/* md_flags */

View File

@ -1,4 +1,4 @@
# $NetBSD: genassym.cf,v 1.21 2000/09/13 01:53:00 nisimura Exp $
# $NetBSD: genassym.cf,v 1.22 2001/01/14 21:18:39 thorpej Exp $
#
# Copyright (c) 1997
# Jonathan Stone. All rights reserved.
@ -64,6 +64,7 @@ define SONPROC SONPROC
define P_MD_REGS offsetof(struct proc, p_md.md_regs)
define P_MD_UPTE_0 offsetof(struct proc, p_md.md_upte[0])
define P_MD_UPTE_1 offsetof(struct proc, p_md.md_upte[1])
define P_MD_ASTPENDING offsetof(struct proc, p_md.md_astpending)
define U_PCB_FPREGS offsetof(struct user, u_pcb.pcb_fpregs)
define U_PCB_CONTEXT offsetof(struct user, u_pcb.pcb_context)

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore_mips1.S,v 1.49 2001/01/13 23:49:12 thorpej Exp $ */
/* $NetBSD: locore_mips1.S,v 1.50 2001/01/14 21:18:39 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
@ -361,7 +361,9 @@ NESTED_NOPROFILE(mips1_UserGenException, CALLFRAME_SIZ, ra)
/*
* Check pending asynchronous traps.
*/
lw t0, _C_LABEL(astpending) # any pending ast?
lw t0, _C_LABEL(curproc) # t0 = curproc
nop
lw t0, P_MD_ASTPENDING(t0) # any pending ast?
nop
beq t0, zero, 1f # if no, skip ast processing
nop
@ -450,7 +452,9 @@ NESTED_NOPROFILE(mips1_SystemCall, CALLFRAME_SIZ, ra)
/*
* Check pending asynchronous traps.
*/
lw t0, _C_LABEL(astpending) # any pending ast?
lw t0, _C_LABEL(curproc) # t0 = curproc
nop
lw t0, P_MD_ASTPENDING(t0) # any pending ast?
nop
beq t0, zero, 1f
nop
@ -631,9 +635,10 @@ NESTED_NOPROFILE(mips1_UserIntr, CALLFRAME_SIZ, ra)
/*
* Check pending asynchoronous traps.
*/
lw v0, _C_LABEL(curproc) # v0 = curproc
addu a1, sp, CALLFRAME_SIZ
lw a0, FRAME_SR(a1)
lw v0, _C_LABEL(astpending) # any pending ast?
lw v0, P_MD_ASTPENDING(v0) # any pending ast?
mtc0 a0, MIPS_COP_0_STATUS # restore SR, disable intrs
beq v0, zero, 1f # if no, skip ast processing
nop # -delay slot-

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore_mips3.S,v 1.63 2001/01/13 23:49:13 thorpej Exp $ */
/* $NetBSD: locore_mips3.S,v 1.64 2001/01/14 21:18:40 thorpej Exp $ */
/*
* Copyright (c) 1997 Jonathan Stone (hereinafter referred to as the author)
@ -562,7 +562,8 @@ NESTED_NOPROFILE(mips3_UserGenException, CALLFRAME_SIZ, ra)
/*
* Check pending asynchronous traps.
*/
lw t0, _C_LABEL(astpending)
lw t0, _C_LABEL(curproc)
lw t0, P_MD_ASTPENDING(t0)
beq t0, zero, 1f
nop
/*
@ -706,7 +707,8 @@ NESTED_NOPROFILE(mips3_SystemCall, CALLFRAME_SIZ, ra)
/*
* Check pending asynchronous traps.
*/
lw t0, _C_LABEL(astpending)
lw t0, _C_LABEL(curproc)
lw t0, P_MD_ASTPENDING(t0)
beq t0, zero, 1f
nop
/*
@ -994,10 +996,10 @@ NESTED_NOPROFILE(mips3_UserIntr, CALLFRAME_SIZ, ra)
nop # 3 nop hazard
nop
nop
lw v0, _C_LABEL(curproc)
addu a1, sp, CALLFRAME_SIZ
# REG_L a0, FRAME_SR(a1)
lw v0, _C_LABEL(astpending) # any pending ast?
nop # ???
lw v0, P_MD_ASTPENDING(t0) # any pending ast?
# mtc0 a0, MIPS_COP_0_STATUS # restore the SR, disable intrs
/*
* Check pending asynchronous traps.

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.157 2001/01/14 00:39:48 thorpej Exp $ */
/* $NetBSD: trap.c,v 1.158 2001/01/14 21:18:40 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.157 2001/01/14 00:39:48 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.158 2001/01/14 21:18:40 thorpej Exp $");
#include "opt_cputype.h" /* which mips CPU levels do we support? */
#include "opt_ktrace.h"
@ -91,7 +91,6 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.157 2001/01/14 00:39:48 thorpej Exp $");
#include <sys/kgdb.h>
#endif
__volatile int astpending;
int want_resched;
const char *trap_type[] = {
@ -690,9 +689,9 @@ ast(pc)
int sig;
#endif
while (astpending) {
while (p->p_md.md_astpending) {
uvmexp.softs++;
astpending = 0;
p->p_md.md_astpending = 0;
if (p->p_flag & P_OWEUPC) {
p->p_flag &= ~P_OWEUPC;