Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/vax/vax Move common return-to-userland goo into use...
details: https://anonhg.NetBSD.org/src/rev/e9140b5192bd
branches: trunk
changeset: 486557:e9140b5192bd
user: thorpej <thorpej%NetBSD.org@localhost>
date: Thu May 25 17:01:11 2000 +0000
description:
Move common return-to-userland goo into userret(), like other ports.
diffstat:
sys/arch/vax/vax/trap.c | 96 +++++++++++++++++++++++++++---------------------
1 files changed, 53 insertions(+), 43 deletions(-)
diffs (145 lines):
diff -r 0d72f0a5012a -r e9140b5192bd sys/arch/vax/vax/trap.c
--- a/sys/arch/vax/vax/trap.c Thu May 25 16:47:18 2000 +0000
+++ b/sys/arch/vax/vax/trap.c Thu May 25 17:01:11 2000 +0000
@@ -1,4 +1,5 @@
-/* $NetBSD: trap.c,v 1.49 2000/05/24 16:48:44 thorpej Exp $ */
+/* $NetBSD: trap.c,v 1.50 2000/05/25 17:01:11 thorpej Exp $ */
+
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -67,6 +68,8 @@
volatile int startsysc = 0, faultdebug = 0;
#endif
+static __inline void userret __P((struct proc *, struct trapframe *, u_quad_t));
+
void arithflt __P((struct trapframe *));
void syscall __P((struct trapframe *));
@@ -102,6 +105,49 @@
return; \
}
+/*
+ * userret:
+ *
+ * Common code used by various execption handlers to
+ * return to usermode.
+ */
+static __inline void
+userret(p, frame, oticks)
+ struct proc *p;
+ struct trapframe *frame;
+ u_quad_t oticks;
+{
+ int sig;
+
+ /* Take pending signals. */
+ while ((sig = CURSIG(p)) != 0)
+ postsig(sig);
+ p->p_priority = p->p_usrpri;
+#if defined(MULTIPROCESSOR)
+ if (curcpu()->ci_want_resched) {
+#else
+ if (want_resched) {
+#endif
+ /*
+ * 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, frame->pc,
+ (int)(p->p_sticks - oticks) * psratio);
+ }
+ curpriority = p->p_priority;
+}
+
void
arithflt(frame)
struct trapframe *frame;
@@ -264,26 +310,7 @@
if (umode == 0)
return;
- while ((sig = CURSIG(p)) !=0)
- postsig(sig);
- p->p_priority = p->p_usrpri;
-#if defined(MULTIPROCESSOR)
- if (curcpu()->ci_want_resched) {
-#else
- if (want_resched) {
-#endif
- /*
- * We are being preempted.
- */
- preempt(NULL);
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
- }
- if (p->p_flag & P_PROFIL) {
- extern int psratio;
- addupc_task(p, frame->pc, (int)(p->p_sticks-oticks) * psratio);
- }
- curpriority = p->p_priority;
+ userret(p, frame, oticks);
}
void
@@ -309,7 +336,7 @@
{
struct sysent *callp;
u_quad_t oticks;
- int nsys, sig;
+ int nsys;
int err, rval[2], args[8];
struct trapframe *exptr;
struct proc *p = curproc;
@@ -363,7 +390,7 @@
if(startsysc)
printf("retur %s pc %lx, psl %lx, sp %lx, pid %d, v{rde %d r0 %d, r1 %d, frame %p\n",
syscallnames[exptr->code], exptr->pc, exptr->psl,exptr->sp,
- curproc->p_pid,err,rval[0],rval[1],exptr);
+ p->p_pid,err,rval[0],rval[1],exptr); /* } */
#endif
bad:
@@ -386,26 +413,9 @@
exptr->psl |= PSL_C;
break;
}
- p = curproc;
- while ((sig = CURSIG(p)) !=0)
- postsig(sig);
- p->p_priority = p->p_usrpri;
-#if defined(MULTIPROCESSOR)
- if (curcpu()->ci_want_resched) {
-#else
- if (want_resched) {
-#endif
- /*
- * We are being preempted.
- */
- preempt(NULL);
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
- }
- if (p->p_flag & P_PROFIL) {
- extern int psratio;
- addupc_task(p, frame->pc, (int)(p->p_sticks-oticks) * psratio);
- }
+
+ userret(p, frame, oticks);
+
#ifdef KTRACE
if (KTRPOINT(p, KTR_SYSRET))
ktrsysret(p->p_tracep, frame->code, err, rval[0]);
Home |
Main Index |
Thread Index |
Old Index