1 /* $NetBSD: linux_signal.h,v 1.14 2015/11/14 13:29:35 christos Exp $ */
2 
3 /*-
4  * Copyright (c) 1995, 1998, 2001 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Frank van der Linden, Eric Haszlakiewicz and Emmanuel Dreyfus.
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  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifndef _MIPS_LINUX_SIGNAL_H
33 #define _MIPS_LINUX_SIGNAL_H
34 
35 /*
36  * From Linux's include/asm-mips/ptrace.h
37  */
38 struct linux_pt_regs {
39           unsigned long lpad0[6];
40           unsigned long lregs[32];
41           unsigned long llo;
42           unsigned long lhi;
43           unsigned long lcp0_epc;
44           unsigned long lcp0_badvaddr;
45           unsigned long lcp0_status;
46           unsigned long lcp0_cause;
47 };
48 
49 /*
50  * Everything is from Linux's include/asm-mips/signal.h
51  */
52 #define LINUX_SIGHUP                    1
53 #define LINUX_SIGINT                    2
54 #define LINUX_SIGQUIT                   3
55 #define LINUX_SIGILL                    4
56 #define LINUX_SIGTRAP                   5
57 #define LINUX_SIGABRT                   6
58 #define LINUX_SIGIOT                    6
59 #define LINUX_SIGEMT                    7
60 #define LINUX_SIGFPE                    8
61 #define LINUX_SIGKILL                   9
62 #define LINUX_SIGBUS                    10
63 #define LINUX_SIGSEGV                   11
64 #define LINUX_SIGSYS                    12
65 #define LINUX_SIGPIPE                   13
66 #define LINUX_SIGALRM                   14
67 #define LINUX_SIGTERM                   15
68 #define LINUX_SIGUSR1                   16
69 #define LINUX_SIGUSR2                   17
70 #define LINUX_SIGCHLD                   18
71 #define LINUX_SIGCLD                    18
72 #define LINUX_SIGPWR                    19
73 #define LINUX_SIGWINCH                  20
74 #define LINUX_SIGURG                    21
75 #define LINUX_SIGIO           22
76 #define LINUX_SIGPOLL                   22
77 #define LINUX_SIGSTOP                   23
78 #define LINUX_SIGTSTP                   24
79 #define LINUX_SIGCONT                   25
80 #define LINUX_SIGTTIN                   26
81 #define LINUX_SIGTTOU                   27
82 #define LINUX_SIGVTALRM                 28
83 #define LINUX_SIGPROF                   29
84 #define LINUX_SIGXCPU                   30
85 #define LINUX_SIGXFSZ                   31
86 
87 /* Min/max real-time linux signal */
88 #define LINUX_SIGRTMIN                  32
89 #define LINUX_SIGRTMAX                  (LINUX__NSIG - 1)
90 
91 #define LINUX__NSIG           128
92 #if defined(ELFSIZE) && (ELFSIZE == 64)
93 #define LINUX__NSIG_BPW                 64
94 #else
95 #define LINUX__NSIG_BPW                 32
96 #endif
97 #define LINUX__NSIG_WORDS (LINUX__NSIG / LINUX__NSIG_BPW)
98 
99 #define LINUX_SIG_BLOCK                 1
100 #define LINUX_SIG_UNBLOCK     2
101 #define LINUX_SIG_SETMASK     3
102 
103 /* sa_flags */
104 #define LINUX_SA_NOCLDSTOP    0x00000001
105 #define LINUX_SA_SIGINFO      0x00000008
106 #define LINUX_SA_NOCLDWAIT    0x00010000
107 #define LINUX_SA_ONSTACK      0x08000000
108 #define LINUX_SA_RESTART      0x10000000
109 #define LINUX_SA_NODEFER      0x40000000
110 #define LINUX_SA_RESETHAND    0x80000000
111 #define LINUX_SA_NOMASK                 LINUX_SA_NODEFER
112 #define LINUX_SA_ONESHOT      LINUX_SA_RESETHAND
113 #define LINUX_SA_ALLBITS      0xd8010009
114 /* XXX LINUX_SA_RESTORER has been deprecated; not used any version of glibc */
115 
116 #define   LINUX_MINSIGSTKSZ   2048
117 
118 typedef void (*linux___sighandler_t)(int);
119 
120 typedef unsigned long linux_old_sigset_t;
121 typedef struct {
122           unsigned long sig[LINUX__NSIG_WORDS];
123 } linux_sigset_t;
124 
125 /* Used in rt_* calls. No old_sigaction is defined for MIPS */
126 struct linux_sigaction {
127           unsigned int                  linux_sa_flags;
128           linux___sighandler_t          linux_sa_handler;
129           linux_sigset_t                linux_sa_mask;
130           void                          (*linux_sa_restorer)(void);
131           int                           linux_sa_resv[1];
132 };
133 
134 struct linux_k_sigaction {
135           struct linux_sigaction sa;
136 };
137 
138 struct linux_old_sigaction {
139           unsigned int                  linux_sa_flags;
140           linux___sighandler_t          linux_sa_handler;
141           linux_old_sigset_t  linux_sa_mask;
142           void                          (*linux_sa_restorer)(void);
143           int                           linux_sa_resv[1];
144 };
145 
146 #define   LINUX_SS_ONSTACK    1
147 #define   LINUX_SS_DISABLE    2
148 
149 #define   LINUX_MINSIGSTKSZ   2048
150 #define   LINUX_SIGSTKSZ                8192
151 
152 struct linux_sigaltstack {
153           void *ss_sp;
154           size_t ss_size;
155           int ss_flags;
156 };
157 typedef struct linux_sigaltstack linux_stack_t; /* XXX really needed ? */
158 
159 #endif /* !_MIPS_LINUX_SIGNAL_H */
160