diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2006-12-24 20:30:36 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2006-12-24 20:30:36 +0000 |
commit | cdf6b9367dd4209ca60448d12a3522fd25f88179 (patch) | |
tree | 08d7a4fae7c7631ecd367e2004c022932d47e625 /sys/arch/mips64 | |
parent | 40edd12a0c0296733c9c321bece20217e47c0dc5 (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/mips64')
-rw-r--r-- | sys/arch/mips64/include/cpu.h | 7 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/interrupt.c | 28 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/trap.c | 60 |
3 files changed, 32 insertions, 63 deletions
diff --git a/sys/arch/mips64/include/cpu.h b/sys/arch/mips64/include/cpu.h index 30a30fa6899..def5c9e20c4 100644 --- a/sys/arch/mips64/include/cpu.h +++ b/sys/arch/mips64/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.13 2006/11/29 12:26:13 miod Exp $ */ +/* $OpenBSD: cpu.h,v 1.14 2006/12/24 20:30:35 miod Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -334,6 +334,11 @@ extern int int_nest_cntr; #define CLKF_INTR(framep) (int_nest_cntr > 0) /* + * This is used during profiling to integrate system time. + */ +#define PROC_PC(p) ((p)->p_md.md_regs->pc) + +/* * Preempt the current process if in interrupt from user mode, * or after the current trap/syscall if in system mode. */ diff --git a/sys/arch/mips64/mips64/interrupt.c b/sys/arch/mips64/mips64/interrupt.c index b7c92014fc9..59d1aed120d 100644 --- a/sys/arch/mips64/mips64/interrupt.c +++ b/sys/arch/mips64/mips64/interrupt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: interrupt.c,v 1.21 2006/05/11 19:57:45 miod Exp $ */ +/* $OpenBSD: interrupt.c,v 1.22 2006/12/24 20:30:35 miod Exp $ */ /* * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -124,8 +124,8 @@ int netisr; * CPU is done. Instead a fixed mask is set and used throughout. */ -void interrupt (struct trap_frame *); -void softintr (void); +void interrupt(struct trap_frame *); +void softintr(void); /* * Handle an interrupt. Both kernel and user mode is handled here. @@ -256,7 +256,6 @@ set_intr(int pri, intrmask_t mask, /* * This is called from MipsUserIntr() if astpending is set. - * This is very similar to the tail of trap(). */ void softintr() @@ -265,26 +264,21 @@ softintr() int sig; uvmexp.softs++; - /* take pending signals */ - while ((sig = CURSIG(p)) != 0) - postsig(sig); - p->p_priority = p->p_usrpri; + astpending = 0; if (p->p_flag & P_OWEUPC) { p->p_flag &= ~P_OWEUPC; ADDUPROF(p); } - if (want_resched) { - /* - * We're being preempted. - */ + if (want_resched) preempt(NULL); - while ((sig = CURSIG(p)) != 0) - postsig(sig); - } - curpriority = p->p_priority; -} + /* inline userret(p) */ + + while ((sig = CURSIG(p)) != 0) /* take pending signals */ + postsig(sig); + curpriority = p->p_priority = p->p_usrpri; +} intrmask_t intem = 0x0; diff --git a/sys/arch/mips64/mips64/trap.c b/sys/arch/mips64/mips64/trap.c index aeefc98c6a3..cb812d565e8 100644 --- a/sys/arch/mips64/mips64/trap.c +++ b/sys/arch/mips64/mips64/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.30 2006/05/31 20:19:39 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.31 2006/12/24 20:30:35 miod Exp $ */ /* tracked to 1.23 */ /* @@ -157,6 +157,18 @@ int cpu_singlestep(struct proc *); #endif u_long MipsEmulateBranch(struct trap_frame *, long, int, u_int); +static __inline__ void +userret(struct proc *p) +{ + int sig; + + /* take pending signals */ + while ((sig = CURSIG(p)) != 0) + postsig(sig); + + curpriority = p->p_priority = p->p_usrpri; +} + /* * Handle an exception. * In the case of a kernel trap, we return the pc where to resume if @@ -169,7 +181,6 @@ trap(trapframe) int type, i; unsigned ucode = 0; struct proc *p = curproc; - u_quad_t sticks; vm_prot_t ftype; extern vaddr_t onfault_table[]; int onfault; @@ -181,7 +192,6 @@ trap(trapframe) type = (trapframe->cause & CR_EXC_CODE) >> CR_EXC_CODE_SHIFT; if (USERMODE(trapframe->sr)) { type |= T_USER; - sticks = p->p_sticks; } /* @@ -793,27 +803,7 @@ out: /* * Note: we should only get here if returning to user mode. */ - /* take pending signals */ - while ((i = CURSIG(p)) != 0) - postsig(i); - p->p_priority = p->p_usrpri; - astpending = 0; - if (want_resched) { - preempt(NULL); - while ((i = CURSIG(p)) != 0) - postsig(i); - } - - /* - * If profiling, charge system time to the trapped pc. - */ - if (p->p_flag & P_PROFIL) { - extern int psratio; - - addupc_task(p, trapframe->pc, (int)(p->p_sticks - sticks) * psratio); - } - - curpriority = p->p_priority; + userret(p); return (trapframe->pc); } @@ -823,33 +813,13 @@ child_return(arg) { struct proc *p = arg; struct trap_frame *trapframe; - int i; trapframe = p->p_md.md_regs; trapframe->v0 = 0; trapframe->v1 = 1; trapframe->a3 = 0; - /* take pending signals */ - while ((i = CURSIG(p)) != 0) - postsig(i); - p->p_priority = p->p_usrpri; - astpending = 0; - if (want_resched) { - preempt(NULL); - while ((i = CURSIG(p)) != 0) - postsig(i); - } - -#if 0 /* Need sticks */ - if (p->p_flag & P_PROFIL) { - extern int psratio; - - addupc_task(p, trapframe->pc, (int)(p->p_sticks - sticks) * psratio); - } -#endif - - curpriority = p->p_priority; + userret(p); #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) |