Modeled after mycroft's changes to the Alpha port, add PROC_PC() to
get profiling out of userret(), and move the preemption check to ast().
This commit is contained in:
parent
3711020b5c
commit
f1152a965b
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cpu.h,v 1.46 2000/10/05 02:13:14 cgd Exp $ */
|
||||
/* $NetBSD: cpu.h,v 1.47 2001/01/11 18:30:16 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -148,7 +148,6 @@ struct clockframe {
|
||||
#define CLKF_BASEPRI(framep) MIPS1_CLKF_BASEPRI(framep)
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(MIPS3) && defined(MIPS1)
|
||||
#define CLKF_USERMODE(framep) \
|
||||
((CPUISMIPS3) ? MIPS3_CLKF_USERMODE(framep): MIPS1_CLKF_USERMODE(framep))
|
||||
@ -156,6 +155,11 @@ struct clockframe {
|
||||
((CPUISMIPS3) ? MIPS3_CLKF_BASEPRI(framep): MIPS1_CLKF_BASEPRI(framep))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This is used during profiling to integrate system time. It can safely
|
||||
* assume that the process is resident.
|
||||
*/
|
||||
#define PROC_PC(p) ((p)->p_md.md_regs->f_regs[37]) /* XXX PC */
|
||||
|
||||
/*
|
||||
* Preempt the current process if in interrupt from user mode,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: trap.c,v 1.152 2000/12/14 21:24:53 jeffs Exp $ */
|
||||
/* $NetBSD: trap.c,v 1.153 2001/01/11 18:30:17 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.152 2000/12/14 21:24:53 jeffs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.153 2001/01/11 18:30:17 thorpej Exp $");
|
||||
|
||||
#include "opt_cputype.h" /* which mips CPU levels do we support? */
|
||||
#include "opt_ktrace.h"
|
||||
@ -144,24 +144,8 @@ userret(struct proc *p, unsigned pc, u_quad_t sticks)
|
||||
/* take pending signals */
|
||||
while ((sig = CURSIG(p)) != 0)
|
||||
postsig(sig);
|
||||
p->p_priority = p->p_usrpri;
|
||||
if (want_resched) {
|
||||
/*
|
||||
* We are being preempted.
|
||||
*/
|
||||
preempt(NULL);
|
||||
while ((sig = CURSIG(p)) != 0)
|
||||
postsig(sig);
|
||||
}
|
||||
/*
|
||||
* If profiling, charge system time to the trapped pc.
|
||||
*/
|
||||
if (p->p_flag & P_PROFIL) {
|
||||
extern int psratio;
|
||||
|
||||
addupc_task(p, pc, (int)(p->p_sticks - sticks) * psratio);
|
||||
}
|
||||
curcpu()->ci_schedstate.spc_curpriority = p->p_priority;
|
||||
curcpu()->ci_schedstate.spc_curpriority = p->p_priority = p->p_usrpri;
|
||||
}
|
||||
|
||||
#define DELAYBRANCH(x) ((int)(x)<0)
|
||||
@ -721,10 +705,19 @@ ast(pc)
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
userret(p, pc, p->p_sticks);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user