Home | History | Annotate | Line # | Download | only in include
signal.h revision 1.15
      1 /*	$NetBSD: signal.h,v 1.15 2018/04/01 04:35:04 ryo Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1994-1996 Mark Brinicombe.
      5  * Copyright (c) 1994 Brini.
      6  * All rights reserved.
      7  *
      8  * This code is derived from software written for Brini by Mark Brinicombe
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  * 3. All advertising materials mentioning features or use of this software
     19  *    must display the following acknowledgement:
     20  *	This product includes software developed by Brini.
     21  * 4. The name of the company nor the name of the author may be used to
     22  *    endorse or promote products derived from this software without specific
     23  *    prior written permission.
     24  *
     25  * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
     26  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     27  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     28  * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
     29  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     30  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     31  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     32  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     34  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     35  * SUCH DAMAGE.
     36  *
     37  * RiscBSD kernel project
     38  *
     39  * signal.h
     40  *
     41  * Architecture dependent signal types and structures
     42  *
     43  * Created      : 30/09/94
     44  */
     45 
     46 #ifndef _ARM_SIGNAL_H_
     47 #define _ARM_SIGNAL_H_
     48 
     49 #include <sys/featuretest.h>
     50 #include <sys/sigtypes.h>
     51 
     52 #ifndef _LOCORE
     53 typedef int sig_atomic_t;
     54 #endif
     55 
     56 #if defined(__arm__)
     57 
     58 #if defined(_NETBSD_SOURCE)
     59 
     60 #ifndef _LOCORE
     61 /*
     62  * Information pushed on stack when a signal is delivered.
     63  * This is used by the kernel to restore state following
     64  * execution of the signal handler.  It is also made available
     65  * to the handler to allow it to restore state properly if
     66  * a non-standard exit is performed.
     67  */
     68 
     69 #if defined(__LIBC12_SOURCE__) || defined(_KERNEL)
     70 struct sigcontext13 {
     71 	int	sc_onstack;		/* sigstack state to restore */
     72 	int	sc_mask;		/* signal mask to restore (old style) */
     73 
     74 	unsigned int sc_spsr;
     75 	unsigned int sc_r0;
     76 	unsigned int sc_r1;
     77 	unsigned int sc_r2;
     78 	unsigned int sc_r3;
     79 	unsigned int sc_r4;
     80 	unsigned int sc_r5;
     81 	unsigned int sc_r6;
     82 	unsigned int sc_r7;
     83 	unsigned int sc_r8;
     84 	unsigned int sc_r9;
     85 	unsigned int sc_r10;
     86 	unsigned int sc_r11;
     87 	unsigned int sc_r12;
     88 	unsigned int sc_usr_sp;
     89 	unsigned int sc_usr_lr;
     90 	unsigned int sc_svc_lr;
     91 	unsigned int sc_pc;
     92 };
     93 #endif /* __LIBC12_SOURCE__ || _KERNEL */
     94 
     95 struct sigcontext {
     96 	int	sc_onstack;		/* sigstack state to restore */
     97 	int	__sc_mask13;		/* signal mask to restore (old style) */
     98 
     99 	unsigned int sc_spsr;
    100 	unsigned int sc_r0;
    101 	unsigned int sc_r1;
    102 	unsigned int sc_r2;
    103 	unsigned int sc_r3;
    104 	unsigned int sc_r4;
    105 	unsigned int sc_r5;
    106 	unsigned int sc_r6;
    107 	unsigned int sc_r7;
    108 	unsigned int sc_r8;
    109 	unsigned int sc_r9;
    110 	unsigned int sc_r10;
    111 	unsigned int sc_r11;
    112 	unsigned int sc_r12;
    113 	unsigned int sc_usr_sp;
    114 	unsigned int sc_usr_lr;
    115 	unsigned int sc_svc_lr;
    116 	unsigned int sc_pc;
    117 
    118 	sigset_t sc_mask;		/* signal mask to restore (new style) */
    119 };
    120 
    121 #endif /* !_LOCORE */
    122 
    123 /* Signals codes */
    124 
    125 /*
    126  * SIGFPE codes
    127  *
    128  * see ieeefp.h for definition of FP exception codes
    129  */
    130 
    131 #define SIG_CODE_FPE_CODE_MASK	0x00000f00	/* Mask for exception code */
    132 #define SIG_CODE_FPE_CODE_SHIFT	8		/* Shift for exception code */
    133 #define SIG_CODE_FPE_TYPE_MASK	0x000000ff	/* Mask for specific code */
    134 
    135 /*
    136  * SIGILL codes
    137  *
    138  * the signal code is the instruction that raised the signal
    139  */
    140 
    141 /*
    142  * SIGBUS and SIGSEGV codes
    143  *
    144  * The signal code is combination of the fault address and the fault code.
    145  *
    146  * The fault code is the coproc #15 fault status code
    147  *
    148  * The exception to this is a SIGBUS or SIGSEGV from a prefetch abort.
    149  * In this case the fault status code is not valid so the TYPE_MASK
    150  * should be treated as undefined (in practice it is the bottom 4 bits
    151  * of the fault address).
    152  */
    153 
    154 #define SIG_CODE_BUS_ADDR_MASK	0xfffffff0
    155 #define SIG_CODE_BUS_TYPE_MASK	0x0000000f
    156 #define SIG_CODE_SEGV_ADDR_MASK	SIG_CODE_BUS_ADDR_MASK
    157 #define SIG_CODE_SEGV_TYPE_MASK	SIG_CODE_BUS_TYPE_MASK
    158 
    159 #endif	/* _NETBSD_SOURCE */
    160 #endif	/* __arm__ */
    161 #endif	/* !_ARM_SIGNAL_H_ */
    162 
    163 /* End of signal.h */
    164