Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/mips Modeled after mycroft's changes to the Alpha p...
details: https://anonhg.NetBSD.org/src/rev/7cd547359810
branches: trunk
changeset: 502096:7cd547359810
user: thorpej <thorpej%NetBSD.org@localhost>
date: Thu Jan 11 18:30:16 2001 +0000
description:
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().
diffstat:
sys/arch/mips/include/cpu.h | 8 ++++++--
sys/arch/mips/mips/trap.c | 31 ++++++++++++-------------------
2 files changed, 18 insertions(+), 21 deletions(-)
diffs (93 lines):
diff -r e51756a83359 -r 7cd547359810 sys/arch/mips/include/cpu.h
--- a/sys/arch/mips/include/cpu.h Thu Jan 11 17:56:16 2001 +0000
+++ b/sys/arch/mips/include/cpu.h Thu Jan 11 18:30:16 2001 +0000
@@ -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 @@
#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 @@
((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,
diff -r e51756a83359 -r 7cd547359810 sys/arch/mips/mips/trap.c
--- a/sys/arch/mips/mips/trap.c Thu Jan 11 17:56:16 2001 +0000
+++ b/sys/arch/mips/mips/trap.c Thu Jan 11 18:30:16 2001 +0000
@@ -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 @@
/* 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 @@
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);
}
Home |
Main Index |
Thread Index |
Old Index