summaryrefslogtreecommitdiff
path: root/sys/arch/i386
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2006-12-24 20:30:36 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2006-12-24 20:30:36 +0000
commitcdf6b9367dd4209ca60448d12a3522fd25f88179 (patch)
tree08d7a4fae7c7631ecd367e2004c022932d47e625 /sys/arch/i386
parent40edd12a0c0296733c9c321bece20217e47c0dc5 (diff)
Define PROC_PC. Then, since profiling information is being reported in
statclock(), do not bother doing this in userret() anymore. As a result, userret() does not need its pc and ticks arguments, simplify.
Diffstat (limited to 'sys/arch/i386')
-rw-r--r--sys/arch/i386/i386/trap.c37
-rw-r--r--sys/arch/i386/include/cpu.h7
2 files changed, 13 insertions, 31 deletions
diff --git a/sys/arch/i386/i386/trap.c b/sys/arch/i386/i386/trap.c
index 1a293e75e86..f4f84c0a2f4 100644
--- a/sys/arch/i386/i386/trap.c
+++ b/sys/arch/i386/i386/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.79 2006/12/24 20:29:19 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.80 2006/12/24 20:30:35 miod Exp $ */
/* $NetBSD: trap.c,v 1.95 1996/05/05 06:50:02 mycroft Exp $ */
/*-
@@ -97,7 +97,7 @@ extern struct emul emul_aout;
#include "npx.h"
-static __inline void userret(struct proc *, int, u_quad_t);
+static __inline void userret(struct proc *);
void trap(struct trapframe);
int trapwrite(unsigned);
void syscall(struct trapframe);
@@ -107,31 +107,13 @@ void syscall(struct trapframe);
* trap and syscall.
*/
static __inline void
-userret(struct proc *p, int pc, u_quad_t oticks)
+userret(struct proc *p)
{
int sig;
/* take pending signals */
while ((sig = CURSIG(p)) != 0)
postsig(sig);
- p->p_priority = p->p_usrpri;
- if (want_resched) {
- /*
- * We're being preempted.
- */
- preempt(NULL);
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
- }
-
- /*
- * If profiling, charge recent system time to the trapped pc.
- */
- if (p->p_flag & P_PROFIL) {
- extern int psratio;
-
- addupc_task(p, pc, (int)(p->p_sticks - oticks) * psratio);
- }
p->p_cpu->ci_schedstate.spc_curpriority = p->p_priority;
}
@@ -179,7 +161,6 @@ trap(struct trapframe frame)
{
struct proc *p = curproc;
int type = frame.tf_trapno;
- u_quad_t sticks;
struct pcb *pcb = NULL;
extern char resume_iret[], resume_pop_ds[], resume_pop_es[],
resume_pop_fs[], resume_pop_gs[];
@@ -210,10 +191,8 @@ trap(struct trapframe frame)
if (!KERNELMODE(frame.tf_cs, frame.tf_eflags)) {
type |= T_USER;
- sticks = p->p_sticks;
p->p_md.md_regs = &frame;
- } else
- sticks = 0;
+ }
switch (type) {
@@ -586,7 +565,7 @@ trap(struct trapframe frame)
if ((type & T_USER) == 0)
return;
out:
- userret(p, frame.tf_eip, sticks);
+ userret(p);
}
/*
@@ -629,7 +608,6 @@ syscall(struct trapframe frame)
int orig_error, error, opc, nsys;
size_t argsize;
register_t code, args[8], rval[2];
- u_quad_t sticks;
#ifdef DIAGNOSTIC
int ocpl = lapic_tpr;
#endif
@@ -640,7 +618,6 @@ syscall(struct trapframe frame)
panic("syscall");
#endif
p = curproc;
- sticks = p->p_sticks;
p->p_md.md_regs = &frame;
opc = frame.tf_eip;
code = frame.tf_eax;
@@ -797,7 +774,7 @@ syscall(struct trapframe frame)
scdebug_ret(p, code, orig_error, rval);
KERNEL_PROC_UNLOCK(p);
#endif
- userret(p, frame.tf_eip, sticks);
+ userret(p);
#ifdef KTRACE
if (KTRPOINT(p, KTR_SYSRET)) {
KERNEL_PROC_LOCK(p);
@@ -826,7 +803,7 @@ child_return(void *arg)
KERNEL_PROC_UNLOCK(p);
- userret(p, tf->tf_eip, 0);
+ userret(p);
#ifdef KTRACE
if (KTRPOINT(p, KTR_SYSRET)) {
KERNEL_PROC_LOCK(p);
diff --git a/sys/arch/i386/include/cpu.h b/sys/arch/i386/include/cpu.h
index 9cd4923d30f..b9ac96eca8a 100644
--- a/sys/arch/i386/include/cpu.h
+++ b/sys/arch/i386/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.85 2006/12/20 17:50:40 gwk Exp $ */
+/* $OpenBSD: cpu.h,v 1.86 2006/12/24 20:30:35 miod Exp $ */
/* $NetBSD: cpu.h,v 1.35 1996/05/05 19:29:26 christos Exp $ */
/*-
@@ -215,6 +215,11 @@ extern void need_resched(struct cpu_info *);
#define CLKF_INTR(frame) (IDXSEL((frame)->if_cs) == GICODE_SEL)
/*
+ * This is used during profiling to integrate system time.
+ */
+#define PROC_PC(p) ((p)->p_md.md_regs->tf_eip)
+
+/*
* Give a profiling tick to the current process when the user profiling
* buffer pages are invalid. On the i386, request an ast to send us
* through trap(), marking the proc as needing a profiling tick.