1*2a9e0f66Sthorpej /* $NetBSD: signal.h,v 1.20 2021/10/30 19:54:58 thorpej Exp $ */ 28df38747Sbjh21 38df38747Sbjh21 /* 48df38747Sbjh21 * Copyright (c) 1994-1996 Mark Brinicombe. 58df38747Sbjh21 * Copyright (c) 1994 Brini. 68df38747Sbjh21 * All rights reserved. 78df38747Sbjh21 * 88df38747Sbjh21 * This code is derived from software written for Brini by Mark Brinicombe 98df38747Sbjh21 * 108df38747Sbjh21 * Redistribution and use in source and binary forms, with or without 118df38747Sbjh21 * modification, are permitted provided that the following conditions 128df38747Sbjh21 * are met: 138df38747Sbjh21 * 1. Redistributions of source code must retain the above copyright 148df38747Sbjh21 * notice, this list of conditions and the following disclaimer. 158df38747Sbjh21 * 2. Redistributions in binary form must reproduce the above copyright 168df38747Sbjh21 * notice, this list of conditions and the following disclaimer in the 178df38747Sbjh21 * documentation and/or other materials provided with the distribution. 188df38747Sbjh21 * 3. All advertising materials mentioning features or use of this software 198df38747Sbjh21 * must display the following acknowledgement: 208df38747Sbjh21 * This product includes software developed by Brini. 218df38747Sbjh21 * 4. The name of the company nor the name of the author may be used to 228df38747Sbjh21 * endorse or promote products derived from this software without specific 238df38747Sbjh21 * prior written permission. 248df38747Sbjh21 * 258df38747Sbjh21 * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED 268df38747Sbjh21 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 278df38747Sbjh21 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 288df38747Sbjh21 * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 298df38747Sbjh21 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 308df38747Sbjh21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 318df38747Sbjh21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 328df38747Sbjh21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 338df38747Sbjh21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 348df38747Sbjh21 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 358df38747Sbjh21 * SUCH DAMAGE. 368df38747Sbjh21 * 378df38747Sbjh21 * RiscBSD kernel project 388df38747Sbjh21 * 398df38747Sbjh21 * signal.h 408df38747Sbjh21 * 414cbd24b2Swiz * Architecture dependent signal types and structures 428df38747Sbjh21 * 438df38747Sbjh21 * Created : 30/09/94 448df38747Sbjh21 */ 458df38747Sbjh21 462e13731dSmatt #ifndef _ARM_SIGNAL_H_ 472e13731dSmatt #define _ARM_SIGNAL_H_ 488df38747Sbjh21 494be7a2dcSbjh21 #include <sys/featuretest.h> 5054470733Schristos #include <sys/sigtypes.h> 514be7a2dcSbjh21 528df38747Sbjh21 #ifndef _LOCORE 538df38747Sbjh21 typedef int sig_atomic_t; 548df38747Sbjh21 #endif 558df38747Sbjh21 56fe33aa27Sryo #if defined(__arm__) 57fe33aa27Sryo 58*2a9e0f66Sthorpej #define __HAVE_STRUCT_SIGCONTEXT 59*2a9e0f66Sthorpej 604be7a2dcSbjh21 #if defined(_NETBSD_SOURCE) 6109382188Sbriggs 628df38747Sbjh21 #ifndef _LOCORE 638df38747Sbjh21 /* 648df38747Sbjh21 * Information pushed on stack when a signal is delivered. 658df38747Sbjh21 * This is used by the kernel to restore state following 668df38747Sbjh21 * execution of the signal handler. It is also made available 678df38747Sbjh21 * to the handler to allow it to restore state properly if 688df38747Sbjh21 * a non-standard exit is performed. 698df38747Sbjh21 */ 708df38747Sbjh21 714bb7c263Sthorpej #if defined(_KERNEL) 728df38747Sbjh21 struct sigcontext13 { 738df38747Sbjh21 int sc_onstack; /* sigstack state to restore */ 748df38747Sbjh21 int sc_mask; /* signal mask to restore (old style) */ 758df38747Sbjh21 768df38747Sbjh21 unsigned int sc_spsr; 778df38747Sbjh21 unsigned int sc_r0; 788df38747Sbjh21 unsigned int sc_r1; 798df38747Sbjh21 unsigned int sc_r2; 808df38747Sbjh21 unsigned int sc_r3; 818df38747Sbjh21 unsigned int sc_r4; 828df38747Sbjh21 unsigned int sc_r5; 838df38747Sbjh21 unsigned int sc_r6; 848df38747Sbjh21 unsigned int sc_r7; 858df38747Sbjh21 unsigned int sc_r8; 868df38747Sbjh21 unsigned int sc_r9; 878df38747Sbjh21 unsigned int sc_r10; 888df38747Sbjh21 unsigned int sc_r11; 898df38747Sbjh21 unsigned int sc_r12; 908df38747Sbjh21 unsigned int sc_usr_sp; 918df38747Sbjh21 unsigned int sc_usr_lr; 928df38747Sbjh21 unsigned int sc_svc_lr; 938df38747Sbjh21 unsigned int sc_pc; 948df38747Sbjh21 }; 954bb7c263Sthorpej #endif /* _KERNEL */ 968df38747Sbjh21 974bb7c263Sthorpej #if defined(_LIBC) || defined(_KERNEL) 988df38747Sbjh21 struct sigcontext { 998df38747Sbjh21 int sc_onstack; /* sigstack state to restore */ 1008df38747Sbjh21 int __sc_mask13; /* signal mask to restore (old style) */ 1018df38747Sbjh21 1028df38747Sbjh21 unsigned int sc_spsr; 1038df38747Sbjh21 unsigned int sc_r0; 1048df38747Sbjh21 unsigned int sc_r1; 1058df38747Sbjh21 unsigned int sc_r2; 1068df38747Sbjh21 unsigned int sc_r3; 1078df38747Sbjh21 unsigned int sc_r4; 1088df38747Sbjh21 unsigned int sc_r5; 1098df38747Sbjh21 unsigned int sc_r6; 1108df38747Sbjh21 unsigned int sc_r7; 1118df38747Sbjh21 unsigned int sc_r8; 1128df38747Sbjh21 unsigned int sc_r9; 1138df38747Sbjh21 unsigned int sc_r10; 1148df38747Sbjh21 unsigned int sc_r11; 1158df38747Sbjh21 unsigned int sc_r12; 1168df38747Sbjh21 unsigned int sc_usr_sp; 1178df38747Sbjh21 unsigned int sc_usr_lr; 1188df38747Sbjh21 unsigned int sc_svc_lr; 1198df38747Sbjh21 unsigned int sc_pc; 1208df38747Sbjh21 1218df38747Sbjh21 sigset_t sc_mask; /* signal mask to restore (new style) */ 1228df38747Sbjh21 }; 1234bb7c263Sthorpej #endif /* _LIBC || _KERNEL */ 1248df38747Sbjh21 1258df38747Sbjh21 #endif /* !_LOCORE */ 1268df38747Sbjh21 1278df38747Sbjh21 /* Signals codes */ 1288df38747Sbjh21 1298df38747Sbjh21 /* 1308df38747Sbjh21 * SIGFPE codes 1318df38747Sbjh21 * 1328df38747Sbjh21 * see ieeefp.h for definition of FP exception codes 1338df38747Sbjh21 */ 1348df38747Sbjh21 1358df38747Sbjh21 #define SIG_CODE_FPE_CODE_MASK 0x00000f00 /* Mask for exception code */ 1368df38747Sbjh21 #define SIG_CODE_FPE_CODE_SHIFT 8 /* Shift for exception code */ 1378df38747Sbjh21 #define SIG_CODE_FPE_TYPE_MASK 0x000000ff /* Mask for specific code */ 1388df38747Sbjh21 1398df38747Sbjh21 /* 1408df38747Sbjh21 * SIGILL codes 1418df38747Sbjh21 * 1428df38747Sbjh21 * the signal code is the instruction that raised the signal 1438df38747Sbjh21 */ 1448df38747Sbjh21 1458df38747Sbjh21 /* 1468df38747Sbjh21 * SIGBUS and SIGSEGV codes 1478df38747Sbjh21 * 1488df38747Sbjh21 * The signal code is combination of the fault address and the fault code. 1498df38747Sbjh21 * 1508df38747Sbjh21 * The fault code is the coproc #15 fault status code 1518df38747Sbjh21 * 1528df38747Sbjh21 * The exception to this is a SIGBUS or SIGSEGV from a prefetch abort. 1538df38747Sbjh21 * In this case the fault status code is not valid so the TYPE_MASK 1548df38747Sbjh21 * should be treated as undefined (in practice it is the bottom 4 bits 1558df38747Sbjh21 * of the fault address). 1568df38747Sbjh21 */ 1578df38747Sbjh21 1588df38747Sbjh21 #define SIG_CODE_BUS_ADDR_MASK 0xfffffff0 1598df38747Sbjh21 #define SIG_CODE_BUS_TYPE_MASK 0x0000000f 1608df38747Sbjh21 #define SIG_CODE_SEGV_ADDR_MASK SIG_CODE_BUS_ADDR_MASK 1618df38747Sbjh21 #define SIG_CODE_SEGV_TYPE_MASK SIG_CODE_BUS_TYPE_MASK 1628df38747Sbjh21 1634be7a2dcSbjh21 #endif /* _NETBSD_SOURCE */ 164fe33aa27Sryo #endif /* __arm__ */ 1658df38747Sbjh21 #endif /* !_ARM_SIGNAL_H_ */ 1668df38747Sbjh21 1678df38747Sbjh21 /* End of signal.h */ 168