Module Name:    src
Committed By:   pgoyette
Date:           Sat Sep 29 09:44:53 UTC 2018

Modified Files:
        src/sys/arch/mips/mips [pgoyette-compat]: netbsd32_machdep_16.c

Log Message:
Remove netbsd32_sendsig_sigcontext() - it belongs in netbsd32_machdep.c


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/arch/mips/mips/netbsd32_machdep_16.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mips/mips/netbsd32_machdep_16.c
diff -u src/sys/arch/mips/mips/netbsd32_machdep_16.c:1.1.2.4 src/sys/arch/mips/mips/netbsd32_machdep_16.c:1.1.2.5
--- src/sys/arch/mips/mips/netbsd32_machdep_16.c:1.1.2.4	Sat Sep 29 07:47:46 2018
+++ src/sys/arch/mips/mips/netbsd32_machdep_16.c	Sat Sep 29 09:44:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep_16.c,v 1.1.2.4 2018/09/29 07:47:46 pgoyette Exp $	*/
+/*	$NetBSD: netbsd32_machdep_16.c,v 1.1.2.5 2018/09/29 09:44:53 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep_16.c,v 1.1.2.4 2018/09/29 07:47:46 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep_16.c,v 1.1.2.5 2018/09/29 09:44:53 pgoyette Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_coredump.h"
@@ -67,10 +67,10 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_mac
 
 #include <uvm/uvm_extern.h>
 
-void netbsd32_sendsig_siginfo(const ksiginfo_t *, const sigset_t *);
-
 int netbsd32_sendsig_16(const ksiginfo_t *, const sigset_t *);
 
+void sendsig_context(const ksiginfo_t *, const sigset_t *);
+
 extern struct netbsd32_sendsig_hook_t netbsd32_sendsig_hook;
 
 int
@@ -85,89 +85,6 @@ compat_16_netbsd32___sigreturn14(struct 
 	return compat_16_sys___sigreturn14(l, &ua, retval);
 }
 
-struct sigframe_siginfo32 {
-	siginfo32_t sf_si;
-	ucontext32_t sf_uc;
-};
-
-/*
- * Send a signal to process.
- */
-static void
-netbsd32_sendsig_sigcontext(const ksiginfo_t *ksi, const sigset_t *mask)
-{
-	struct lwp * const l = curlwp;
-	struct proc * const p = l->l_proc;
-	struct sigacts * const ps = p->p_sigacts;
-	int onstack, error;
-	int sig = ksi->ksi_signo;
-	struct sigframe_siginfo32 *sfp = getframe(l, sig, &onstack);
-	struct sigframe_siginfo32 sf;
-	struct trapframe * const tf = l->l_md.md_utf;
-	size_t sfsz;
-	sig_t catcher = SIGACTION(p, sig).sa_handler;
-
-	sfp--;
-
-	netbsd32_si_to_si32(&sf.sf_si, (const siginfo_t *)&ksi->ksi_info);
-
-        /* Build stack frame for signal trampoline. */
-        switch (ps->sa_sigdesc[sig].sd_vers) {
-        case 0:         /* handled by sendsig_sigcontext */
-        case 1:         /* handled by sendsig_sigcontext */
-        default:        /* unknown version */
-                printf("%s: bad version %d\n", __func__,
-                    ps->sa_sigdesc[sig].sd_vers);
-                sigexit(l, SIGILL);
-        case 2:
-                break;
-        }
-
-	sf.sf_uc.uc_flags = _UC_SIGMASK
-	    | ((l->l_sigstk.ss_flags & SS_ONSTACK)
-	    ? _UC_SETSTACK : _UC_CLRSTACK);
-	sf.sf_uc.uc_sigmask = *mask;
-	sf.sf_uc.uc_link = (intptr_t)l->l_ctxlink;
-	memset(&sf.sf_uc.uc_stack, 0, sizeof(sf.sf_uc.uc_stack));
-	sfsz = offsetof(struct sigframe_siginfo32, sf_uc.uc_mcontext);
-	if (p->p_md.md_abi == _MIPS_BSD_API_O32)
-		sfsz += sizeof(mcontext_o32_t);
-	else
-		sfsz += sizeof(mcontext32_t);
-	sendsig_reset(l, sig);
-	mutex_exit(p->p_lock);
-	cpu_getmcontext32(l, &sf.sf_uc.uc_mcontext, &sf.sf_uc.uc_flags);
-	error = copyout(&sf, sfp, sfsz);
-	mutex_enter(p->p_lock);
-
-	if (error != 0) {
-		/*
-		 * Process has trashed its stack; give it an illegal
-		 * instruction to halt it in its tracks.
-		 */
-		sigexit(l, SIGILL);
-		/* NOTREACHED */
-	}
-
-	/*
-	 * Set up the registers to directly invoke the signal
-	 * handler.  The return address will be set up to point
-	 * to the signal trampoline to bounce us back.
-	 */
-	tf->tf_regs[_R_A0] = sig;
-	tf->tf_regs[_R_A1] = (intptr_t)&sfp->sf_si;
-	tf->tf_regs[_R_A2] = (intptr_t)&sfp->sf_uc;
-
-	tf->tf_regs[_R_PC] = (intptr_t)catcher;
-	tf->tf_regs[_R_T9] = (intptr_t)catcher;
-	tf->tf_regs[_R_SP] = (intptr_t)sfp;
-	tf->tf_regs[_R_RA] = (intptr_t)ps->sa_sigdesc[sig].sd_tramp;
-
-	/* Remember that we're now on the signal stack. */
-	if (onstack)
-		l->l_sigstk.ss_flags |= SS_ONSTACK;
-}
-
 int
 netbsd32_sendsig_16(const ksiginfo_t *ksi, const sigset_t *mask)
 {               

Reply via email to