Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Mar 2012 08:10:48 +0000 (UTC)
From:      Juli Mallett <jmallett@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r232586 - head/sys/mips/mips
Message-ID:  <201203060810.q268Amin027064@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jmallett
Date: Tue Mar  6 08:10:48 2012
New Revision: 232586
URL: http://svn.freebsd.org/changeset/base/232586

Log:
  Make the native sigreturn just wrap set_mcontext, much as freebsd32_sigreturn
  does.

Modified:
  head/sys/mips/mips/pm_machdep.c

Modified: head/sys/mips/mips/pm_machdep.c
==============================================================================
--- head/sys/mips/mips/pm_machdep.c	Tue Mar  6 08:02:10 2012	(r232585)
+++ head/sys/mips/mips/pm_machdep.c	Tue Mar  6 08:10:48 2012	(r232586)
@@ -216,51 +216,22 @@ cpu_thread_siginfo(int sig, u_long code,
 int
 sys_sigreturn(struct thread *td, struct sigreturn_args *uap)
 {
-	struct trapframe *regs;
-	ucontext_t *ucp;
 	ucontext_t uc;
 	int error;
 
-	ucp = &uc;
-
 	error = copyin(uap->sigcntxp, &uc, sizeof(uc));
 	if (error != 0)
 	    return (error);
 
-	regs = td->td_frame;
-
-/* #ifdef DEBUG */
-	if (ucp->uc_mcontext.mc_regs[ZERO] != UCONTEXT_MAGIC) {
-		printf("sigreturn: pid %d, ucp %p\n", td->td_proc->p_pid, ucp);
-		printf("  old sp %p ra %p pc %p\n",
-		    (void *)(intptr_t)regs->sp, (void *)(intptr_t)regs->ra, (void *)(intptr_t)regs->pc);
-		printf("  new sp %p ra %p pc %p z %p\n",
-		    (void *)(intptr_t)ucp->uc_mcontext.mc_regs[SP],
-		    (void *)(intptr_t)ucp->uc_mcontext.mc_regs[RA],
-		    (void *)(intptr_t)ucp->uc_mcontext.mc_regs[PC],
-		    (void *)(intptr_t)ucp->uc_mcontext.mc_regs[ZERO]);
-		return EINVAL;
-	}
-/* #endif */
-
-	bcopy((const void *)&ucp->uc_mcontext.mc_regs[1], (void *)&regs->ast,
-	    sizeof(ucp->uc_mcontext.mc_regs) - sizeof(register_t));
-
-	if (ucp->uc_mcontext.mc_fpused)
-		bcopy((const void *)ucp->uc_mcontext.mc_fpregs,
-		    (void *)&td->td_frame->f0,
-		    sizeof(ucp->uc_mcontext.mc_fpregs));
-
-	regs->pc = ucp->uc_mcontext.mc_pc;
-	regs->mullo = ucp->uc_mcontext.mullo;
-	regs->mulhi = ucp->uc_mcontext.mulhi;
+	error = set_mcontext(td, &uc.uc_mcontext);
+	if (error != 0)
+		return (error);
 
-	kern_sigprocmask(td, SIG_SETMASK, &ucp->uc_sigmask, NULL, 0);
+	kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0);
 
-	return(EJUSTRETURN);
+	return (EJUSTRETURN);
 }
 
-
 int
 ptrace_set_pc(struct thread *td, unsigned long addr)
 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203060810.q268Amin027064>