* Shuffle some data structures so, and add a flags word to ksiginfo_t.

Right now the only flag is used to indicate if a ksiginfo_t is a
  result of a trap.  Add a predicate macro to test for this flag.
* Add initialization macros for ksiginfo_t's.
* Add accssor macro for ksi_trap.  Expands to 0 if the ksiginfo_t was
  not the result of a trap.  This matches the sigcontext trapcode semantics.
* In kpsendsig(), use KSI_TRAP_P() to select the lwp that gets the signal.
  Inspired by Matthias Drochner's fix to kpsendsig(), but correctly handles
  the case of non-trap-generated signals that have a > 0 si_code.

This patch fixes a signal delivery problem with threaded programs noted by
Matthias Drochner on tech-kern.

As discussed on tech-kern.  Reviewed and OK's by Christos.
This commit is contained in:
thorpej 2003-10-08 00:28:40 +00:00
parent a7a118bf66
commit 68723a995b
45 changed files with 246 additions and 194 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: compat_16_machdep.c,v 1.1 2003/10/07 17:04:18 skd Exp $ */
/* $NetBSD: compat_16_machdep.c,v 1.2 2003/10/08 00:28:40 thorpej Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -88,7 +88,7 @@
#include <machine/cpu.h>
#include <machine/reg.h>
__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.1 2003/10/07 17:04:18 skd Exp $");
__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.2 2003/10/08 00:28:40 thorpej Exp $");
#ifdef DEBUG
@ -216,10 +216,8 @@ sendsig_sigcontext(const ksiginfo_t *ksi, const sigset_t *mask)
/* sigcontext specific trap frame */
tf->tf_regs[FRAME_A0] = sig;
/* ksi_code is probably more accurate, but ksi_trap is (closer to) */
/* binary compatability */
/* tf->tf_regs[FRAME_A1] = ksi->ksi_code; */
tf->tf_regs[FRAME_A1] = ksi->ksi_trap;
tf->tf_regs[FRAME_A1] = KSI_TRAPCODE(ksi);
tf->tf_regs[FRAME_A2] = (u_int64_t)&fp->sf_sc;
/* Remember that we're now on the signal stack. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.85 2003/10/07 17:04:18 skd Exp $ */
/* $NetBSD: trap.c,v 1.86 2003/10/08 00:28:41 thorpej Exp $ */
/*-
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@ -100,7 +100,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.85 2003/10/07 17:04:18 skd Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.86 2003/10/08 00:28:41 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -269,6 +269,7 @@ trap(const u_long a0, const u_long a1, const u_long a2, const u_long entry,
if (i == 0)
goto out;
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = i;
ksi.ksi_code = BUS_ADRALN;
ksi.ksi_addr = (void *)a0; /* VA */
@ -298,6 +299,7 @@ trap(const u_long a0, const u_long a1, const u_long a2, const u_long entry,
i = alpha_fp_complete(a0, a1, l, &ucode);
if (i == 0)
goto out;
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = i;
if (i == SIGSEGV)
ksi.ksi_code = SEGV_MAPERR; /* just pick one */
@ -339,6 +341,7 @@ trap(const u_long a0, const u_long a1, const u_long a2, const u_long entry,
switch (a0) {
case ALPHA_IF_CODE_GENTRAP:
if (framep->tf_regs[FRAME_A0] == -2) { /* weird! */
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGFPE;
ksi.ksi_code = alpha_ucode_to_ksiginfo(ucode);
ksi.ksi_addr =
@ -349,6 +352,7 @@ trap(const u_long a0, const u_long a1, const u_long a2, const u_long entry,
/* FALLTHROUTH */
case ALPHA_IF_CODE_BPT:
case ALPHA_IF_CODE_BUGCHK:
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGTRAP;
ksi.ksi_code = TRAP_BRKPT;
ksi.ksi_addr = (void *)l->l_md.md_tf->tf_regs[FRAME_PC];
@ -359,6 +363,7 @@ trap(const u_long a0, const u_long a1, const u_long a2, const u_long entry,
KERNEL_PROC_LOCK(l);
i = handle_opdec(l, &ucode);
KERNEL_PROC_UNLOCK(l);
KSI_INIT_TRAP(&ksi);
if (i == 0)
goto out;
else if (i == SIGSEGV)
@ -533,6 +538,7 @@ do_fault:
}
goto dopanic;
}
KSI_INIT_TRAP(&ksi);
ksi.ksi_addr = (void *)a0;
ksi.ksi_trap = a1; /* MMCSR VALUE */
if (rv == ENOMEM) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.95 2003/09/22 14:27:00 cl Exp $ */
/* $NetBSD: trap.c,v 1.96 2003/10/08 00:28:41 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@ -83,7 +83,7 @@
#include "opt_fpu_emulate.h"
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.95 2003/09/22 14:27:00 cl Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.96 2003/10/08 00:28:41 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -346,7 +346,7 @@ trapmmufault(type, code, v, fp, l, sticks)
u_int nss;
int rv;
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_trap = type & ~T_USER;
/*
@ -609,7 +609,7 @@ trap(type, code, v, frame)
l = curlwp;
uvmexp.traps++;
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_trap = type & ~T_USER;
/* I have verified that this DOES happen! -gwr */

View File

@ -1,4 +1,4 @@
/* $NetBSD: sig_machdep.c,v 1.21 2003/10/05 19:44:58 matt Exp $ */
/* $NetBSD: sig_machdep.c,v 1.22 2003/10/08 00:28:41 thorpej Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@ -45,7 +45,7 @@
#include <sys/param.h>
__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.21 2003/10/05 19:44:58 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.22 2003/10/08 00:28:41 thorpej Exp $");
#include <sys/mount.h> /* XXX only needed by syscallargs.h */
#include <sys/proc.h>
@ -97,7 +97,7 @@ sendsig_sigcontext(const ksiginfo_t *ksi, const sigset_t *mask)
struct sigframe_sigcontext *fp, frame;
int onstack;
int sig = ksi->ksi_signo;
u_long code = ksi->ksi_trap;
u_long code = KSI_TRAPCODE(ksi);
sig_t catcher = SIGACTION(p, sig).sa_handler;
tf = process_frame(l);
@ -256,7 +256,7 @@ sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
}
/* populate the siginfo frame */
frame.sf_si._info = *ksi;
frame.sf_si._info = ksi->ksi_info;
frame.sf_uc.uc_flags = _UC_SIGMASK;
frame.sf_uc.uc_sigmask = *mask;
frame.sf_uc.uc_link = NULL;

View File

@ -1,4 +1,4 @@
/* $NetBSD: syscall.c,v 1.19 2003/10/05 19:44:58 matt Exp $ */
/* $NetBSD: syscall.c,v 1.20 2003/10/08 00:28:41 thorpej Exp $ */
/*-
* Copyright (c) 2000, 2003 The NetBSD Foundation, Inc.
@ -82,7 +82,7 @@
#include <sys/param.h>
__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.19 2003/10/05 19:44:58 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.20 2003/10/08 00:28:41 thorpej Exp $");
#include <sys/device.h>
#include <sys/errno.h>
@ -223,7 +223,7 @@ syscall_plain(struct trapframe *frame, struct lwp *l, u_int32_t insn)
break;
default:
/* Undefined so illegal instruction */
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGILL;
/* XXX get an ILL_ILLSYSCALL assigned */
ksi.ksi_code = 0;
@ -241,7 +241,7 @@ syscall_plain(struct trapframe *frame, struct lwp *l, u_int32_t insn)
break;
default:
/* Undefined so illegal instruction */
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGILL;
/* XXX get an ILL_ILLSYSCALL assigned */
ksi.ksi_code = 0;
@ -351,7 +351,7 @@ syscall_fancy(struct trapframe *frame, struct lwp *l, u_int32_t insn)
break;
default:
/* Undefined so illegal instruction */
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGILL;
/* XXX get an ILL_ILLSYSCALL assigned */
ksi.ksi_code = 0;
@ -369,7 +369,7 @@ syscall_fancy(struct trapframe *frame, struct lwp *l, u_int32_t insn)
break;
default:
/* Undefined so illegal instruction */
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGILL;
/* XXX get an ILL_ILLSYSCALL assigned */
ksi.ksi_code = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: undefined.c,v 1.18 2003/10/05 19:44:58 matt Exp $ */
/* $NetBSD: undefined.c,v 1.19 2003/10/08 00:28:41 thorpej Exp $ */
/*
* Copyright (c) 2001 Ben Harris.
@ -54,7 +54,7 @@
#include <sys/kgdb.h>
#endif
__KERNEL_RCSID(0, "$NetBSD: undefined.c,v 1.18 2003/10/05 19:44:58 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: undefined.c,v 1.19 2003/10/08 00:28:41 thorpej Exp $");
#include <sys/malloc.h>
#include <sys/queue.h>
@ -132,7 +132,8 @@ gdb_trapper(u_int addr, u_int insn, struct trapframe *frame, int code)
if (insn == GDB_BREAKPOINT || insn == GDB5_BREAKPOINT) {
if (code == FAULT_USER) {
ksiginfo_t ksi;
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGTRAP;
ksi.ksi_code = TRAP_BRKPT;
ksi.ksi_addr = (u_int32_t *)addr;
@ -281,7 +282,7 @@ undefinedinstruction(trapframe_t *frame)
Debugger();
#endif
}
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGILL;
ksi.ksi_code = ILL_ILLOPC;
ksi.ksi_addr = (u_int32_t *)fault_pc;

View File

@ -1,4 +1,4 @@
/* $NetBSD: fault.c,v 1.34 2003/10/05 19:44:58 matt Exp $ */
/* $NetBSD: fault.c,v 1.35 2003/10/08 00:28:41 thorpej Exp $ */
/*
* Copyright 2003 Wasabi Systems, Inc.
@ -82,7 +82,7 @@
#include "opt_pmap_debug.h"
#include <sys/types.h>
__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.34 2003/10/05 19:44:58 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.35 2003/10/08 00:28:41 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -388,7 +388,7 @@ copyfault:
/* check if this was a failed fixup */
if (error == ABORT_FIXUP_FAILED) {
if (user) {
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGSEGV;
ksi.ksi_code = 0;
ksi.ksi_addr = (u_int32_t *)fault_address;
@ -462,7 +462,7 @@ we_re_toast:
if ((frame->tf_spsr & PSR_MODE) == PSR_UND32_MODE) {
report_abort("UND32", fault_status,
fault_address, fault_pc);
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGSEGV;
ksi.ksi_code = fault_status;
ksi.ksi_addr = (u_int32_t *)fault_address;
@ -564,7 +564,7 @@ we_re_toast:
report_abort("", fault_status, fault_address, fault_pc);
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGSEGV;
ksi.ksi_code = 0;
ksi.ksi_addr = (u_int32_t *)fault_address;
@ -682,7 +682,7 @@ prefetch_abort_handler(frame)
printf("prefetch: pc (%08lx) not in user process space\n",
fault_pc);
#endif
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGSEGV;
ksi.ksi_code = SEGV_ACCERR;
ksi.ksi_addr = (u_int32_t *)fault_pc;
@ -711,7 +711,7 @@ prefetch_abort_handler(frame)
if (error == 0)
goto prefetch_out;
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGSEGV;
ksi.ksi_code = 0;
ksi.ksi_errno = error;

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.71 2003/09/22 14:27:03 cl Exp $ */
/* $NetBSD: trap.c,v 1.72 2003/10/08 00:28:41 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.71 2003/09/22 14:27:03 cl Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.72 2003/10/08 00:28:41 thorpej Exp $");
#include "opt_ddb.h"
#include "opt_execfmt.h"
@ -395,7 +395,7 @@ trap(type, code, v, frame)
uvmexp.traps++;
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_trap = type & ~T_USER;
/* I have verified that this DOES happen! -gwr */

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.14 2003/09/22 14:27:05 cl Exp $ */
/* $NetBSD: trap.c,v 1.15 2003/10/08 00:28:41 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.14 2003/09/22 14:27:05 cl Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.15 2003/10/08 00:28:41 thorpej Exp $");
#include "opt_ddb.h"
#include "opt_execfmt.h"
@ -333,7 +333,7 @@ trap(type, code, v, frame)
uvmexp.traps++;
l = curlwp;
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_trap = type & ~T_USER;
/* I have verified that this DOES happen! -gwr */

View File

@ -1,4 +1,4 @@
/* $NetBSD: hpux_machdep.c,v 1.38 2003/09/25 22:00:48 christos Exp $ */
/* $NetBSD: hpux_machdep.c,v 1.39 2003/10/08 00:28:41 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -107,7 +107,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: hpux_machdep.c,v 1.38 2003/09/25 22:00:48 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: hpux_machdep.c,v 1.39 2003/10/08 00:28:41 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -454,7 +454,7 @@ int hpuxsigpid = 0;
void
hpux_sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
{
u_long code = ksi->ksi_trap;
u_long code = KSI_TRAPCODE(ksi);
int sig = ksi->ksi_signo;
struct lwp *l = curlwp;
struct proc *p = l->l_proc;

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.103 2003/09/22 14:26:57 cl Exp $ */
/* $NetBSD: trap.c,v 1.104 2003/10/08 00:28:41 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.103 2003/09/22 14:26:57 cl Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.104 2003/10/08 00:28:41 thorpej Exp $");
#include "opt_ddb.h"
#include "opt_execfmt.h"
@ -326,7 +326,7 @@ trap(type, code, v, frame)
uvmexp.traps++;
l = curlwp;
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_trap = type & ~T_USER;
/* I have verified that this DOES happen! -gwr */

View File

@ -1,4 +1,4 @@
/* $NetBSD: compat_16_machdep.c,v 1.4 2003/09/25 22:01:31 christos Exp $ */
/* $NetBSD: compat_16_machdep.c,v 1.5 2003/10/08 00:28:41 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.4 2003/09/25 22:01:31 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.5 2003/10/08 00:28:41 thorpej Exp $");
#include "opt_vm86.h"
#include "opt_compat_netbsd.h"
@ -175,7 +175,7 @@ sendsig_sigcontext(const ksiginfo_t *ksi, const sigset_t *mask)
struct trapframe *tf = l->l_md.md_regs;
int onstack;
int sig = ksi->ksi_signo;
u_long code = ksi->ksi_trap;
u_long code = KSI_TRAPCODE(ksi);
struct sigframe_sigcontext *fp = getframe(l, sig, &onstack), frame;
sig_t catcher = SIGACTION(p, sig).sa_handler;

View File

@ -1,4 +1,4 @@
/* $NetBSD: freebsd_machdep.c,v 1.40 2003/09/25 22:01:31 christos Exp $ */
/* $NetBSD: freebsd_machdep.c,v 1.41 2003/10/08 00:28:41 thorpej Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: freebsd_machdep.c,v 1.40 2003/09/25 22:01:31 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: freebsd_machdep.c,v 1.41 2003/10/08 00:28:41 thorpej Exp $");
#if defined(_KERNEL_OPT)
#include "opt_vm86.h"
@ -96,7 +96,7 @@ void
freebsd_sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
{
int sig = ksi->ksi_signo;
u_long code = ksi->ksi_trap;
u_long code = KSI_TRAPCODE(ksi);
struct lwp *l = curlwp;
struct proc *p = l->l_proc;
int onstack;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ibcs2_machdep.c,v 1.26 2003/09/25 22:01:31 christos Exp $ */
/* $NetBSD: ibcs2_machdep.c,v 1.27 2003/10/08 00:28:41 thorpej Exp $ */
/*-
* Copyright (c) 1997, 2000 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ibcs2_machdep.c,v 1.26 2003/09/25 22:01:31 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: ibcs2_machdep.c,v 1.27 2003/10/08 00:28:41 thorpej Exp $");
#if defined(_KERNEL_OPT)
#include "opt_vm86.h"
@ -103,7 +103,7 @@ void
ibcs2_sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
{
int sig = ksi->ksi_signo;
u_long code = ksi->ksi_trap;
u_long code = KSI_TRAPCODE(ksi);
struct lwp *l = curlwp;
struct proc *p = l->l_proc;
int onstack;

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_trap.c,v 1.8 2003/09/25 22:01:31 christos Exp $ */
/* $NetBSD: linux_trap.c,v 1.9 2003/10/08 00:28:41 thorpej Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_trap.c,v 1.8 2003/09/25 22:01:31 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_trap.c,v 1.9 2003/10/08 00:28:41 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -145,6 +145,7 @@ linux_trapsignal(struct lwp *l, const ksiginfo_t *ksi)
case SIGBUS:
case SIGFPE:
case SIGSEGV:
KASSERT(KSI_TRAP_P(ksi));
if (ksi->ksi_trap <= ASIZE(trapno_to_x86_vec)) {
ksiginfo_t nksi = *ksi;
nksi.ksi_trap = trapno_to_x86_vec[ksi->ksi_trap];

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.539 2003/09/25 22:01:31 christos Exp $ */
/* $NetBSD: machdep.c,v 1.540 2003/10/08 00:28:41 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@ -72,7 +72,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.539 2003/09/25 22:01:31 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.540 2003/10/08 00:28:41 thorpej Exp $");
#include "opt_beep.h"
#include "opt_compat_ibcs2.h"
@ -658,7 +658,7 @@ sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
frame.sf_signum = sig;
frame.sf_sip = &fp->sf_si;
frame.sf_ucp = &fp->sf_uc;
frame.sf_si._info = *ksi;
frame.sf_si._info = ksi->ksi_info;
frame.sf_uc.uc_flags = _UC_SIGMASK|_UC_VM;
frame.sf_uc.uc_sigmask = *mask;
frame.sf_uc.uc_link = NULL;

View File

@ -1,4 +1,4 @@
/* $NetBSD: math_emulate.c,v 1.26 2003/09/06 22:08:15 christos Exp $ */
/* $NetBSD: math_emulate.c,v 1.27 2003/10/08 00:28:41 thorpej Exp $ */
/*
* expediant "port" of linux 8087 emulator to 386BSD, with apologies -wfj
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: math_emulate.c,v 1.26 2003/09/06 22:08:15 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: math_emulate.c,v 1.27 2003/10/08 00:28:41 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -56,7 +56,7 @@ __KERNEL_RCSID(0, "$NetBSD: math_emulate.c,v 1.26 2003/09/06 22:08:15 christos E
#define PST(x) ((const temp_real *) __st((x)))
#define math_abort(tfp, ksi, signo, code) \
do { \
(void)memset(ksi, 0, sizeof(*ksi)); \
KSI_INIT_TRAP(ksi); \
ksi->ksi_signo = signo; \
ksi->ksi_code = code; \
ksi->ksi_addr = (void *)info->tf_eip;\

View File

@ -1,4 +1,4 @@
/* $NetBSD: svr4_machdep.c,v 1.71 2003/09/25 22:01:31 christos Exp $ */
/* $NetBSD: svr4_machdep.c,v 1.72 2003/10/08 00:28:41 thorpej Exp $ */
/*-
* Copyright (c) 1994, 2000 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: svr4_machdep.c,v 1.71 2003/09/25 22:01:31 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: svr4_machdep.c,v 1.72 2003/10/08 00:28:41 thorpej Exp $");
#if defined(_KERNEL_OPT)
#include "opt_vm86.h"
@ -373,7 +373,7 @@ svr4_getsiginfo(si, sig, code, addr)
void
svr4_sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
{
u_long code = ksi->ksi_trap;
u_long code = KSI_TRAPCODE(ksi);
int sig = ksi->ksi_signo;
struct lwp *l = curlwp;
struct proc *p = l->l_proc;

View File

@ -1,4 +1,4 @@
/* $NetBSD: syscall.c,v 1.23 2003/09/06 22:08:15 christos Exp $ */
/* $NetBSD: syscall.c,v 1.24 2003/10/08 00:28:41 thorpej Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.23 2003/09/06 22:08:15 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.24 2003/10/08 00:28:41 thorpej Exp $");
#include "opt_syscall_debug.h"
#include "opt_vm86.h"
@ -282,7 +282,8 @@ syscall_vm86(frame)
struct lwp *l;
struct proc *p;
ksiginfo_t ksi;
memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGBUS;
ksi.ksi_code = BUS_OBJERR;
ksi.ksi_trap = T_PROTFLT;

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.188 2003/09/16 13:57:47 cl Exp $ */
/* $NetBSD: trap.c,v 1.189 2003/10/08 00:28:41 thorpej Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -75,7 +75,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.188 2003/09/16 13:57:47 cl Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.189 2003/10/08 00:28:41 thorpej Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -405,7 +405,7 @@ copyfault:
case T_STKFLT|T_USER:
case T_ALIGNFLT|T_USER:
case T_NMI|T_USER:
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGBUS;
ksi.ksi_trap = type & ~T_USER;
ksi.ksi_addr = (void *)rcr2();
@ -430,7 +430,7 @@ copyfault:
case T_PRIVINFLT|T_USER: /* privileged instruction fault */
case T_FPOPFLT|T_USER: /* coprocessor operand fault */
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGILL;
ksi.ksi_trap = type & ~T_USER;
ksi.ksi_addr = (void *)rcr2();
@ -470,7 +470,7 @@ copyfault:
ksi.ksi_trap = type & ~T_USER;
goto trapsignal;
#else
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGKILL;
ksi.ksi_trap = type & ~T_USER;
ksi.ksi_addr = (void *)frame->tf_eip;
@ -483,7 +483,7 @@ copyfault:
case T_BOUND|T_USER:
case T_OFLOW|T_USER:
case T_DIVIDE|T_USER:
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGFPE;
ksi.ksi_trap = type & ~T_USER;
ksi.ksi_addr = (void *)frame->tf_eip;
@ -502,7 +502,7 @@ copyfault:
goto trapsignal;
case T_ARITHTRAP|T_USER:
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGFPE;
ksi.ksi_trap = frame->tf_err & ~TC_FLAGMASK;
ksi.ksi_addr = (void *)frame->tf_eip;
@ -614,7 +614,7 @@ copyfault:
KERNEL_PROC_UNLOCK(l);
goto out;
}
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_trap = type & ~T_USER;
ksi.ksi_addr = (void *)cr2;
if (error == EACCES) {
@ -672,7 +672,7 @@ copyfault:
*/
if ((p->p_nras == 0) ||
(ras_lookup(p, (caddr_t)frame->tf_eip) == (caddr_t)-1)) {
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGTRAP;
ksi.ksi_trap = type & ~T_USER;
if (type == (T_BPTFLT|T_USER))

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm86.c,v 1.33 2003/09/11 19:15:13 christos Exp $ */
/* $NetBSD: vm86.c,v 1.34 2003/10/08 00:28:41 thorpej Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vm86.c,v 1.33 2003/09/11 19:15:13 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: vm86.c,v 1.34 2003/10/08 00:28:41 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -235,7 +235,7 @@ vm86_return(l, retval)
} else {
ksiginfo_t ksi;
memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGURG;
ksi.ksi_trap = retval;
(*p->p_emul->e_trapsignal)(l, &ksi);
@ -361,7 +361,7 @@ vm86_gpfault(l, type)
if (trace && tf->tf_eflags & PSL_VM) {
ksiginfo_t ksi;
memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGTRAP;
ksi.ksi_code = TRAP_TRACE;
ksi.ksi_trap = T_TRCTRAP;

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.25 2003/09/22 14:27:06 cl Exp $ */
/* $NetBSD: trap.c,v 1.26 2003/10/08 00:28:41 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@ -78,7 +78,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.25 2003/09/22 14:27:06 cl Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.26 2003/10/08 00:28:41 thorpej Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -293,7 +293,7 @@ trap(type, code, v, frame)
uvmexp.traps++;
l = curlwp;
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_trap = type & ~T_USER;
/* I have verified that this DOES happen! -gwr */

View File

@ -1,4 +1,4 @@
/* $NetBSD: compat_16_machdep.c,v 1.2 2003/09/25 22:04:17 christos Exp $ */
/* $NetBSD: compat_16_machdep.c,v 1.3 2003/10/08 00:28:41 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@ -75,7 +75,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.2 2003/09/25 22:04:17 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.3 2003/10/08 00:28:41 thorpej Exp $");
#include "opt_compat_netbsd.h"
@ -126,7 +126,7 @@ sendsig_sigcontext(const ksiginfo_t *ksi, const sigset_t *mask)
struct frame *frame = (struct frame *)l->l_md.md_regs;
int onstack;
int sig = ksi->ksi_signo;
u_long code = ksi->ksi_trap;
u_long code = KSI_TRAPCODE(ksi);
struct sigframe_sigcontext *fp = getframe(l, sig, &onstack), kf;
sig_t catcher = SIGACTION(p, sig).sa_handler;
short ft = frame->f_format;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sig_machdep.c,v 1.23 2003/09/25 22:04:17 christos Exp $ */
/* $NetBSD: sig_machdep.c,v 1.24 2003/10/08 00:28:41 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@ -75,7 +75,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.23 2003/09/25 22:04:17 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.24 2003/10/08 00:28:41 thorpej Exp $");
#include "opt_compat_netbsd.h"
@ -201,7 +201,7 @@ sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
kf.sf_signum = sig;
kf.sf_sip = &fp->sf_si;
kf.sf_ucp = &fp->sf_uc;
kf.sf_si._info = *ksi;
kf.sf_si._info = ksi->ksi_info;
kf.sf_uc.uc_flags = _UC_SIGMASK;
kf.sf_uc.uc_sigmask = *mask;
kf.sf_uc.uc_link = NULL;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sunos_machdep.c,v 1.26 2003/09/25 22:04:17 christos Exp $ */
/* $NetBSD: sunos_machdep.c,v 1.27 2003/10/08 00:28:41 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sunos_machdep.c,v 1.26 2003/09/25 22:04:17 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: sunos_machdep.c,v 1.27 2003/10/08 00:28:41 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -134,7 +134,7 @@ struct sunos_sigframe {
void
sunos_sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
{
u_long code = ksi->ksi_trap;
u_long code = KSI_TRAPCODE(ksi);
int sig = ksi->ksi_signo;
struct lwp *l = curlwp;
struct proc *p = l->l_proc;

View File

@ -1,4 +1,4 @@
/* $NetBSD: svr4_machdep.c,v 1.14 2003/09/25 22:04:17 christos Exp $ */
/* $NetBSD: svr4_machdep.c,v 1.15 2003/10/08 00:28:41 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: svr4_machdep.c,v 1.14 2003/09/25 22:04:17 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: svr4_machdep.c,v 1.15 2003/10/08 00:28:41 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -250,7 +250,7 @@ svr4_getsiginfo(sip, sig, code, addr)
void
svr4_sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
{
u_long code = ksi->ksi_trap;
u_long code = KSI_TRAPCODE(ksi);
int sig = ksi->ksi_signo;
struct lwp *l = curlwp;
struct proc *p = l->l_proc;

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.106 2003/09/22 14:27:07 cl Exp $ */
/* $NetBSD: trap.c,v 1.107 2003/10/08 00:28:42 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.106 2003/09/22 14:27:07 cl Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.107 2003/10/08 00:28:42 thorpej Exp $");
#include "opt_ddb.h"
#include "opt_execfmt.h"
@ -308,7 +308,7 @@ trap(type, code, v, frame)
uvmexp.traps++;
l = curlwp;
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_trap = type & ~T_USER;
/* I have verified that this DOES happen! -gwr */

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.69 2003/09/22 14:27:09 cl Exp $ */
/* $NetBSD: trap.c,v 1.70 2003/10/08 00:28:42 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.69 2003/09/22 14:27:09 cl Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.70 2003/10/08 00:28:42 thorpej Exp $");
#include "opt_ddb.h"
#include "opt_execfmt.h"
@ -346,7 +346,7 @@ trap(type, code, v, frame)
uvmexp.traps++;
l = curlwp;
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_trap = type & ~T_USER;
/* I have verified that this DOES happen! -gwr */

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.31 2003/09/22 14:27:10 cl Exp $ */
/* $NetBSD: trap.c,v 1.32 2003/10/08 00:28:42 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.31 2003/09/22 14:27:10 cl Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.32 2003/10/08 00:28:42 thorpej Exp $");
#include "opt_ddb.h"
#include "opt_execfmt.h"
@ -316,7 +316,7 @@ trap(type, code, v, frame)
uvmexp.traps++;
l = curlwp;
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_trap = type & ~T_USER;
/* I have verified that this DOES happen! -gwr */

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.45 2003/09/22 14:27:11 cl Exp $ */
/* $NetBSD: trap.c,v 1.46 2003/10/08 00:28:42 thorpej Exp $ */
/*
* This file was taken from mvme68k/mvme68k/trap.c
@ -84,7 +84,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.45 2003/09/22 14:27:11 cl Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.46 2003/10/08 00:28:42 thorpej Exp $");
#include "opt_ddb.h"
#include "opt_execfmt.h"
@ -342,7 +342,7 @@ trap(type, code, v, frame)
uvmexp.traps++;
l = curlwp;
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_trap = type & ~T_USER;
/* I have verified that this DOES happen! -gwr */

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.18 2003/09/26 00:00:17 eeh Exp $ */
/* $NetBSD: trap.c,v 1.19 2003/10/08 00:28:42 thorpej Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.18 2003/09/26 00:00:17 eeh Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.19 2003/10/08 00:28:42 thorpej Exp $");
#include "opt_altivec.h"
#include "opt_ddb.h"
@ -164,7 +164,7 @@ trap(struct trapframe *frame)
*/
case EXC_TRC|EXC_USER:
frame->srr1 &= ~PSL_SE;
memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGTRAP;
ksi.ksi_trap = EXC_TRC;
ksi.ksi_addr = (void *)frame->srr0;
@ -252,7 +252,7 @@ trap(struct trapframe *frame)
KERNEL_PROC_UNLOCK(l);
break;
}
memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGSEGV;
ksi.ksi_trap = EXC_DSI;
ksi.ksi_addr = (void *)frame->dar;
@ -288,7 +288,7 @@ trap(struct trapframe *frame)
KERNEL_PROC_UNLOCK(l);
break;
}
memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGSEGV;
ksi.ksi_trap = EXC_ISI;
ksi.ksi_addr = (void *)frame->srr0;
@ -315,7 +315,7 @@ trap(struct trapframe *frame)
case EXC_ALI|EXC_USER:
KERNEL_PROC_LOCK(l);
if (fix_unaligned(l, frame) != 0) {
memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGBUS;
ksi.ksi_trap = EXC_ALI;
ksi.ksi_addr = (void *)frame->dar;
@ -340,7 +340,7 @@ trap(struct trapframe *frame)
if ((rv = fpu_emulate(frame,
(struct fpreg *)&l->l_addr->u_pcb.pcb_fpu))) {
memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = rv;
ksi.ksi_trap = EXC_PGM;
ksi.ksi_addr = (void *)frame->srr0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sig_machdep.c,v 1.17 2003/09/27 03:51:54 matt Exp $ */
/* $NetBSD: sig_machdep.c,v 1.18 2003/10/08 00:28:42 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.17 2003/09/27 03:51:54 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.18 2003/10/08 00:28:42 thorpej Exp $");
#include "opt_compat_netbsd.h"
#include "opt_ppcarch.h"
@ -67,7 +67,7 @@ sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
if (sd->sd_vers < 2) {
#ifdef COMPAT_16
sendsig_sigcontext(ksi->ksi_signo, mask, ksi->ksi_trap);
sendsig_sigcontext(ksi->ksi_signo, mask, KSI_TRAPCODE(ksi));
return;
#else
goto nosupport;

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.89 2003/09/27 04:44:42 matt Exp $ */
/* $NetBSD: trap.c,v 1.90 2003/10/08 00:28:42 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.89 2003/09/27 04:44:42 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.90 2003/10/08 00:28:42 thorpej Exp $");
#include "opt_altivec.h"
#include "opt_ddb.h"
@ -99,7 +99,7 @@ trap(struct trapframe *frame)
frame->srr1 &= ~PSL_SE;
if (p->p_nras == 0 ||
ras_lookup(p, (caddr_t)frame->srr0) == (caddr_t) -1) {
memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGTRAP;
ksi.ksi_trap = EXC_TRC;
ksi.ksi_addr = (void *)frame->srr0;
@ -229,7 +229,7 @@ trap(struct trapframe *frame)
(frame->dsisr & DSISR_STORE) ? "write" : "read",
frame->dar, frame->srr0, frame->dsisr, rv);
}
memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGSEGV;
ksi.ksi_trap = EXC_DSI;
ksi.ksi_addr = (void *)frame->dar;
@ -289,7 +289,7 @@ trap(struct trapframe *frame)
"(SRR1=%#lx)\n", p->p_pid, l->l_lid, p->p_comm,
frame->srr0, frame->srr1);
}
memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGSEGV;
ksi.ksi_trap = EXC_ISI;
ksi.ksi_addr = (void *)frame->srr0;
@ -332,7 +332,7 @@ trap(struct trapframe *frame)
p->p_pid, l->l_lid, p->p_comm,
frame->dar, frame->srr0, frame->dsisr);
}
memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGBUS;
ksi.ksi_trap = EXC_ALI;
ksi.ksi_addr = (void *)frame->dar;
@ -360,7 +360,7 @@ trap(struct trapframe *frame)
p->p_pid, l->l_lid, p->p_comm,
frame->srr0, frame->srr1);
}
memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGILL;
ksi.ksi_trap = EXC_PGM;
ksi.ksi_addr = (void *)frame->srr0;
@ -377,7 +377,7 @@ trap(struct trapframe *frame)
"(SSR1=%#lx)\n",
p->p_pid, p->p_comm, frame->srr0, frame->srr1);
}
memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGBUS;
ksi.ksi_trap = EXC_MCHK;
ksi.ksi_addr = (void *)frame->srr0;
@ -391,7 +391,7 @@ trap(struct trapframe *frame)
if (frame->srr1 & 0x00020000) { /* Bit 14 is set if trap */
if (p->p_nras == 0 ||
ras_lookup(p, (caddr_t)frame->srr0) == (caddr_t) -1) {
memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGTRAP;
ksi.ksi_trap = EXC_PGM;
ksi.ksi_addr = (void *)frame->srr0;
@ -406,7 +406,7 @@ trap(struct trapframe *frame)
printf("trap: pid %d.%d (%s): user PGM trap @"
" %#lx (SSR1=%#lx)\n", p->p_pid, l->l_lid,
p->p_comm, frame->srr0, frame->srr1);
memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGILL;
ksi.ksi_trap = EXC_PGM;
ksi.ksi_addr = (void *)frame->srr0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sig_machdep.c,v 1.17 2003/10/05 09:57:47 scw Exp $ */
/* $NetBSD: sig_machdep.c,v 1.18 2003/10/08 00:28:42 thorpej Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.17 2003/10/05 09:57:47 scw Exp $");
__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.18 2003/10/08 00:28:42 thorpej Exp $");
#include "opt_compat_netbsd.h"
@ -95,7 +95,7 @@ sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *returnmask)
ssp = (struct sigframe_siginfo *)((caddr_t)ssp - ((fsize + 15) & ~15));
/* Build stack frame for signal trampoline. */
kss.sf_si._info = *ksi;
kss.sf_si._info = ksi->ksi_info;
kss.sf_uc.uc_flags = _UC_SIGMASK;
kss.sf_uc.uc_sigmask = *returnmask;
kss.sf_uc.uc_link = NULL;

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.28 2003/10/05 09:57:47 scw Exp $ */
/* $NetBSD: trap.c,v 1.29 2003/10/08 00:28:42 thorpej Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@ -111,7 +111,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.28 2003/10/05 09:57:47 scw Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.29 2003/10/08 00:28:42 thorpej Exp $");
#include "opt_ddb.h"
@ -215,7 +215,7 @@ trap(struct lwp *l, struct trapframe *tf)
printf("ksp=0x%lx\n", (vaddr_t)tf);
if (traptype & T_USER) {
/* This shouldn't happen ... */
(void) memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGILL;
ksi.ksi_code = ILL_ILLTRP;
ksi.ksi_addr = (void *)(uintptr_t)tf->tf_state.sf_tea;
@ -234,7 +234,7 @@ trap(struct lwp *l, struct trapframe *tf)
case T_EXECPROT|T_USER:
case T_READPROT|T_USER:
(void) memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGSEGV;
ksi.ksi_code = SEGV_ACCERR;
ksi.ksi_addr = (void *)(uintptr_t)tf->tf_state.sf_tea;
@ -244,7 +244,7 @@ trap(struct lwp *l, struct trapframe *tf)
case T_IADDERR|T_USER:
case T_RADDERR|T_USER:
case T_WADDERR|T_USER:
(void) memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGBUS;
ksi.ksi_code = BUS_ADRERR;
ksi.ksi_addr = (void *)(uintptr_t)tf->tf_state.sf_tea;
@ -352,7 +352,7 @@ trap(struct lwp *l, struct trapframe *tf)
if ((traptype & T_USER) == 0)
goto copyfault;
(void) memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGSEGV;
ksi.ksi_code = SEGV_MAPERR;
ksi.ksi_addr = (void *)(uintptr_t)tf->tf_state.sf_tea;
@ -397,7 +397,7 @@ trap(struct lwp *l, struct trapframe *tf)
return;
case T_BREAK|T_USER:
(void) memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGTRAP;
ksi.ksi_code = TRAP_BRKPT;
ksi.ksi_addr = (void *)(uintptr_t)tf->tf_state.sf_spc;
@ -406,7 +406,7 @@ trap(struct lwp *l, struct trapframe *tf)
case T_RESINST|T_USER:
case T_FPUDIS|T_USER:
(void) memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGILL;
ksi.ksi_code = ILL_ILLOPC;
ksi.ksi_addr = (void *)(uintptr_t)tf->tf_state.sf_spc;
@ -415,7 +415,7 @@ trap(struct lwp *l, struct trapframe *tf)
case T_ILLSLOT|T_USER:
case T_SLOTFPUDIS|T_USER:
(void) memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGILL;
ksi.ksi_code = ILL_ILLOPC; /* XXX: Could do with ILL_DELAYSLOT */
ksi.ksi_addr = (void *)(uintptr_t)tf->tf_state.sf_spc;
@ -423,7 +423,7 @@ trap(struct lwp *l, struct trapframe *tf)
break;
case T_FPUEXC|T_USER:
(void) memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGFPE;
ksi.ksi_addr = (void *)(uintptr_t)tf->tf_state.sf_spc;
ksi.ksi_trap = T_FPUEXC;
@ -486,7 +486,7 @@ trap(struct lwp *l, struct trapframe *tf)
/*FALLTHROUGH*/
case T_TRAP|T_USER:
(void) memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGILL;
ksi.ksi_code = ILL_ILLTRP;
ksi.ksi_addr = (void *)(uintptr_t)tf->tf_state.sf_spc;
@ -494,7 +494,7 @@ trap(struct lwp *l, struct trapframe *tf)
break;
case T_DIVZERO|T_USER:
(void) memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = SIGFPE;
ksi.ksi_code = FPE_INTDIV;
ksi.ksi_addr = (void *)(uintptr_t)tf->tf_state.sf_spc;

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.234 2003/10/05 21:13:23 pk Exp $ */
/* $NetBSD: machdep.c,v 1.235 2003/10/08 00:28:42 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -78,7 +78,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.234 2003/10/05 21:13:23 pk Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.235 2003/10/08 00:28:42 thorpej Exp $");
#include "opt_compat_netbsd.h"
#include "opt_compat_sunos.h"
@ -540,7 +540,7 @@ sendsig_sigcontext(const ksiginfo_t *ksi, const sigset_t *mask)
int addr, onstack, oldsp, newsp;
struct sigframe_sigcontext sf;
int sig = ksi->ksi_signo;
u_long code = ksi->ksi_trap;
u_long code = KSI_TRAPCODE(ksi);
sig_t catcher = SIGACTION(p, sig).sa_handler;
tf = l->l_md.md_tf;
@ -723,7 +723,7 @@ void sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
*/
sf.sf_sip = &fp->sf_si;
sf.sf_ucp = &fp->sf_uc;
sf.sf_si._info = *ksi;
sf.sf_si._info = ksi->ksi_info;
sf.sf_uc.uc_flags = _UC_SIGMASK /*|
((p->p_sigctx.ps_sigstk.ss_flags & SS_ONSTACK)
? _UC_SETSTACK : _UC_CLRSTACK)*/;

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.143 2003/10/05 21:13:23 pk Exp $ */
/* $NetBSD: trap.c,v 1.144 2003/10/08 00:28:42 thorpej Exp $ */
/*
* Copyright (c) 1996
@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.143 2003/10/05 21:13:23 pk Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.144 2003/10/08 00:28:42 thorpej Exp $");
#include "opt_ddb.h"
#include "opt_ktrace.h"
@ -448,6 +448,7 @@ trap(type, psr, pc, tf)
PSR_BITS, bits, sizeof(bits)));
sig = SIGILL;
ucode = type;
KSI_INIT_TRAP(&ksi);
ksi.ksi_trap = type;
ksi.ksi_code = ILL_ILLTRP;
ksi.ksi_addr = (void *)pc;
@ -463,6 +464,7 @@ badtrap:
p->p_comm, p->p_pid, type);
#endif
sig = SIGILL;
KSI_INIT_TRAP(&ksi);
ksi.ksi_trap = type;
ksi.ksi_code = ILL_ILLTRP;
ksi.ksi_addr = (void *)pc;
@ -490,6 +492,7 @@ badtrap:
ADVANCE;
break;
}
KSI_INIT_TRAP(&ksi);
ksi.ksi_trap = type;
ksi.ksi_code = ILL_ILLOPC;
ksi.ksi_addr = (void *)pc;
@ -497,6 +500,7 @@ badtrap:
case T_PRIVINST:
sig = SIGILL;
KSI_INIT_TRAP(&ksi);
ksi.ksi_trap = type;
ksi.ksi_code = ILL_PRVOPC;
ksi.ksi_addr = (void *)pc;
@ -530,6 +534,7 @@ badtrap:
#else
sig = SIGFPE;
/* XXX - ucode? */
KSI_INIT_TRAP(&ksi);
ksi.ksi_trap = type;
ksi.ksi_code = 0;
ksi.ksi_addr = (void *)pc;
@ -667,6 +672,7 @@ badtrap:
}
}
sig = SIGBUS;
KSI_INIT_TRAP(&ksi);
ksi.ksi_trap = type;
ksi.ksi_code = BUS_ADRALN;
ksi.ksi_addr = (void *)pc;
@ -700,6 +706,7 @@ badtrap:
case T_TAGOF:
sig = SIGEMT;
KSI_INIT_TRAP(&ksi);
ksi.ksi_trap = type;
ksi.ksi_code = 0;
ksi.ksi_addr = (void *)pc;
@ -708,6 +715,7 @@ badtrap:
case T_CPDISABLED:
uprintf("coprocessor instruction\n"); /* XXX */
sig = SIGILL;
KSI_INIT_TRAP(&ksi);
ksi.ksi_trap = type;
ksi.ksi_code = ILL_COPROC;
ksi.ksi_addr = (void *)pc;
@ -715,6 +723,7 @@ badtrap:
case T_BREAKPOINT:
sig = SIGTRAP;
KSI_INIT_TRAP(&ksi);
ksi.ksi_trap = type;
ksi.ksi_code = TRAP_BRKPT;
ksi.ksi_addr = (void *)pc;
@ -724,6 +733,7 @@ badtrap:
case T_IDIV0:
ADVANCE;
sig = SIGFPE;
KSI_INIT_TRAP(&ksi);
ksi.ksi_trap = type;
ksi.ksi_code = FPE_INTDIV;
ksi.ksi_addr = (void *)pc;
@ -749,6 +759,7 @@ badtrap:
uprintf("T_RANGECHECK\n"); /* XXX */
ADVANCE;
sig = SIGILL;
KSI_INIT_TRAP(&ksi);
ksi.ksi_trap = type;
ksi.ksi_code = ILL_ILLADR;
ksi.ksi_addr = (void *)pc;
@ -768,6 +779,7 @@ badtrap:
uprintf("T_INTOF\n"); /* XXX */
ADVANCE;
sig = SIGFPE;
KSI_INIT_TRAP(&ksi);
ksi.ksi_trap = type;
ksi.ksi_code = FPE_INTOVF;
ksi.ksi_addr = (void *)pc;
@ -1039,6 +1051,7 @@ kfault:
ksi.ksi_code = (rv == EACCES
? SEGV_ACCERR : SEGV_MAPERR);
}
KSI_INIT_TRAP(&ksi);
ksi.ksi_trap = type;
ksi.ksi_addr = (void *)v;
trapsignal(l, &ksi);
@ -1324,6 +1337,7 @@ kfault:
ksi.ksi_code = (rv == EACCES)
? SEGV_ACCERR : SEGV_MAPERR;
}
KSI_INIT_TRAP(&ksi);
ksi.ksi_trap = type;
ksi.ksi_addr = (void *)sfva;
trapsignal(l, &ksi);

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.13 2003/09/22 14:27:15 cl Exp $ */
/* $NetBSD: trap.c,v 1.14 2003/10/08 00:28:42 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@ -78,7 +78,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.13 2003/09/22 14:27:15 cl Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.14 2003/10/08 00:28:42 thorpej Exp $");
#include "opt_ddb.h"
#include "opt_execfmt.h"
@ -273,7 +273,7 @@ trap(type, code, v, tf)
uvmexp.traps++;
l = curlwp;
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_trap = type & ~T_USER;
/* I have verified that this DOES happen! -gwr */

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.112 2003/09/22 14:27:13 cl Exp $ */
/* $NetBSD: trap.c,v 1.113 2003/10/08 00:28:42 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@ -78,7 +78,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.112 2003/09/22 14:27:13 cl Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.113 2003/10/08 00:28:42 thorpej Exp $");
#include "opt_ddb.h"
#include "opt_execfmt.h"
@ -282,7 +282,7 @@ trap(type, code, v, tf)
uvmexp.traps++;
l = curlwp;
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_trap = type & ~T_USER;
/* I have verified that this DOES happen! -gwr */

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.85 2003/09/29 22:24:53 matt Exp $ */
/* $NetBSD: trap.c,v 1.86 2003/10/08 00:28:42 thorpej Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@ -33,7 +33,7 @@
/* All bugs are subject to removal without further notice */
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.85 2003/09/29 22:24:53 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.86 2003/10/08 00:28:42 thorpej Exp $");
#include "opt_ddb.h"
#include "opt_ktrace.h"
@ -371,7 +371,7 @@ if(faultdebug)printf("trap accflt type %lx, code %lx, pc %lx, psl %lx\n",
p->p_pid, l->l_lid, p->p_comm, sig, frame->trap,
frame->code, frame->pc, frame->psl);
KERNEL_PROC_LOCK(l);
memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = sig;
ksi.ksi_trap = frame->trap;
ksi.ksi_addr = (void *)frame->code;

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.66 2003/09/22 14:27:14 cl Exp $ */
/* $NetBSD: trap.c,v 1.67 2003/10/08 00:28:42 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.66 2003/09/22 14:27:14 cl Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.67 2003/10/08 00:28:42 thorpej Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -329,7 +329,7 @@ trap(type, code, v, frame)
uvmexp.traps++;
l = curlwp;
(void)memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_trap = type & ~T_USER;
/* I have verified that this DOES happen! -gwr */

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_ktrace.c,v 1.79 2003/09/25 21:59:18 christos Exp $ */
/* $NetBSD: kern_ktrace.c,v 1.80 2003/10/08 00:28:42 thorpej Exp $ */
/*
* Copyright (c) 1989, 1993
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_ktrace.c,v 1.79 2003/09/25 21:59:18 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_ktrace.c,v 1.80 2003/10/08 00:28:42 thorpej Exp $");
#include "opt_ktrace.h"
#include "opt_compat_mach.h"
@ -317,9 +317,9 @@ ktrpsig(p, sig, action, mask, ksi)
kbuf.kp.mask = *mask;
kth.ktr_buf = (caddr_t)&kbuf;
if (ksi) {
kbuf.kp.code = ksi->ksi_code > 0 ? ksi->ksi_trap : 0;
kbuf.kp.code = KSI_TRAPCODE(ksi);
(void)memset(&kbuf.si, 0, sizeof(kbuf.si));
kbuf.si._info = *ksi;
kbuf.si._info = ksi->ksi_info;
kth.ktr_len = sizeof(kbuf);
} else {
kbuf.kp.code = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_sig.c,v 1.165 2003/10/07 00:23:17 thorpej Exp $ */
/* $NetBSD: kern_sig.c,v 1.166 2003/10/08 00:28:42 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1991, 1993
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.165 2003/10/07 00:23:17 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.166 2003/10/08 00:28:42 thorpej Exp $");
#include "opt_ktrace.h"
#include "opt_compat_sunos.h"
@ -870,7 +870,8 @@ trapsignal(struct lwp *l, int signum, u_long code)
{
#define trapsignal _trapsignal
ksiginfo_t ksi;
memset(&ksi, 0, sizeof(ksi));
KSI_INIT_TRAP(&ksi);
ksi.ksi_signo = signum;
ksi.ksi_trap = (int)code;
trapsignal(l, &ksi);
@ -884,6 +885,8 @@ trapsignal(struct lwp *l, const ksiginfo_t *ksi)
struct sigacts *ps;
int signum = ksi->ksi_signo;
KASSERT(KSI_TRAP_P(ksi));
p = l->l_proc;
ps = p->p_sigacts;
if ((p->p_flag & P_TRACED) == 0 &&
@ -1306,9 +1309,9 @@ kpsendsig(struct lwp *l, const ksiginfo_t *ksi, const sigset_t *mask)
f = l->l_flag & L_SA;
l->l_flag &= ~L_SA;
si = pool_get(&siginfo_pool, PR_WAITOK);
si->_info = *ksi;
si->_info = ksi->ksi_info;
le = li = NULL;
if (ksi->ksi_trap)
if (KSI_TRAP_P(ksi))
le = l;
else
li = l;
@ -1322,7 +1325,7 @@ kpsendsig(struct lwp *l, const ksiginfo_t *ksi, const sigset_t *mask)
#ifdef __HAVE_SIGINFO
(*p->p_emul->e_sendsig)(ksi, mask);
#else
(*p->p_emul->e_sendsig)(ksi->ksi_signo, mask, ksi->ksi_trap);
(*p->p_emul->e_sendsig)(ksi->ksi_signo, mask, KSI_TRAPCODE(ksi));
#endif
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_time.c,v 1.76 2003/09/14 06:56:22 christos Exp $ */
/* $NetBSD: kern_time.c,v 1.77 2003/10/08 00:28:42 thorpej Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.76 2003/09/14 06:56:22 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.77 2003/10/08 00:28:42 thorpej Exp $");
#include "fs_nfs.h"
#include "opt_nfs.h"
@ -889,7 +889,7 @@ timerupcall(struct lwp *l, void *arg)
f = l->l_flag & L_SA;
l->l_flag &= ~L_SA;
si = pool_get(&siginfo_pool, PR_WAITOK);
si->_info = pt->pts_timers[i]->pt_info;
si->_info = pt->pts_timers[i]->pt_info.ksi_info;
if (sa_upcall(l, SA_UPCALL_SIGEV | SA_UPCALL_DEFER, NULL, l,
sizeof(*si), si) == 0)
done |= mask;

View File

@ -1,4 +1,4 @@
/* $NetBSD: siginfo.h,v 1.4 2003/09/16 12:04:58 christos Exp $ */
/* $NetBSD: siginfo.h,v 1.5 2003/10/08 00:28:42 thorpej Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -47,7 +47,7 @@ typedef union sigval {
void *sival_ptr;
} sigval_t;
struct ksiginfo {
struct _ksiginfo {
int _signo;
int _code;
int _errno;
@ -80,12 +80,43 @@ struct ksiginfo {
int _fd;
} _poll;
} _reason;
CIRCLEQ_ENTRY(ksiginfo) _list;
};
#ifdef _KERNEL
typedef struct ksiginfo {
u_long ksi_flags; /* 4 or 8 bytes, depending on LP64 */
CIRCLEQ_ENTRY(ksiginfo) ksi_list;
struct _ksiginfo ksi_info;
} ksiginfo_t;
#define KSI_TRAP 0x01 /* signal caused by trap */
/* Macros to initialize a ksiginfo_t. */
#define KSI_INIT(ksi) \
do { \
memset((ksi), 0, sizeof(*(ksi))); \
} while (/*CONSTCOND*/0)
#define KSI_INIT_TRAP(ksi) \
do { \
KSI_INIT((ksi)); \
(ksi)->ksi_flags |= KSI_TRAP; \
} while (/*CONSTCOND*/0)
/*
* Old-style signal handler "code" arguments were only non-zero for
* signals caused by traps.
*/
#define KSI_TRAPCODE(ksi) (((ksi)->ksi_flags & KSI_TRAP) ? \
ksi->ksi_trap : 0)
/* Predicate macros to test how a ksiginfo_t was generated. */
#define KSI_TRAP_P(ksi) (((ksi)->ksi_flags & KSI_TRAP) != 0)
#endif /* _KERNEL */
typedef union siginfo {
char si_pad[128]; /* Total size; for future expansion */
struct ksiginfo _info;
struct _ksiginfo _info;
} siginfo_t;
/** Field access macros */
@ -107,27 +138,24 @@ typedef union siginfo {
#define si_fd _info._reason._poll._fd
#ifdef _KERNEL
typedef struct ksiginfo ksiginfo_t;
/** Field access macros */
#define ksi_signo _signo
#define ksi_code _code
#define ksi_errno _errno
#define ksi_signo ksi_info._signo
#define ksi_code ksi_info._code
#define ksi_errno ksi_info._errno
#define ksi_sigval _reason._rt._sigval
#define ksi_pid _reason._child._pid
#define ksi_uid _reason._child._uid
#define ksi_status _reason._child._status
#define ksi_utime _reason._child._utime
#define ksi_stime _reason._child._stime
#define ksi_sigval ksi_info._reason._rt._sigval
#define ksi_pid ksi_info._reason._child._pid
#define ksi_uid ksi_info._reason._child._uid
#define ksi_status ksi_info._reason._child._status
#define ksi_utime ksi_info._reason._child._utime
#define ksi_stime ksi_info._reason._child._stime
#define ksi_addr _reason._fault._addr
#define ksi_trap _reason._fault._trap
#define ksi_addr ksi_info._reason._fault._addr
#define ksi_trap ksi_info._reason._fault._trap
#define ksi_band _reason._poll._band
#define ksi_fd _reason._poll._fd
#define ksi_list _list
#endif
#define ksi_band ksi_info._reason._poll._band
#define ksi_fd ksi_info._reason._poll._fd
#endif /* _KERNEL */
/** si_code */
/* SIGILL */