diff --git a/sys/sparc64/sparc64/machdep.c b/sys/sparc64/sparc64/machdep.c index e5248b7d7b0d..60f271acb040 100644 --- a/sys/sparc64/sparc64/machdep.c +++ b/sys/sparc64/sparc64/machdep.c @@ -464,14 +464,12 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) int oonstack; u_long sp; int sig; - int code; oonstack = 0; td = curthread; p = td->td_proc; PROC_LOCK_ASSERT(p, MA_OWNED); sig = ksi->ksi_signo; - code = ksi->ksi_code; psp = p->p_sigacts; mtx_assert(&psp->ps_mtx, MA_OWNED); tf = td->td_frame; @@ -484,7 +482,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) /* Make sure we have a signal trampoline to return to. */ if (p->p_md.md_sigtramp == NULL) { /* - * No signal tramoline... kill the process. + * No signal trampoline... kill the process. */ CTR0(KTR_SIG, "sendsig: no sigtramp"); printf("sendsig: %s is too old, rebuild it\n", p->p_comm); @@ -518,12 +516,20 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) /* Build the argument list for the signal handler. */ tf->tf_out[0] = sig; - tf->tf_out[1] = (register_t)&sfp->sf_si; tf->tf_out[2] = (register_t)&sfp->sf_uc; tf->tf_out[4] = (register_t)catcher; - /* Fill siginfo structure. */ - sf.sf_si = ksi->ksi_info; - sf.sf_si.si_addr = (void *)tf->tf_sfar; /* XXX */ + if (SIGISMEMBER(psp->ps_siginfo, sig)) { + /* Signal handler installed with SA_SIGINFO. */ + tf->tf_out[1] = (register_t)&sfp->sf_si; + + /* Fill in POSIX parts. */ + sf.sf_si = ksi->ksi_info; + sf.sf_si.si_signo = sig; /* maybe a translated signal */ + } else { + /* Old FreeBSD-style arguments. */ + tf->tf_out[1] = ksi->ksi_code; + tf->tf_out[3] = (register_t)ksi->ksi_addr; + } /* Copy the sigframe out to the user's stack. */ if (rwindow_save(td) != 0 || copyout(&sf, sfp, sizeof(*sfp)) != 0 || diff --git a/sys/sparc64/sparc64/trap.c b/sys/sparc64/sparc64/trap.c index 72ddf9a586a3..4cbbbad9b0bb 100644 --- a/sys/sparc64/sparc64/trap.c +++ b/sys/sparc64/sparc64/trap.c @@ -37,9 +37,11 @@ * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 * from: FreeBSD: src/sys/i386/i386/trap.c,v 1.197 2001/07/19 - * $FreeBSD$ */ +#include +__FBSDID("$FreeBSD$"); + #include "opt_ddb.h" #include "opt_ktr.h" #include "opt_ktrace.h" @@ -165,7 +167,7 @@ const char *trap_msg[] = { "kernel stack fault", }; -const int trap_sig[] = { +static const int trap_sig[] = { SIGILL, /* reserved */ SIGILL, /* instruction access exception */ SIGILL, /* instruction access error */ @@ -233,6 +235,7 @@ trap(struct trapframe *tf) struct proc *p; int error; int sig; + register_t addr; ksiginfo_t ksi; td = PCPU_GET(curthread); @@ -250,12 +253,15 @@ trap(struct trapframe *tf) p = td->td_proc; td->td_pticks = 0; td->td_frame = tf; + addr = tf->tf_tpc; if (td->td_ucred != p->p_ucred) cred_update_thread(td); switch (tf->tf_type) { case T_DATA_MISS: case T_DATA_PROTECTION: + addr = tf->tf_sfar; + /* FALLTHROUGH */ case T_INSTRUCTION_MISS: sig = trap_pfault(td, tf); break; @@ -288,7 +294,7 @@ trap(struct trapframe *tf) ksiginfo_init_trap(&ksi); ksi.ksi_signo = sig; ksi.ksi_code = (int)tf->tf_type; /* XXX not POSIX */ - /* ksi.ksi_addr = ? */ + ksi.ksi_addr = (void *)addr; ksi.ksi_trapno = (int)tf->tf_type; trapsignal(td, &ksi); }