summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2011-11-16 20:50:17 +0000
committerderaadt <deraadt@openbsd.org>2011-11-16 20:50:17 +0000
commitc2b933418c920e1d907618196038c2901ddb00bb (patch)
tree8f7eaf9c109a15c6028b95e6d4ea0fa3b8b0868a
parentWhen processing .Sh HEAD, as soon as we know which section this is, (diff)
downloadwireguard-openbsd-c2b933418c920e1d907618196038c2901ddb00bb.tar.xz
wireguard-openbsd-c2b933418c920e1d907618196038c2901ddb00bb.zip
Make userret() MI. On architectures which jammed stuff into it in the
past, pull that code out seperately. ok guenther miod
-rw-r--r--sys/arch/alpha/alpha/pmap.c6
-rw-r--r--sys/arch/alpha/alpha/trap.c38
-rw-r--r--sys/arch/alpha/include/pmap.h6
-rw-r--r--sys/arch/amd64/amd64/trap.c3
-rw-r--r--sys/arch/amd64/include/userret.h84
-rw-r--r--sys/arch/arm/arm/ast.c15
-rw-r--r--sys/arch/arm/include/cpu.h5
-rw-r--r--sys/arch/hp300/hp300/trap.c38
-rw-r--r--sys/arch/hppa/hppa/trap.c18
-rw-r--r--sys/arch/hppa64/hppa64/trap.c47
-rw-r--r--sys/arch/i386/i386/trap.c19
-rw-r--r--sys/arch/m68k/include/cpu.h5
-rw-r--r--sys/arch/m88k/m88k/trap.c14
-rw-r--r--sys/arch/mac68k/mac68k/trap.c38
-rw-r--r--sys/arch/mips64/mips64/trap.c14
-rw-r--r--sys/arch/mvme68k/mvme68k/trap.c38
-rw-r--r--sys/arch/powerpc/powerpc/trap.c14
-rw-r--r--sys/arch/sh/include/userret.h94
-rw-r--r--sys/arch/sh/sh/trap.c6
-rw-r--r--sys/arch/solbourne/solbourne/trap.c18
-rw-r--r--sys/arch/sparc/sparc/trap.c18
-rw-r--r--sys/arch/sparc64/sparc64/trap.c19
-rw-r--r--sys/arch/vax/vax/trap.c22
-rw-r--r--sys/kern/kern_sig.c13
-rw-r--r--sys/sys/sched.h3
25 files changed, 91 insertions, 504 deletions
diff --git a/sys/arch/alpha/alpha/pmap.c b/sys/arch/alpha/alpha/pmap.c
index 720febf9fc4..4d089612977 100644
--- a/sys/arch/alpha/alpha/pmap.c
+++ b/sys/arch/alpha/alpha/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.61 2011/09/22 17:41:00 jasper Exp $ */
+/* $OpenBSD: pmap.c,v 1.62 2011/11/16 20:50:17 deraadt Exp $ */
/* $NetBSD: pmap.c,v 1.154 2000/12/07 22:18:55 thorpej Exp $ */
/*-
@@ -618,11 +618,11 @@ do { \
#define PMAP_SYNC_ISTREAM_USER(pmap) \
do { \
alpha_multicast_ipi((pmap)->pm_cpus, ALPHA_IPI_AST); \
- /* for curcpu, will happen in userret() */ \
+ /* for curcpu, do it before userret() */ \
} while (0)
#else
#define PMAP_SYNC_ISTREAM_KERNEL() alpha_pal_imb()
-#define PMAP_SYNC_ISTREAM_USER(pmap) /* will happen in userret() */
+#define PMAP_SYNC_ISTREAM_USER(pmap) /* done before userret() */
#endif /* MULTIPROCESSOR */
#define PMAP_SYNC_ISTREAM(pmap) \
diff --git a/sys/arch/alpha/alpha/trap.c b/sys/arch/alpha/alpha/trap.c
index 5896a1379e0..5d2229a2166 100644
--- a/sys/arch/alpha/alpha/trap.c
+++ b/sys/arch/alpha/alpha/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.58 2011/04/03 14:56:27 guenther Exp $ */
+/* $OpenBSD: trap.c,v 1.59 2011/11/16 20:50:17 deraadt Exp $ */
/* $NetBSD: trap.c,v 1.52 2000/05/24 16:48:33 thorpej Exp $ */
/*-
@@ -115,8 +115,6 @@
#endif
#include <alpha/alpha/db_instruction.h>
-void userret(struct proc *);
-
#ifndef SMALL_KERNEL
unsigned long Sfloat_to_reg(unsigned int);
@@ -168,25 +166,6 @@ trap_init()
~(ALPHA_MCES_DSC|ALPHA_MCES_DPC));
}
-/*
- * Define the code needed before returning to user mode, for
- * trap and syscall.
- */
-void
-userret(struct proc *p)
-{
- int sig;
-
- /* Do any deferred user pmap operations. */
- PMAP_USERRET(vm_map_pmap(&p->p_vmspace->vm_map));
-
- /* take pending signals */
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
-
- curcpu()->ci_schedstate.spc_curpriority = p->p_priority = p->p_usrpri;
-}
-
#ifdef DEBUG
static void
printtrap(a0, a1, a2, entry, framep, isfatal, user)
@@ -514,8 +493,12 @@ do_fault:
sv.sival_ptr = v;
trapsignal(p, i, ucode, typ, sv);
out:
- if (user)
+ if (user) {
+ /* Do any deferred user pmap operations. */
+ PMAP_USERRET(vm_map_pmap(&p->p_vmspace->vm_map));
+
userret(p);
+ }
return;
dopanic:
@@ -652,6 +635,9 @@ syscall(code, framep)
#ifdef SYSCALL_DEBUG
scdebug_ret(p, code, error, rval);
#endif
+ /* Do any deferred user pmap operations. */
+ PMAP_USERRET(vm_map_pmap(&p->p_vmspace->vm_map));
+
userret(p);
#ifdef KTRACE
if (KTRPOINT(p, KTR_SYSRET))
@@ -676,6 +662,9 @@ child_return(arg)
framep->tf_regs[FRAME_A4] = 0;
framep->tf_regs[FRAME_A3] = 0;
+ /* Do any deferred user pmap operations. */
+ PMAP_USERRET(vm_map_pmap(&p->p_vmspace->vm_map));
+
userret(p);
#ifdef KTRACE
if (KTRPOINT(p, KTR_SYSRET))
@@ -753,6 +742,9 @@ ast(framep)
if (curcpu()->ci_want_resched)
preempt(NULL);
+ /* Do any deferred user pmap operations. */
+ PMAP_USERRET(vm_map_pmap(&p->p_vmspace->vm_map));
+
userret(p);
}
diff --git a/sys/arch/alpha/include/pmap.h b/sys/arch/alpha/include/pmap.h
index 99ae8b00ef4..233932f1798 100644
--- a/sys/arch/alpha/include/pmap.h
+++ b/sys/arch/alpha/include/pmap.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.h,v 1.25 2010/12/26 15:40:58 miod Exp $ */
+/* $OpenBSD: pmap.h,v 1.26 2011/11/16 20:50:18 deraadt Exp $ */
/* $NetBSD: pmap.h,v 1.37 2000/11/19 03:16:35 thorpej Exp $ */
/*-
@@ -298,8 +298,8 @@ pmap_l3pte(pmap, v, l2pte)
*
* The pmap module may defer syncing the user I-stream until the
* return to userspace, since the IMB PALcode op can be quite
- * expensive. Since user instructions won't be executed until
- * the return to userspace, this can be deferred until userret().
+ * expensive. Since user instructions won't be executed until the
+ * return to userspace, this can be deferred until just before userret().
*/
#define PMAP_USERRET(pmap) \
do { \
diff --git a/sys/arch/amd64/amd64/trap.c b/sys/arch/amd64/amd64/trap.c
index f560d326bb3..0d3bf9a5df5 100644
--- a/sys/arch/amd64/amd64/trap.c
+++ b/sys/arch/amd64/amd64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.26 2011/11/14 15:06:14 deraadt Exp $ */
+/* $OpenBSD: trap.c,v 1.27 2011/11/16 20:50:18 deraadt Exp $ */
/* $NetBSD: trap.c,v 1.2 2003/05/04 23:51:56 fvdl Exp $ */
/*-
@@ -93,7 +93,6 @@
#include <machine/psl.h>
#include <machine/reg.h>
#include <machine/trap.h>
-#include <machine/userret.h>
#ifdef DDB
#include <machine/db_machdep.h>
#endif
diff --git a/sys/arch/amd64/include/userret.h b/sys/arch/amd64/include/userret.h
deleted file mode 100644
index 62cb5467a33..00000000000
--- a/sys/arch/amd64/include/userret.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* $OpenBSD: userret.h,v 1.5 2011/07/05 09:14:15 deraadt Exp $ */
-/* $NetBSD: userret.h,v 1.1 2003/04/26 18:39:49 fvdl Exp $ */
-
-/*-
- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Charles M. Hannum.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#include <sys/signalvar.h>
-#include <machine/cpu.h>
-
-static __inline void userret(struct proc *);
-
-/*
- * Define the code needed before returning to user mode, for
- * trap and syscall.
- */
-static __inline void
-userret(struct proc *p)
-{
- int sig;
-
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
-
- curcpu()->ci_schedstate.spc_curpriority = p->p_priority = p->p_usrpri;
-}
diff --git a/sys/arch/arm/arm/ast.c b/sys/arch/arm/arm/ast.c
index 70b32ac0d5a..7fb82e5850d 100644
--- a/sys/arch/arm/arm/ast.c
+++ b/sys/arch/arm/arm/ast.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ast.c,v 1.9 2011/09/20 22:02:10 miod Exp $ */
+/* $OpenBSD: ast.c,v 1.10 2011/11/16 20:50:18 deraadt Exp $ */
/* $NetBSD: ast.c,v 1.6 2003/10/31 16:44:34 cl Exp $ */
/*
@@ -67,19 +67,6 @@ void ast(struct trapframe *);
int want_resched;
extern int astpending;
-void
-userret(struct proc *p)
-{
- int sig;
-
- /* Take pending signals. */
- while ((sig = (CURSIG(p))) != 0)
- postsig(sig);
-
- p->p_cpu->ci_schedstate.spc_curpriority = p->p_priority = p->p_usrpri;
-}
-
-
/*
* Handle asynchronous system traps.
* This is called from the irq handler to deliver signals
diff --git a/sys/arch/arm/include/cpu.h b/sys/arch/arm/include/cpu.h
index 28e06c5c0ac..b9260fd852f 100644
--- a/sys/arch/arm/include/cpu.h
+++ b/sys/arch/arm/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.29 2011/10/24 22:49:07 drahn Exp $ */
+/* $OpenBSD: cpu.h,v 1.30 2011/11/16 20:50:18 deraadt Exp $ */
/* $NetBSD: cpu.h,v 1.34 2003/06/23 11:01:08 martin Exp $ */
/*
@@ -257,9 +257,6 @@ int cpu_alloc_idlepcb (struct cpu_info *);
struct pcb;
void savectx (struct pcb *pcb);
-/* ast.c */
-void userret (struct proc *p);
-
/* machdep.h */
void bootsync (int);
diff --git a/sys/arch/hp300/hp300/trap.c b/sys/arch/hp300/hp300/trap.c
index 177c8c0d256..d299aa6b140 100644
--- a/sys/arch/hp300/hp300/trap.c
+++ b/sys/arch/hp300/hp300/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.59 2011/07/05 04:48:01 guenther Exp $ */
+/* $OpenBSD: trap.c,v 1.60 2011/11/16 20:50:18 deraadt Exp $ */
/* $NetBSD: trap.c,v 1.57 1998/02/16 20:58:31 thorpej Exp $ */
/*
@@ -181,36 +181,13 @@ int mmupid = -1;
#define MDB_ISPID(p) ((p) == mmupid)
#endif
-/*
- * trap and syscall both need the following work done before returning
- * to user mode.
- */
-void
-userret(struct proc *p)
-{
- int sig;
-
- /* take pending signals */
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
- curcpu()->ci_schedstate.spc_curpriority = p->p_priority = p->p_usrpri;
-}
-
#ifdef M68040
/*
- * Same as above, but also handles writeback completion on 68040.
+ * Handle writeback completion on 68040.
*/
void
wb_userret(struct proc *p, struct frame *fp)
{
- int sig;
- union sigval sv;
-
- /* take pending signals */
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
- p->p_priority = p->p_usrpri;
-
/*
* Deal with user mode writebacks (from trap, or from sigreturn).
* If any writeback fails, go back and attempt signal delivery.
@@ -220,16 +197,16 @@ wb_userret(struct proc *p, struct frame *fp)
* the writebacks. Maybe we should just drop the sucker?
*/
if (cputype == CPU_68040 && fp->f_format == FMT7) {
+ int sig;
+ union sigval sv;
+
if ((sig = writeback(fp)) != 0) {
sv.sival_ptr = (caddr_t)fp->f_fmt7.f_fa;
trapsignal(p, sig, T_MMUFLT, SEGV_MAPERR, sv);
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
- p->p_priority = p->p_usrpri;
+ userret(p);
}
}
- curcpu()->ci_schedstate.spc_curpriority = p->p_priority;
}
#endif
@@ -603,10 +580,9 @@ dopanic:
out:
if ((type & T_USER) == 0)
return;
+ userret(p);
#ifdef M68040
wb_userret(p, &frame);
-#else
- userret(p);
#endif
}
diff --git a/sys/arch/hppa/hppa/trap.c b/sys/arch/hppa/hppa/trap.c
index c75f31bf7cc..bcefe5e5b5d 100644
--- a/sys/arch/hppa/hppa/trap.c
+++ b/sys/arch/hppa/hppa/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.119 2011/11/08 14:02:30 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.120 2011/11/16 20:50:18 deraadt Exp $ */
/*
* Copyright (c) 1998-2004 Michael Shalayeff
@@ -135,13 +135,9 @@ u_char hppa_regmap[32] = {
offsetof(struct trapframe, tf_r31) / 4,
};
-void userret(struct proc *p);
-
void
-userret(struct proc *p)
+ast(struct proc *p)
{
- int sig;
-
if (p->p_md.md_astpending) {
p->p_md.md_astpending = 0;
uvmexp.softs++;
@@ -154,10 +150,6 @@ userret(struct proc *p)
preempt(NULL);
}
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
-
- p->p_cpu->ci_schedstate.spc_curpriority = p->p_priority = p->p_usrpri;
}
void
@@ -643,8 +635,10 @@ datalign_user:
* and also see a note in locore.S:TLABEL(all)
*/
if ((type & T_USER) && !(frame->tf_iisq_head == HPPA_SID_KERNEL &&
- (frame->tf_iioq_head & ~PAGE_MASK) == SYSCALLGATE))
+ (frame->tf_iioq_head & ~PAGE_MASK) == SYSCALLGATE)) {
+ ast(p);
userret(p);
+ }
}
void
@@ -662,6 +656,7 @@ child_return(void *arg)
KERNEL_UNLOCK();
+ ast(p);
userret(p);
#ifdef KTRACE
if (KTRPOINT(p, KTR_SYSRET)) {
@@ -945,6 +940,7 @@ syscall(struct trapframe *frame)
scdebug_ret(p, code, oerror, rval);
KERNEL_UNLOCK();
#endif
+ ast(p);
userret(p);
#ifdef KTRACE
if (KTRPOINT(p, KTR_SYSRET)) {
diff --git a/sys/arch/hppa64/hppa64/trap.c b/sys/arch/hppa64/hppa64/trap.c
index 36558586308..38a102e1ceb 100644
--- a/sys/arch/hppa64/hppa64/trap.c
+++ b/sys/arch/hppa64/hppa64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.26 2011/09/20 16:44:28 jsing Exp $ */
+/* $OpenBSD: trap.c,v 1.27 2011/11/16 20:50:18 deraadt Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -128,43 +128,18 @@ u_char hppa64_regmap[32] = {
offsetof(struct trapframe, tf_r31) / 8,
};
-void userret(struct proc *p, register_t pc, u_quad_t oticks);
-
void
-userret(struct proc *p, register_t pc, u_quad_t oticks)
+ast(struct proc *p)
{
- int sig;
-
- /* take pending signals */
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
-
- p->p_priority = p->p_usrpri;
if (astpending) {
astpending = 0;
+ uvmexp.softs++;
if (p->p_flag & P_OWEUPC) {
ADDUPROF(p);
}
+ if (want_resched) {
+ preempt(NULL);
}
- 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;
}
void
@@ -554,8 +529,10 @@ trap(int type, struct trapframe *frame)
* and also see a note in locore.S:TLABEL(all)
*/
if ((type & T_USER) &&
- (frame->tf_iioq[0] & ~PAGE_MASK) != SYSCALLGATE)
- userret(p, frame->tf_iioq[0], 0);
+ (frame->tf_iioq[0] & ~PAGE_MASK) != SYSCALLGATE) {
+ ast(p);
+ userret(p);
+ }
}
void
@@ -571,7 +548,8 @@ child_return(void *arg)
tf->tf_ret1 = 1; /* ischild */
tf->tf_r1 = 0; /* errno */
- userret(p, tf->tf_iioq[0], 0);
+ ast(p);
+ userret(p);
#ifdef KTRACE
if (KTRPOINT(p, KTR_SYSRET))
ktrsysret(p,
@@ -674,7 +652,8 @@ syscall(struct trapframe *frame)
#ifdef SYSCALL_DEBUG
scdebug_ret(p, code, oerror, rval);
#endif
- userret(p, frame->tf_iioq[1], 0);
+ ast(p);
+ userret(p);
#ifdef KTRACE
if (KTRPOINT(p, KTR_SYSRET))
ktrsysret(p, code, oerror, rval[0]);
diff --git a/sys/arch/i386/i386/trap.c b/sys/arch/i386/i386/trap.c
index 3dab71dcfb0..488258a99b5 100644
--- a/sys/arch/i386/i386/trap.c
+++ b/sys/arch/i386/i386/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.100 2011/07/11 15:40:47 guenther Exp $ */
+/* $OpenBSD: trap.c,v 1.101 2011/11/16 20:50:18 deraadt Exp $ */
/* $NetBSD: trap.c,v 1.95 1996/05/05 06:50:02 mycroft Exp $ */
/*-
@@ -86,26 +86,9 @@ extern struct emul emul_aout;
#include "npx.h"
-static __inline void userret(struct proc *);
void trap(struct trapframe *);
void syscall(struct trapframe *);
-/*
- * Define the code needed before returning to user mode, for
- * trap and syscall.
- */
-static __inline void
-userret(struct proc *p)
-{
- int sig;
-
- /* take pending signals */
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
-
- p->p_cpu->ci_schedstate.spc_curpriority = p->p_priority = p->p_usrpri;
-}
-
char *trap_type[] = {
"privileged instruction fault", /* 0 T_PRIVINFLT */
"breakpoint trap", /* 1 T_BPTFLT */
diff --git a/sys/arch/m68k/include/cpu.h b/sys/arch/m68k/include/cpu.h
index 9bcf12876dc..c88366858b8 100644
--- a/sys/arch/m68k/include/cpu.h
+++ b/sys/arch/m68k/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.24 2011/11/01 21:20:55 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.25 2011/11/16 20:50:18 deraadt Exp $ */
/* $NetBSD: cpu.h,v 1.3 1997/02/02 06:56:57 thorpej Exp $ */
/*
@@ -239,9 +239,6 @@ void savectx(struct pcb *);
int suline(caddr_t, caddr_t);
void switch_exit(struct proc *);
-/* m68k_machdep.c */
-void userret(struct proc *);
-
/* regdump.c */
void regdump(struct trapframe *, int);
diff --git a/sys/arch/m88k/m88k/trap.c b/sys/arch/m88k/m88k/trap.c
index 542065c3533..9ebdf92aba3 100644
--- a/sys/arch/m88k/m88k/trap.c
+++ b/sys/arch/m88k/m88k/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.78 2011/07/11 15:40:47 guenther Exp $ */
+/* $OpenBSD: trap.c,v 1.79 2011/11/16 20:50:18 deraadt Exp $ */
/*
* Copyright (c) 2004, Miodrag Vallat.
* Copyright (c) 1998 Steve Murphree, Jr.
@@ -119,18 +119,6 @@ const char *pbus_exception_type[] = {
};
#endif
-static inline void
-userret(struct proc *p)
-{
- int sig;
-
- /* take pending signals */
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
-
- curcpu()->ci_schedstate.spc_curpriority = p->p_priority = p->p_usrpri;
-}
-
void
printtrap(int type, struct trapframe *frame)
{
diff --git a/sys/arch/mac68k/mac68k/trap.c b/sys/arch/mac68k/mac68k/trap.c
index 59bf6afbb93..72dd8884573 100644
--- a/sys/arch/mac68k/mac68k/trap.c
+++ b/sys/arch/mac68k/mac68k/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.60 2011/07/05 04:48:01 guenther Exp $ */
+/* $OpenBSD: trap.c,v 1.61 2011/11/16 20:50:18 deraadt Exp $ */
/* $NetBSD: trap.c,v 1.68 1998/12/22 08:47:07 scottr Exp $ */
/*
@@ -145,36 +145,13 @@ static void dumpwb(int, u_short, u_int, u_int);
#endif
#endif
-/*
- * Trap and syscall both need the following work done before returning
- * to user mode.
- */
-void
-userret(struct proc *p)
-{
- int sig;
-
- /* take pending signals */
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
- curcpu()->ci_schedstate.spc_curpriority = p->p_priority = p->p_usrpri;
-}
-
#ifdef M68040
/*
- * Same as above, but also handles writeback completion on 68040.
+ * Handle writeback completion on 68040.
*/
void
wb_userret(struct proc *p, struct frame *fp)
{
- int sig;
- union sigval sv;
-
- /* take pending signals */
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
- p->p_priority = p->p_usrpri;
-
/*
* Deal with user mode writebacks (from trap, or from sigreturn).
* If any writeback fails, go back and attempt signal delivery
@@ -184,16 +161,16 @@ wb_userret(struct proc *p, struct frame *fp)
* the writebacks. Maybe we should just drop the sucker?
*/
if (mmutype == MMU_68040 && fp->f_format == FMT7) {
+ int sig;
+ union sigval sv;
+
if ((sig = writeback(fp)) != 0) {
sv.sival_ptr = (void *)fp->f_fmt7.f_fa;
trapsignal(p, sig, T_MMUFLT, SEGV_MAPERR, sv);
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
- p->p_priority = p->p_usrpri;
+ userret(p);
}
}
- curcpu()->ci_schedstate.spc_curpriority = p->p_priority;
}
#endif
@@ -580,10 +557,9 @@ copyfault:
out:
if ((type & T_USER) == 0)
return;
+ userret(p);
#ifdef M68040
wb_userret(p, &frame);
-#else
- userret(p);
#endif
}
diff --git a/sys/arch/mips64/mips64/trap.c b/sys/arch/mips64/mips64/trap.c
index 391f1467447..d906010b49a 100644
--- a/sys/arch/mips64/mips64/trap.c
+++ b/sys/arch/mips64/mips64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.76 2011/07/11 15:40:47 guenther Exp $ */
+/* $OpenBSD: trap.c,v 1.77 2011/11/16 20:50:19 deraadt Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -141,18 +141,6 @@ int ptrace_write_insn(struct proc *, vaddr_t, uint32_t);
int process_sstep(struct proc *, int);
#endif
-static __inline__ void
-userret(struct proc *p)
-{
- int sig;
-
- /* take pending signals */
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
-
- p->p_cpu->ci_schedstate.spc_curpriority = p->p_priority = p->p_usrpri;
-}
-
/*
* Handle an AST for the current process.
*/
diff --git a/sys/arch/mvme68k/mvme68k/trap.c b/sys/arch/mvme68k/mvme68k/trap.c
index 17d55cb7b99..01ae2c3b22f 100644
--- a/sys/arch/mvme68k/mvme68k/trap.c
+++ b/sys/arch/mvme68k/mvme68k/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.74 2011/07/05 04:48:01 guenther Exp $ */
+/* $OpenBSD: trap.c,v 1.75 2011/11/16 20:50:19 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -156,36 +156,13 @@ void hardintr(int, int, void *);
int writeback(struct frame *);
void wb_userret(struct proc *, struct frame *);
-/*
- * trap and syscall both need the following work done before returning
- * to user mode.
- */
-void
-userret(struct proc *p)
-{
- int sig;
-
- /* take pending signals */
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
- curcpu()->ci_schedstate.spc_curpriority = p->p_priority = p->p_usrpri;
-}
-
#ifdef M68040
/*
- * Same as above, but also handles writeback completion on 68040.
+ * Handle writeback completion on 68040.
*/
void
wb_userret(struct proc *p, struct frame *fp)
{
- int sig;
- union sigval sv;
-
- /* take pending signals */
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
- p->p_priority = p->p_usrpri;
-
/*
* Deal with user mode writebacks (from trap, or from sigreturn).
* If any writeback fails, go back and attempt signal delivery.
@@ -195,16 +172,16 @@ wb_userret(struct proc *p, struct frame *fp)
* the writebacks. Maybe we should just drop the sucker?
*/
if (mmutype == MMU_68040 && fp->f_format == FMT7) {
+ int sig;
+ union sigval sv;
+
if ((sig = writeback(fp)) != 0) {
sv.sival_int = fp->f_fmt7.f_fa;
trapsignal(p, sig, T_MMUFLT, SEGV_MAPERR, sv);
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
- p->p_priority = p->p_usrpri;
+ userret(p);
}
}
- curcpu()->ci_schedstate.spc_curpriority = p->p_priority;
}
#endif
@@ -529,10 +506,9 @@ copyfault:
out:
if ((type & T_USER) == 0)
return;
+ userret(p);
#ifdef M68040
wb_userret(p, &frame);
-#else
- userret(p);
#endif
}
diff --git a/sys/arch/powerpc/powerpc/trap.c b/sys/arch/powerpc/powerpc/trap.c
index 9ddf7d9db64..e6e595a590a 100644
--- a/sys/arch/powerpc/powerpc/trap.c
+++ b/sys/arch/powerpc/powerpc/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.88 2011/07/30 20:50:47 deraadt Exp $ */
+/* $OpenBSD: trap.c,v 1.89 2011/11/16 20:50:19 deraadt Exp $ */
/* $NetBSD: trap.c,v 1.3 1996/10/13 03:31:37 christos Exp $ */
/*
@@ -63,7 +63,6 @@
static int fix_unaligned(struct proc *p, struct trapframe *frame);
int badaddr(char *addr, u_int32_t len);
-static __inline void userret(struct proc *);
void trap(struct trapframe *frame);
/* These definitions should probably be somewhere else XXX */
@@ -246,17 +245,6 @@ enable_vec(struct proc *p)
}
#endif /* ALTIVEC */
-static __inline void
-userret(struct proc *p)
-{
- int sig;
-
- /* take pending signals */
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
- curcpu()->ci_schedstate.spc_curpriority = p->p_priority;
-}
-
void
trap(struct trapframe *frame)
{
diff --git a/sys/arch/sh/include/userret.h b/sys/arch/sh/include/userret.h
deleted file mode 100644
index f67a2a22d63..00000000000
--- a/sys/arch/sh/include/userret.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* $OpenBSD: userret.h,v 1.2 2007/05/14 07:05:49 art Exp $ */
-/* $NetBSD: userret.h,v 1.9 2006/02/16 20:17:15 perry Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: trap.c 1.32 91/04/06
- *
- * @(#)trap.c 8.5 (Berkeley) 1/11/94
- */
-/*
- * Copyright (c) 1988 University of Utah.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: trap.c 1.32 91/04/06
- *
- * @(#)trap.c 8.5 (Berkeley) 1/11/94
- */
-
-#include <sys/signalvar.h>
-#include <machine/cpu.h>
-
-static __inline void userret(struct proc *);
-
-static __inline void
-userret(struct proc *p)
-{
- int sig;
-
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
-
- p->p_cpu->ci_schedstate.spc_curpriority = p->p_priority = p->p_usrpri;
-}
diff --git a/sys/arch/sh/sh/trap.c b/sys/arch/sh/sh/trap.c
index 74ec6a38315..20125ae34a6 100644
--- a/sys/arch/sh/sh/trap.c
+++ b/sys/arch/sh/sh/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.17 2011/04/03 14:56:28 guenther Exp $ */
+/* $OpenBSD: trap.c,v 1.18 2011/11/16 20:50:19 deraadt Exp $ */
/* $NetBSD: exception.c,v 1.32 2006/09/04 23:57:52 uwe Exp $ */
/* $NetBSD: syscall.c,v 1.6 2006/03/07 07:21:50 thorpej Exp $ */
@@ -87,6 +87,7 @@
#include <sys/kernel.h>
#include <sys/signal.h>
#include <sys/resourcevar.h>
+#include <sys/signalvar.h>
#include <sys/syscall.h>
#ifdef KTRACE
@@ -105,7 +106,6 @@
#include <sh/mmu.h>
#include <sh/pcb.h>
#include <sh/trap.h>
-#include <sh/userret.h>
#ifdef SH4
#include <sh/fpu.h>
#endif
@@ -485,8 +485,8 @@ ast(struct proc *p, struct trapframe *tf)
KDASSERT(p->p_md.md_regs == tf);
while (p->p_md.md_astpending) {
- uvmexp.softs++;
p->p_md.md_astpending = 0;
+ uvmexp.softs++;
if (p->p_flag & P_OWEUPC) {
ADDUPROF(p);
diff --git a/sys/arch/solbourne/solbourne/trap.c b/sys/arch/solbourne/solbourne/trap.c
index 3ad5596e92f..e894d945582 100644
--- a/sys/arch/solbourne/solbourne/trap.c
+++ b/sys/arch/solbourne/solbourne/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.13 2011/07/04 22:53:53 tedu Exp $ */
+/* $OpenBSD: trap.c,v 1.14 2011/11/16 20:50:19 deraadt Exp $ */
/* OpenBSD: trap.c,v 1.42 2004/12/06 20:12:25 miod Exp */
/*
@@ -199,7 +199,6 @@ const char *trap_type[] = {
#define N_TRAP_TYPES (sizeof trap_type / sizeof *trap_type)
-static __inline void userret(struct proc *);
void trap(unsigned, int, int, struct trapframe *);
static __inline void share_fpu(struct proc *, struct trapframe *);
void mem_access_fault(unsigned, int, u_int, int, int, struct trapframe *);
@@ -209,21 +208,6 @@ void syscall(register_t, struct trapframe *, register_t);
int ignore_bogus_traps = 0;
int want_ast = 0;
-/*
- * Define the code needed before returning to user mode, for
- * trap, mem_access_fault, and syscall.
- */
-static __inline void
-userret(struct proc *p)
-{
- int sig;
-
- /* take pending signals */
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
-
- p->p_cpu->ci_schedstate.spc_curpriority = p->p_priority = p->p_usrpri;
-}
/*
* If someone stole the FPU while we were away, do not enable it
diff --git a/sys/arch/sparc/sparc/trap.c b/sys/arch/sparc/sparc/trap.c
index 5bcb7a06399..7fd71976303 100644
--- a/sys/arch/sparc/sparc/trap.c
+++ b/sys/arch/sparc/sparc/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.57 2011/07/04 22:53:53 tedu Exp $ */
+/* $OpenBSD: trap.c,v 1.58 2011/11/16 20:50:19 deraadt Exp $ */
/* $NetBSD: trap.c,v 1.58 1997/09/12 08:55:01 pk Exp $ */
/*
@@ -196,7 +196,6 @@ const char *trap_type[] = {
#define N_TRAP_TYPES (sizeof trap_type / sizeof *trap_type)
-static __inline void userret(struct proc *);
void trap(unsigned, int, int, struct trapframe *);
static __inline void share_fpu(struct proc *, struct trapframe *);
void mem_access_fault(unsigned, int, u_int, int, int, struct trapframe *);
@@ -206,21 +205,6 @@ void syscall(register_t, struct trapframe *, register_t);
int ignore_bogus_traps = 0;
int want_ast = 0;
-/*
- * Define the code needed before returning to user mode, for
- * trap, mem_access_fault, and syscall.
- */
-static __inline void
-userret(struct proc *p)
-{
- int sig;
-
- /* take pending signals */
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
-
- p->p_cpu->ci_schedstate.spc_curpriority = p->p_priority = p->p_usrpri;
-}
/*
* If someone stole the FPU while we were away, do not enable it
diff --git a/sys/arch/sparc64/sparc64/trap.c b/sys/arch/sparc64/sparc64/trap.c
index 29fd687123b..453436bb724 100644
--- a/sys/arch/sparc64/sparc64/trap.c
+++ b/sys/arch/sparc64/sparc64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.73 2011/07/11 15:40:47 guenther Exp $ */
+/* $OpenBSD: trap.c,v 1.74 2011/11/16 20:50:19 deraadt Exp $ */
/* $NetBSD: trap.c,v 1.73 2001/08/09 01:03:01 eeh Exp $ */
/*
@@ -314,7 +314,6 @@ const char *trap_type[] = {
#define N_TRAP_TYPES (sizeof trap_type / sizeof *trap_type)
-static __inline void userret(struct proc *);
static __inline void share_fpu(struct proc *, struct trapframe64 *);
void trap(struct trapframe64 *tf, unsigned type, vaddr_t pc, long tstate);
@@ -329,22 +328,6 @@ void text_access_error(struct trapframe64 *tf, unsigned type,
void syscall(struct trapframe64 *, register_t code, register_t pc);
/*
- * Define the code needed before returning to user mode, for
- * trap, mem_access_fault, and syscall.
- */
-static __inline void
-userret(struct proc *p)
-{
- int sig;
-
- /* take pending signals */
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
-
- curcpu()->ci_schedstate.spc_curpriority = p->p_priority = p->p_usrpri;
-}
-
-/*
* If someone stole the FPU while we were away, do not enable it
* on return. This is not done in userret() above as it must follow
* the ktrsysret() in syscall(). Actually, it is likely that the
diff --git a/sys/arch/vax/vax/trap.c b/sys/arch/vax/vax/trap.c
index e6e599a1000..b25427c945c 100644
--- a/sys/arch/vax/vax/trap.c
+++ b/sys/arch/vax/vax/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.41 2011/04/03 14:56:28 guenther Exp $ */
+/* $OpenBSD: trap.c,v 1.42 2011/11/16 20:50:19 deraadt Exp $ */
/* $NetBSD: trap.c,v 1.47 1999/08/21 19:26:20 matt Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -64,8 +64,6 @@
volatile int startsysc = 0, faultdebug = 0;
#endif
-static __inline void userret(struct proc *);
-
void arithflt(struct trapframe *);
void syscall(struct trapframe *);
@@ -100,24 +98,6 @@ int no_traps = 18;
return; \
} while (0)
-/*
- * userret:
- *
- * Common code used by various exception handlers to
- * return to usermode.
- */
-static __inline void
-userret(struct proc *p)
-{
- int sig;
-
- /* Take pending signals. */
- while ((sig = CURSIG(p)) !=0)
- postsig(sig);
-
- p->p_cpu->ci_schedstate.spc_curpriority = p->p_priority = p->p_usrpri;
-}
-
void
arithflt(frame)
struct trapframe *frame;
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index e1091a507a6..360443f08c5 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sig.c,v 1.128 2011/11/09 20:57:38 guenther Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.129 2011/11/16 20:50:19 deraadt Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
@@ -1622,3 +1622,14 @@ filt_signal(struct knote *kn, long hint)
}
return (kn->kn_data != 0);
}
+
+void
+userret(struct proc *p)
+{
+ int sig;
+
+ while ((sig = CURSIG(p)) != 0)
+ postsig(sig);
+
+ p->p_cpu->ci_schedstate.spc_curpriority = p->p_priority = p->p_usrpri;
+}
diff --git a/sys/sys/sched.h b/sys/sys/sched.h
index fc2d3a54de1..16512054428 100644
--- a/sys/sys/sched.h
+++ b/sys/sys/sched.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sched.h,v 1.29 2011/07/07 18:00:33 guenther Exp $ */
+/* $OpenBSD: sched.h,v 1.30 2011/11/16 20:50:19 deraadt Exp $ */
/* $NetBSD: sched.h,v 1.2 1999/02/28 18:14:58 ross Exp $ */
/*-
@@ -138,6 +138,7 @@ struct cpu_info;
void roundrobin(struct cpu_info *);
void scheduler_start(void);
void updatepri(struct proc *);
+void userret(struct proc *p);
void sched_init_cpu(struct cpu_info *);
void sched_idle(void *);