register struct proc *p; register struct frame *fp;
struct proc *p; struct frame *fp;
userret(p, fp, oticks, faultaddr, fromtrap)	register struct proc *p;	register struct frame *fp;	u_quad_t oticks;	u_int faultaddr;	int fromtrap;{	int sig, s;#if defined(M68040)	int beenhere = 0;again:#endif	/* take pending signals */	while ((sig = CURSIG(p)) != 0)		postsig(sig);	p->p_priority = p->p_usrpri;	if (want_resched) {		/*		 * Since we are curproc, clock will normally just change		 * our priority without moving us from one queue to another		 * (since the running process is not on a queue.)		 * If that happened after we setrunqueue ourselves but before		 * we switch'ed, we might not be on the queue indicated by		 * our priority.		 */		s = splstatclock();		setrunqueue(p);		p->p_stats->p_ru.ru_nivcsw++;		mi_switch();		splx(s);		while ((sig = CURSIG(p)) != 0)			postsig(sig);	}	/*	 * If profiling, charge recent system time.	 */	if (p->p_flag & P_PROFIL) {		extern int psratio;				addupc_task(p, fp->f_pc,		    (int)(p->p_sticks - oticks) * psratio);	}#if defined(M68040)	/*	 * Deal with user mode writebacks (from trap, or from sigreturn).	 * If any writeback fails, go back and attempt signal delivery	 * unless we have already been here and attempted the writeback	 * (e.g. bad address with user ignoring SIGSEGV).  In that case,	 * we just return to the user without successfully completing	 * the writebacks.  Maybe we should just drop the sucker?	 */	if (mmutype == MMU_68040 && fp->f_format == FMT7) {		if (beenhere) {#if DEBUG			if (mmudebug & MDB_WBFAILED)				printf(fromtrap ?		"pid %d(%s): writeback aborted, pc=%x, fa=%x\n" :		"pid %d(%s): writeback aborted in sigreturn, pc=%x\n",				    p->p_pid, p->p_comm, fp->f_pc, faultaddr);#endif		} else if ((sig = writeback(fp, fromtrap))) {			beenhere = 1;			oticks = p->p_sticks;			trapsignal(p, sig, VM_PROT_WRITE, SEGV_MAPERR,					(caddr_t)faultaddr);			goto again;		}	}#endif	curpriority = p->p_priority;}