<machine/signal.h>
. use netbsd sigframe, sigcontext struct . netbsd sigframe *contains* sigcontext; use that directly in kernel sigsend . drop two fields from minix x86 stackframe.h (process context) that were unused, retadr and st use in-sigframe sigcontext Change-Id: Ib59d699596dc3a78163dee59f19730482fdddf11
This commit is contained in:
@@ -88,12 +88,16 @@ typedef struct trapframe {
|
||||
/*
|
||||
* Signal frame. Pushed onto user stack before calling sigcode.
|
||||
*/
|
||||
#ifdef COMPAT_16
|
||||
#if defined(COMPAT_16) || defined(__minix)
|
||||
struct sigframe_sigcontext {
|
||||
#ifdef __minix
|
||||
struct sigcontext *sf_scp; /* Let sigreturn find sigcontext */
|
||||
#endif
|
||||
struct sigcontext sf_sc;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
/* the pointers are use in the trampoline code to locate the ucontext */
|
||||
struct sigframe_siginfo {
|
||||
siginfo_t sf_si; /* actual saved siginfo */
|
||||
|
||||
@@ -1,59 +1,172 @@
|
||||
#ifndef _ARM_SIGNAL_H_
|
||||
#define _ARM_SIGNAL_H_
|
||||
/* $NetBSD: signal.h,v 1.12 2011/06/30 20:09:20 wiz Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994-1996 Mark Brinicombe.
|
||||
* Copyright (c) 1994 Brini.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software written for Brini by Mark Brinicombe
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Brini.
|
||||
* 4. The name of the company nor the name of the author may be used to
|
||||
* endorse or promote products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* RiscBSD kernel project
|
||||
*
|
||||
* signal.h
|
||||
*
|
||||
* Architecture dependent signal types and structures
|
||||
*
|
||||
* Created : 30/09/94
|
||||
*/
|
||||
|
||||
#ifndef _ARM32_SIGNAL_H_
|
||||
#define _ARM32_SIGNAL_H_
|
||||
|
||||
#include <sys/featuretest.h>
|
||||
|
||||
#ifndef _LOCORE
|
||||
typedef int sig_atomic_t;
|
||||
#endif
|
||||
|
||||
/* The following structure should match the stackframe_s structure used
|
||||
* by the kernel's context switching code. Floating point registers should
|
||||
* be added in a different struct.
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
|
||||
#ifndef _LOCORE
|
||||
/*
|
||||
* Information pushed on stack when a signal is delivered.
|
||||
* This is used by the kernel to restore state following
|
||||
* execution of the signal handler. It is also made available
|
||||
* to the handler to allow it to restore state properly if
|
||||
* a non-standard exit is performed.
|
||||
*/
|
||||
|
||||
#include <machine/stackframe.h>
|
||||
#if defined(__LIBC12_SOURCE__) || defined(_KERNEL)
|
||||
struct sigcontext13 {
|
||||
int sc_onstack; /* sigstack state to restore */
|
||||
int sc_mask; /* signal mask to restore (old style) */
|
||||
|
||||
typedef struct stackframe_s sigregs;
|
||||
struct sigframe { /* stack frame created for signalled process */
|
||||
void (*sf_retadr)(void);
|
||||
int sf_signo;
|
||||
int sf_code;
|
||||
struct sigcontext *sf_scp;
|
||||
int sf_fp;
|
||||
void (*sf_retadr2)(void);
|
||||
struct sigcontext *sf_scpcopy;
|
||||
unsigned int sc_spsr;
|
||||
unsigned int sc_r0;
|
||||
unsigned int sc_r1;
|
||||
unsigned int sc_r2;
|
||||
unsigned int sc_r3;
|
||||
unsigned int sc_r4;
|
||||
unsigned int sc_r5;
|
||||
unsigned int sc_r6;
|
||||
unsigned int sc_r7;
|
||||
unsigned int sc_r8;
|
||||
unsigned int sc_r9;
|
||||
unsigned int sc_r10;
|
||||
unsigned int sc_r11;
|
||||
unsigned int sc_r12;
|
||||
unsigned int sc_usr_sp;
|
||||
unsigned int sc_usr_lr;
|
||||
unsigned int sc_svc_lr;
|
||||
unsigned int sc_pc;
|
||||
};
|
||||
#endif /* __LIBC12_SOURCE__ || _KERNEL */
|
||||
|
||||
struct sigcontext {
|
||||
int trap_style; /* how should context be restored? KTS_* */
|
||||
int sc_flags; /* sigstack state to restore (including
|
||||
* MF_FPU_INITIALIZED)
|
||||
*/
|
||||
sigset_t sc_mask; /* signal mask to restore */
|
||||
sigregs sc_regs; /* register set to restore */
|
||||
int sc_onstack; /* sigstack state to restore */
|
||||
int __sc_mask13; /* signal mask to restore (old style) */
|
||||
|
||||
unsigned int sc_spsr;
|
||||
unsigned int sc_r0;
|
||||
unsigned int sc_r1;
|
||||
unsigned int sc_r2;
|
||||
unsigned int sc_r3;
|
||||
unsigned int sc_r4;
|
||||
unsigned int sc_r5;
|
||||
unsigned int sc_r6;
|
||||
unsigned int sc_r7;
|
||||
unsigned int sc_r8;
|
||||
unsigned int sc_r9;
|
||||
unsigned int sc_r10;
|
||||
unsigned int sc_r11;
|
||||
unsigned int sc_r12;
|
||||
unsigned int sc_usr_sp;
|
||||
unsigned int sc_usr_lr;
|
||||
unsigned int sc_svc_lr;
|
||||
unsigned int sc_pc;
|
||||
|
||||
sigset_t sc_mask; /* signal mask to restore (new style) */
|
||||
#ifdef __minix
|
||||
#define SC_MAGIC 0xc0ffee2
|
||||
int sc_magic;
|
||||
int sc_flags;
|
||||
int trap_style;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define sc_retreg sc_regs.retreg
|
||||
#define sc_r1 sc_regs.r1
|
||||
#define sc_r2 sc_regs.r2
|
||||
#define sc_r3 sc_regs.r3
|
||||
#define sc_r4 sc_regs.r4
|
||||
#define sc_r5 sc_regs.r5
|
||||
#define sc_r6 sc_regs.r6
|
||||
#define sc_r7 sc_regs.r7
|
||||
#define sc_r8 sc_regs.r8
|
||||
#define sc_r9 sc_regs.r9
|
||||
#define sc_r10 sc_regs.r10
|
||||
#define sc_fp sc_regs.fp
|
||||
#define sc_r12 sc_regs.r12
|
||||
#define sc_sp sc_regs.sp
|
||||
#define sc_lr sc_regs.lr
|
||||
#define sc_pc sc_regs.pc
|
||||
#define sc_psr sc_regs.psr
|
||||
#endif /* !_LOCORE */
|
||||
|
||||
#if defined(__minix) && defined(_NETBSD_SOURCE)
|
||||
/* Signals codes */
|
||||
|
||||
/*
|
||||
* SIGFPE codes
|
||||
*
|
||||
* see ieeefp.h for definition of FP exception codes
|
||||
*/
|
||||
|
||||
#define SIG_CODE_FPE_CODE_MASK 0x00000f00 /* Mask for exception code */
|
||||
#define SIG_CODE_FPE_CODE_SHIFT 8 /* Shift for exception code */
|
||||
#define SIG_CODE_FPE_TYPE_MASK 0x000000ff /* Mask for specific code */
|
||||
|
||||
/*
|
||||
* SIGILL codes
|
||||
*
|
||||
* the signal code is the instruction that raised the signal
|
||||
*/
|
||||
|
||||
/*
|
||||
* SIGBUS and SIGSEGV codes
|
||||
*
|
||||
* The signal code is combination of the fault address and the fault code.
|
||||
*
|
||||
* The fault code is the coproc #15 fault status code
|
||||
*
|
||||
* The exception to this is a SIGBUS or SIGSEGV from a prefetch abort.
|
||||
* In this case the fault status code is not valid so the TYPE_MASK
|
||||
* should be treated as undefined (in practice it is the bottom 4 bits
|
||||
* of the fault address).
|
||||
*/
|
||||
|
||||
#define SIG_CODE_BUS_ADDR_MASK 0xfffffff0
|
||||
#define SIG_CODE_BUS_TYPE_MASK 0x0000000f
|
||||
#define SIG_CODE_SEGV_ADDR_MASK SIG_CODE_BUS_ADDR_MASK
|
||||
#define SIG_CODE_SEGV_TYPE_MASK SIG_CODE_BUS_TYPE_MASK
|
||||
|
||||
#endif /* _NETBSD_SOURCE */
|
||||
|
||||
#if defined(__minix)
|
||||
__BEGIN_DECLS
|
||||
int sigreturn(struct sigcontext *_scp);
|
||||
__END_DECLS
|
||||
#endif /* defined(__minix) && defined(_NETBSD_SOURCE) */
|
||||
#endif /* defined(__minix) */
|
||||
|
||||
#endif /* !_ARM_SIGNAL_H_ */
|
||||
|
||||
/* End of signal.h */
|
||||
|
||||
@@ -7,7 +7,7 @@ INCS= ansi.h asm.h \
|
||||
cdefs.h cpu.h \
|
||||
disklabel.h \
|
||||
elf_machdep.h endian.h endian_machdep.h \
|
||||
float.h \
|
||||
float.h frame.h \
|
||||
ieee.h ieeefp.h \
|
||||
int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \
|
||||
\
|
||||
|
||||
3
sys/arch/evbarm/include/frame.h
Normal file
3
sys/arch/evbarm/include/frame.h
Normal file
@@ -0,0 +1,3 @@
|
||||
/* $NetBSD: frame.h,v 1.2 2001/11/25 15:56:04 thorpej Exp $ */
|
||||
|
||||
#include <arm/arm32/frame.h>
|
||||
@@ -17,7 +17,7 @@ INCS= ansi.h asm.h \
|
||||
limits.h \
|
||||
math.h mcontext.h mutex.h multiboot.h \
|
||||
npx.h \
|
||||
param.h pio.h profile.h ptrace.h \
|
||||
param.h pio.h profile.h ptrace.h trap.h \
|
||||
\
|
||||
rwlock.h \
|
||||
setjmp.h signal.h \
|
||||
|
||||
@@ -144,15 +144,26 @@ struct switchframe {
|
||||
int sf_eip;
|
||||
};
|
||||
|
||||
#ifdef _KERNEL
|
||||
#if defined(_KERNEL) || defined(__minix)
|
||||
/*
|
||||
* Old-style signal frame
|
||||
*/
|
||||
struct sigframe_sigcontext {
|
||||
#ifdef __minix
|
||||
/* ret addr + stackframe for handler */
|
||||
int sf_ra_sigreturn; /* first return to sigreturn */
|
||||
#else
|
||||
int sf_ra; /* return address for handler */
|
||||
#endif
|
||||
int sf_signum; /* "signum" argument for handler */
|
||||
int sf_code; /* "code" argument for handler */
|
||||
struct sigcontext *sf_scp; /* "scp" argument for handler */
|
||||
#ifdef __minix
|
||||
/* ret addr + stackframe for sigreturn */
|
||||
uint32_t sf_fp; /* saved FP */
|
||||
int sf_ra; /* actual return address for handler */
|
||||
struct sigcontext *sf_scpcopy; /* minix scp copy */
|
||||
#endif
|
||||
struct sigcontext sf_sc; /* actual saved context */
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -1,63 +1,128 @@
|
||||
/* $NetBSD: signal.h,v 1.29 2008/11/19 18:35:59 ad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1991 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)signal.h 7.16 (Berkeley) 3/17/91
|
||||
*/
|
||||
|
||||
#ifndef _I386_SIGNAL_H_
|
||||
#define _I386_SIGNAL_H_
|
||||
|
||||
#include <sys/featuretest.h>
|
||||
|
||||
#ifdef __minix
|
||||
#include <machine/fpu.h>
|
||||
#endif
|
||||
|
||||
typedef int sig_atomic_t;
|
||||
|
||||
/* The following structure should match the stackframe_s structure used
|
||||
* by the kernel's context switching code. Floating point registers should
|
||||
* be added in a different struct.
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
/*
|
||||
* Get the "code" values
|
||||
*/
|
||||
#include <machine/trap.h>
|
||||
|
||||
#include <machine/stackframe.h>
|
||||
#include <machine/fpu.h>
|
||||
#if defined(_KERNEL) || defined(__minix)
|
||||
/*
|
||||
* Information pushed on stack when a signal is delivered.
|
||||
* This is used by the kernel to restore state following
|
||||
* execution of the signal handler. It is also made available
|
||||
* to the handler to allow it to restore state properly if
|
||||
* a non-standard exit is performed.
|
||||
*/
|
||||
struct sigcontext13 {
|
||||
int sc_gs;
|
||||
int sc_fs;
|
||||
int sc_es;
|
||||
int sc_ds;
|
||||
int sc_edi;
|
||||
int sc_esi;
|
||||
int sc_ebp;
|
||||
int sc_ebx;
|
||||
int sc_edx;
|
||||
int sc_ecx;
|
||||
int sc_eax;
|
||||
/* XXX */
|
||||
int sc_eip;
|
||||
int sc_cs;
|
||||
int sc_eflags;
|
||||
int sc_esp;
|
||||
int sc_ss;
|
||||
|
||||
typedef struct stackframe_s sigregs;
|
||||
struct sigframe { /* stack frame created for signalled process */
|
||||
void (*sf_retadr)(void);
|
||||
int sf_signo;
|
||||
int sf_code;
|
||||
struct sigcontext *sf_scp;
|
||||
int sf_fp;
|
||||
void (*sf_retadr2)(void);
|
||||
struct sigcontext *sf_scpcopy;
|
||||
int sc_onstack; /* sigstack state to restore */
|
||||
int sc_mask; /* signal mask to restore (old style) */
|
||||
|
||||
int sc_trapno; /* XXX should be above */
|
||||
int sc_err;
|
||||
};
|
||||
|
||||
struct sigcontext {
|
||||
int trap_style; /* how should context be restored? KTS_* */
|
||||
int sc_flags; /* sigstack state to restore (including
|
||||
* MF_FPU_INITIALIZED)
|
||||
*/
|
||||
sigset_t sc_mask; /* signal mask to restore */
|
||||
sigregs sc_regs; /* register set to restore */
|
||||
union fpu_state_u sc_fpu_state;
|
||||
int sc_gs;
|
||||
int sc_fs;
|
||||
int sc_es;
|
||||
int sc_ds;
|
||||
int sc_edi;
|
||||
int sc_esi;
|
||||
int sc_ebp;
|
||||
int sc_ebx;
|
||||
int sc_edx;
|
||||
int sc_ecx;
|
||||
int sc_eax;
|
||||
/* XXX */
|
||||
int sc_eip;
|
||||
int sc_cs;
|
||||
int sc_eflags;
|
||||
int sc_esp;
|
||||
int sc_ss;
|
||||
|
||||
int sc_onstack; /* sigstack state to restore */
|
||||
int __sc_mask13; /* signal mask to restore (old style) */
|
||||
|
||||
int sc_trapno; /* XXX should be above */
|
||||
int sc_err;
|
||||
|
||||
sigset_t sc_mask; /* signal mask to restore (new style) */
|
||||
#ifdef __minix
|
||||
union fpu_state_u sc_fpu_state;
|
||||
int trap_style; /* KTS_* method of entering kernel */
|
||||
int sc_flags; /* MF_FPU_INITIALIZED if fpu state valid */
|
||||
#define SC_MAGIC 0xc0ffee1
|
||||
int sc_magic;
|
||||
#endif
|
||||
};
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#define sc_gs sc_regs.gs
|
||||
#define sc_fs sc_regs.fs
|
||||
#define sc_es sc_regs.es
|
||||
#define sc_ds sc_regs.ds
|
||||
#define sc_di sc_regs.di
|
||||
#define sc_si sc_regs.si
|
||||
#define sc_fp sc_regs.bp
|
||||
#define sc_st sc_regs.st /* stack top -- used in kernel */
|
||||
#define sc_bx sc_regs.bx
|
||||
#define sc_dx sc_regs.dx
|
||||
#define sc_cx sc_regs.cx
|
||||
#define sc_retreg sc_regs.retreg
|
||||
#define sc_retadr sc_regs.retadr /* return address to caller of
|
||||
save -- used in kernel */
|
||||
#define sc_pc sc_regs.pc
|
||||
#define sc_cs sc_regs.cs
|
||||
#define sc_psw sc_regs.psw
|
||||
#define sc_sp sc_regs.sp
|
||||
#define sc_ss sc_regs.ss
|
||||
|
||||
#if defined(__minix) && defined(_NETBSD_SOURCE)
|
||||
#if defined(__minix)
|
||||
__BEGIN_DECLS
|
||||
int sigreturn(struct sigcontext *_scp);
|
||||
int sigreturn(struct sigcontext *_scp);
|
||||
__END_DECLS
|
||||
#endif /* defined(__minix) && defined(_NETBSD_SOURCE) */
|
||||
#endif /* defined(__minix) */
|
||||
|
||||
#endif /* _NETBSD_SOURCE */
|
||||
#endif /* !_I386_SIGNAL_H_ */
|
||||
|
||||
3
sys/arch/i386/include/trap.h
Normal file
3
sys/arch/i386/include/trap.h
Normal file
@@ -0,0 +1,3 @@
|
||||
/* $NetBSD: trap.h,v 1.7 2003/02/26 21:29:03 fvdl Exp $ */
|
||||
|
||||
#include <x86/trap.h>
|
||||
Reference in New Issue
Block a user