move "siginfo_t *" to 2nd arg of signal handler as 1003.1b requires.
I really wish I had 1003.1b documentation.
-/* $OpenBSD: machdep.c,v 1.16 1997/02/03 13:09:14 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.17 1997/02/03 15:05:02 deraadt Exp $ */
/* $NetBSD: machdep.c,v 1.61 1996/12/07 01:54:49 cgd Exp $ */
/*
struct sigcontext *scp, ksc;
struct trapframe *frame;
struct sigacts *psp = p->p_sigacts;
- int oonstack, fsize, rndfsize;
+ int oonstack, fsize, rndfsize, kscsize;
extern char sigcode[], esigcode[];
extern struct proc *fpcurproc;
+ siginfo_t *sip, ksi;
frame = p->p_md.md_tf;
oonstack = psp->ps_sigstk.ss_flags & SS_ONSTACK;
fsize = sizeof ksc;
rndfsize = ((fsize + 15) / 16) * 16;
+ kscsize = rndfsize;
+ if (psp->ps_siginfo & sigmask(sig)) {
+ fsize += sizeof ksi;
+ rndfsize = ((fsize + 15) / 16) * 16;
+ }
/*
* Allocate and validate space for the signal handler
* context. Note that if the stack is in P0 space, the
*/
#endif
+ if (psp->ps_siginfo & sigmask(sig)) {
+ initsiginfo(&ksi, sig, code, type, val);
+ sip = (void *)scp + kscsize;
+ (void) copyout((caddr_t)&ksi, (caddr_t)sip, fsize - kscsize);
+ }
+
/*
* copy the frame out to userland.
*/
- (void) copyout((caddr_t)&ksc, (caddr_t)scp, fsize);
+ (void) copyout((caddr_t)&ksc, (caddr_t)scp, kscsize);
#ifdef DEBUG
if (sigdebug & SDB_FOLLOW)
printf("sendsig(%d): sig %d scp %p code %lx\n", p->p_pid, sig,
frame->tf_regs[FRAME_PC] =
(u_int64_t)PS_STRINGS - (esigcode - sigcode);
frame->tf_regs[FRAME_A0] = sig;
- frame->tf_regs[FRAME_A1] = code;
+ frame->tf_regs[FRAME_A1] = (psp->ps_siginfo & sigmask(sig)) ?
+ (u_int64_t)sip : NULL;
frame->tf_regs[FRAME_A2] = (u_int64_t)scp;
frame->tf_regs[FRAME_T12] = (u_int64_t)catcher; /* t12 is pv */
alpha_pal_wrusp((unsigned long)scp);
-/* $OpenBSD: locore.s,v 1.14 1997/02/03 11:38:05 deraadt Exp $ */
+/* $OpenBSD: locore.s,v 1.15 1997/02/03 15:05:04 deraadt Exp $ */
/* $NetBSD: locore.s,v 1.72 1996/12/17 11:09:10 is Exp $ */
/*
* Stack looks like:
*
* sp+0 -> signal number
- * sp+4 signal specific code
+ * sp+4 pointer to siginfo (sip)
* sp+8 pointer to signal context frame (scp)
- * sp+12 pointer to siginfo (sip)
* sp+16 address of handler
* sp+30 saved hardware state
* .
.globl _sigcode, _esigcode
.data
_sigcode:
- movl sp@(16),a0 | signal handler addr (4 bytes)
+ movl sp@(12),a0 | signal handler addr (4 bytes)
jsr a0@ | call signal handler (2 bytes)
addql #4,sp | pop signo (2 bytes)
trap #1 | special syscall entry (2 bytes)
-/* $OpenBSD: machdep.c,v 1.20 1997/02/03 12:48:35 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.21 1997/02/03 15:05:06 deraadt Exp $ */
/* $NetBSD: machdep.c,v 1.82 1996/12/17 07:32:54 is Exp $ */
/*
*/
struct sigframe {
int sf_signum; /* signo for handler */
- int sf_code; /* additional info for handler */
+ siginfo_t *sf_sip; /* pointer to siginfo_t */
struct sigcontext *sf_scp; /* context ptr for handler */
- siginfo_t *sf_sip;
sig_t sf_handler; /* handler addr for u_sigc */
struct sigstate sf_state; /* state of the hardware */
struct sigcontext sf_sc; /* actual context */
- siginfo_t sf_si;
+ siginfo_t sf_si; /* actual siginfo_t */
};
#ifdef DEBUG
* Build the argument list for the signal handler.
*/
kfp->sf_signum = sig;
- kfp->sf_code = code;
+ kfp->sf_sip = NULL;
kfp->sf_scp = &fp->sf_sc;
kfp->sf_handler = catcher;
/*
-/* $OpenBSD: machdep.c,v 1.19 1997/02/02 00:47:42 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.20 1997/02/03 15:05:08 deraadt Exp $ */
/*
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1992, 1993
* SUCH DAMAGE.
*
* from: @(#)machdep.c 8.3 (Berkeley) 1/12/94
- * $Id: machdep.c,v 1.19 1997/02/02 00:47:42 deraadt Exp $
+ * $Id: machdep.c,v 1.20 1997/02/03 15:05:08 deraadt Exp $
*/
/* from: Utah Hdr: machdep.c 1.63 91/04/24 */
*/
struct sigframe {
int sf_signum; /* signo for handler */
- int sf_code; /* additional info for handler */
+ siginfo_t *sf_sip; /* pointer to siginfo_t */
struct sigcontext *sf_scp; /* context ptr for handler */
sig_t sf_handler; /* handler addr for u_sigc */
struct sigcontext sf_sc; /* actual context */
+ siginfo_t sf_si;
};
#ifdef DEBUG
* the space with a `brk'.
*/
fsize = sizeof(struct sigframe);
+ if (!(psp->ps_siginfo & sigmask(sig)))
+ fsize -= sizeof(siginfo_t);
if ((psp->ps_flags & SAS_ALTSTACK) &&
(psp->ps_sigstk.ss_flags & SA_ONSTACK) == 0 &&
(psp->ps_sigonstack & sigmask(sig))) {
bcopy((caddr_t)&p->p_md.md_regs[F0], (caddr_t)ksc.sc_fpregs,
sizeof(ksc.sc_fpregs));
}
+
+ if (psp->ps_siginfo & sigmask(sig)) {
+ siginfo_t si;
+
+ initsiginfo(&si, sig, code, type, val);
+ if (copyout((caddr_t)&si, (caddr_t)&fp->sf_si, sizeof si))
+ goto bail;
+ }
+
if (copyout((caddr_t)&ksc, (caddr_t)&fp->sf_sc, sizeof(ksc))) {
+bail:
/*
* Process has trashed its stack; give it an illegal
* instruction to halt it in its tracks.
* Build the argument list for the signal handler.
*/
regs[A0] = sig;
- regs[A1] = code;
+ regs[A1] = (psp->ps_siginfo & sigmask(sig)) ? (int)&fp->sf_si : NULL;
regs[A2] = (int)&fp->sf_sc;
regs[A3] = (int)catcher;
pushl %esp
incl _cnt+V_TRAP
call _npxintr
- addl $4,%esp
+ addl $8,%esp
INTRFASTEXIT
#else
ZTRAP(T_ARITHTRAP)
-/* $OpenBSD: machdep.c,v 1.40 1997/02/03 12:48:58 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.41 1997/02/03 15:04:50 deraadt Exp $ */
/* $NetBSD: machdep.c,v 1.202 1996/05/18 15:54:59 christos Exp $ */
/*-
fp = (struct sigframe *)tf->tf_esp - 1;
}
- frame.sf_code = code;
frame.sf_scp = &fp->sf_sc;
- frame.sf_handler = catcher;
frame.sf_sip = NULL;
+ frame.sf_handler = catcher;
/*
* Build the signal context to be used by sigreturn.
*/
struct sigframe {
int sf_signum;
- int sf_code;
- struct sigcontext *sf_scp;
siginfo_t *sf_sip;
+ struct sigcontext *sf_scp;
sig_t sf_handler;
struct sigcontext sf_sc;
siginfo_t sf_si;
-/* $OpenBSD: locore.s,v 1.11 1997/01/28 09:01:02 deraadt Exp $ */
+/* $OpenBSD: locore.s,v 1.12 1997/02/03 15:04:57 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
* Stack looks like:
*
* sp+0 -> signal number
- * sp+4 signal specific code
+ * sp+4 pointer to siginfo (sip)
* sp+8 pointer to signal context frame (scp)
- * sp+12 pointer to siginfo (sip)
- * sp+16 address of handler
- * sp+20 saved hardware state
+ * sp+12 address of handler
+ * sp+16 saved hardware state
* .
* .
* scp+0-> beginning of signal context frame
.globl _sigcode, _esigcode, _sigcodetrap
.data
_sigcode:
- movl sp@(16),a0 | signal handler addr (4 bytes)
+ movl sp@(12),a0 | signal handler addr (4 bytes)
jsr a0@ | call signal handler (2 bytes)
addql #4,sp | pop signo (2 bytes)
_sigcodetrap:
-/* $OpenBSD: machdep.c,v 1.17 1997/02/03 12:48:52 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.18 1997/02/03 15:04:58 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
*/
struct sigframe {
int sf_signum; /* signo for handler */
- int sf_code; /* additional info for handler */
- struct sigcontext *sf_scp; /* context ptr for handler */
siginfo_t *sf_sip;
+ struct sigcontext *sf_scp; /* context ptr for handler */
sig_t sf_handler; /* handler addr for u_sigc */
struct sigstate sf_state; /* state of the hardware */
struct sigcontext sf_sc; /* actual context */
* Build the argument list for the signal handler.
*/
kfp->sf_signum = sig;
- kfp->sf_code = code;
+ kfp->sf_sip = NULL;
kfp->sf_scp = &fp->sf_sc;
kfp->sf_handler = catcher;
- kfp->sf_sip = NULL;
/*
* Save necessary hardware state. Currently this includes:
*/
struct sigframe {
int sf_signum; /* signo for handler */
- int sf_code; /* additional info for handler */
+ siginfo_t *sf_sip; /* pointer to siginfo_t */
struct sigcontext *sf_scp; /* context ptr for handler */
sig_t sf_handler; /* handler addr for u_sigc */
struct sigcontext sf_sc; /* actual context */
+ siginfo_t sf_si;
};
#ifdef DEBUG
* the space with a `brk'.
*/
fsize = sizeof(struct sigframe);
+ if (!(psp->ps_siginfo & sigmask(sig)))
+ fsize -= sizeof(siginfo_t);
if ((psp->ps_flags & SAS_ALTSTACK) &&
(psp->ps_sigstk.ss_flags & SS_ONSTACK) == 0 &&
(psp->ps_sigonstack & sigmask(sig))) {
bcopy((caddr_t)&p->p_md.md_regs[F0], (caddr_t)ksc.sc_fpregs,
sizeof(ksc.sc_fpregs));
}
+
+ if (psp->ps_siginfo & sigmask(sig)) {
+ siginfo_t si;
+
+ initsiginfo(&si, sig, code, type, val);
+ if (copyout((caddr_t)&si, (caddr_t)&fp->sf_si, sizeof si))
+ goto bail;
+ }
+
if (copyout((caddr_t)&ksc, (caddr_t)&fp->sf_sc, sizeof(ksc))) {
+bail:
/*
* Process has trashed its stack; give it an illegal
* instruction to halt it in its tracks.
* Build the argument list for the signal handler.
*/
regs[A0] = sig;
- regs[A1] = code;
+ regs[A1] = (psp->ps_siginfo & sigmask(sig)) ? (int)&fp->sf_si : NULL;
regs[A2] = (int)&fp->sf_sc;
regs[A3] = (int)catcher;
* When this code is run, the stack looks like:
* [%sp] 64 bytes to which registers can be dumped
* [%sp + 64] signal number (goes in %o0)
- * [%sp + 64 + 4] signal code (goes in %o1)
+ * [%sp + 64 + 4] siginfo_t pointer (goes in %o1)
* [%sp + 64 + 8] placeholder
* [%sp + 64 + 12] argument for %o3, currently unsupported (always 0)
* [%sp + 64 + 16] first word of saved state (sigcontext)
struct sigframe {
int sf_signo; /* signal number */
- int sf_code; /* code */
+ siginfo_t *sf_sip; /* points to siginfo_t */
#ifdef COMPAT_SUNOS
struct sigcontext *sf_scp; /* points to user addr of sigcontext */
#else
int sf_xxx; /* placeholder */
#endif
- union {
- caddr_t sfu_addr; /* SunOS compat */
- siginfo_t *sfu_sip; /* native */
- } sf_u;
+ caddr_t sf_addr; /* SunOS compat */
struct sigcontext sf_sc; /* actual sigcontext */
siginfo_t sf_si;
};
* directly in user space....
*/
sf.sf_signo = sig;
- sf.sf_code = code;
- sf.sf_u.sfu_sip = NULL;
+ sf.sf_sip = NULL;
#ifdef COMPAT_SUNOS
if (p->p_emul == &emul_sunos) {
+ sf.sf_sip = (void *)code; /* SunOS has "int code" */
sf.sf_scp = &fp->sf_sc;
- sf.sf_u.sfu_addr = val.sival_ptr;
+ sf.sf_addr = val.sival_ptr;
}
#endif
sf.sf_sc.sc_o0 = tf->tf_out[0];
if (psp->ps_siginfo & sigmask(sig)) {
- sf.sf_u.sfu_sip = &fp->sf_si;
+ sf.sf_sip = &fp->sf_si;
initsiginfo(&sf.sf_si, sig, code, type, val);
}