diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2003-03-04 19:10:32 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2003-03-04 19:10:32 +0000 |
commit | c1b1657a79d2e61c3a30bcccc029728939a69c60 (patch) | |
tree | 1ba39a6e57cc10e93727399644ab10897abb5f2e /sys | |
parent | 19a981f643ae985b6116e9b7bf1443890c7dfa49 (diff) |
Move 'userret' code to a seperate function, add it to child_return(). w/KNF
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/powerpc/powerpc/trap.c | 70 |
1 files changed, 37 insertions, 33 deletions
diff --git a/sys/arch/powerpc/powerpc/trap.c b/sys/arch/powerpc/powerpc/trap.c index 75515072597..67d932df457 100644 --- a/sys/arch/powerpc/powerpc/trap.c +++ b/sys/arch/powerpc/powerpc/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.56 2003/02/26 21:54:44 drahn Exp $ */ +/* $OpenBSD: trap.c,v 1.57 2003/03/04 19:10:31 drahn Exp $ */ /* $NetBSD: trap.c,v 1.3 1996/10/13 03:31:37 christos Exp $ */ /* @@ -63,6 +63,7 @@ static int fix_unaligned(struct proc *p, struct trapframe *frame); int badaddr(char *addr, u_int32_t len); +static __inline void userret(struct proc *, int, u_quad_t); void trap(struct trapframe *frame); /* These definitions should probably be somewhere else XXX */ @@ -241,6 +242,37 @@ enable_vec(struct proc *p) } #endif /* ALTIVEC */ +static __inline void +userret(register struct proc *p, int pc, u_quad_t oticks) +{ + 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))) + 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); + } + + curpriority = p->p_priority; +} void trap(frame) @@ -631,36 +663,9 @@ for (i = 0; i < errnum; i++) { ADDUPROF(p); } - /* take pending signals */ - { - int sig; - - while ((sig = CURSIG(p))) - postsig(sig); - } - - p->p_priority = p->p_usrpri; - if (want_resched) { - int sig; - - /* - * We're being preempted. - */ - preempt(NULL); - while ((sig = CURSIG(p))) - postsig(sig); - } + userret(p, frame->srr0, sticks); /* - * If profiling, charge recent system time to the trapped pc. - */ - if (p->p_flag & P_PROFIL) { - extern int psratio; - - addupc_task(p, frame->srr0, - (int)(p->p_sticks - sticks) * psratio); - } - /* * If someone stole the fpu while we were away, disable it */ if (p != fpuproc) { @@ -679,8 +684,6 @@ for (i = 0; i < errnum; i++) { frame->srr1 |= PSL_VEC; } #endif /* ALTIVEC */ - - curpriority = p->p_priority; } void @@ -696,12 +699,13 @@ child_return(arg) tf->cr &= ~0x10000000; /* Disable FPU, VECT, as we can't be fpuproc */ tf->srr1 &= ~(PSL_FP|PSL_VEC); + + userret(p, tf->srr0, 0); + #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) ktrsysret(p, SYS_fork, 0, 0); #endif - /* Profiling? XXX */ - curpriority = p->p_priority; } int |