blob: e49b828a2471d57cca8e5aa723acc3a011a9d390 [file] [log] [blame]
Sam Ravnborgece93482009-01-02 19:21:06 -08001#ifndef __SPARC_SIGNAL_H
2#define __SPARC_SIGNAL_H
3
4#include <asm/sigcontext.h>
5#include <linux/compiler.h>
6
7#ifdef __KERNEL__
8#ifndef __ASSEMBLY__
9#include <linux/personality.h>
10#include <linux/types.h>
11#endif
12#endif
13
14/* On the Sparc the signal handlers get passed a 'sub-signal' code
15 * for certain signal types, which we document here.
16 */
17#define SIGHUP 1
18#define SIGINT 2
19#define SIGQUIT 3
20#define SIGILL 4
21#define SUBSIG_STACK 0
22#define SUBSIG_ILLINST 2
23#define SUBSIG_PRIVINST 3
24#define SUBSIG_BADTRAP(t) (0x80 + (t))
25
26#define SIGTRAP 5
27#define SIGABRT 6
28#define SIGIOT 6
29
30#define SIGEMT 7
31#define SUBSIG_TAG 10
32
33#define SIGFPE 8
34#define SUBSIG_FPDISABLED 0x400
35#define SUBSIG_FPERROR 0x404
36#define SUBSIG_FPINTOVFL 0x001
37#define SUBSIG_FPSTSIG 0x002
38#define SUBSIG_IDIVZERO 0x014
39#define SUBSIG_FPINEXACT 0x0c4
40#define SUBSIG_FPDIVZERO 0x0c8
41#define SUBSIG_FPUNFLOW 0x0cc
42#define SUBSIG_FPOPERROR 0x0d0
43#define SUBSIG_FPOVFLOW 0x0d4
44
45#define SIGKILL 9
46#define SIGBUS 10
47#define SUBSIG_BUSTIMEOUT 1
48#define SUBSIG_ALIGNMENT 2
49#define SUBSIG_MISCERROR 5
50
51#define SIGSEGV 11
52#define SUBSIG_NOMAPPING 3
53#define SUBSIG_PROTECTION 4
54#define SUBSIG_SEGERROR 5
55
56#define SIGSYS 12
57
58#define SIGPIPE 13
59#define SIGALRM 14
60#define SIGTERM 15
61#define SIGURG 16
62
63/* SunOS values which deviate from the Linux/i386 ones */
64#define SIGSTOP 17
65#define SIGTSTP 18
66#define SIGCONT 19
67#define SIGCHLD 20
68#define SIGTTIN 21
69#define SIGTTOU 22
70#define SIGIO 23
71#define SIGPOLL SIGIO /* SysV name for SIGIO */
72#define SIGXCPU 24
73#define SIGXFSZ 25
74#define SIGVTALRM 26
75#define SIGPROF 27
76#define SIGWINCH 28
77#define SIGLOST 29
78#define SIGPWR SIGLOST
79#define SIGUSR1 30
80#define SIGUSR2 31
81
82/* Most things should be clean enough to redefine this at will, if care
83 is taken to make libc match. */
84
85#define __OLD_NSIG 32
86#define __NEW_NSIG 64
David S. Millerfc4dbea2009-01-10 23:44:45 -080087#ifdef __arch64__
Sam Ravnborgece93482009-01-02 19:21:06 -080088#define _NSIG_BPW 64
David S. Millerfc4dbea2009-01-10 23:44:45 -080089#else
90#define _NSIG_BPW 32
91#endif
Sam Ravnborgece93482009-01-02 19:21:06 -080092#define _NSIG_WORDS (__NEW_NSIG / _NSIG_BPW)
93
94#define SIGRTMIN 32
95#define SIGRTMAX __NEW_NSIG
96
97#if defined(__KERNEL__) || defined(__WANT_POSIX1B_SIGNALS__)
98#define _NSIG __NEW_NSIG
99#define __new_sigset_t sigset_t
100#define __new_sigaction sigaction
101#define __new_sigaction32 sigaction32
102#define __old_sigset_t old_sigset_t
103#define __old_sigaction old_sigaction
104#define __old_sigaction32 old_sigaction32
Sam Ravnborga439fe52008-07-27 23:00:59 +0200105#else
Sam Ravnborgece93482009-01-02 19:21:06 -0800106#define _NSIG __OLD_NSIG
107#define NSIG _NSIG
108#define __old_sigset_t sigset_t
109#define __old_sigaction sigaction
110#define __old_sigaction32 sigaction32
Sam Ravnborga439fe52008-07-27 23:00:59 +0200111#endif
Sam Ravnborgece93482009-01-02 19:21:06 -0800112
113#ifndef __ASSEMBLY__
114
115typedef unsigned long __old_sigset_t; /* at least 32 bits */
116
117typedef struct {
118 unsigned long sig[_NSIG_WORDS];
119} __new_sigset_t;
120
121/* A SunOS sigstack */
122struct sigstack {
123 /* XXX 32-bit pointers pinhead XXX */
124 char *the_stack;
125 int cur_status;
126};
127
128/* Sigvec flags */
129#define _SV_SSTACK 1u /* This signal handler should use sig-stack */
130#define _SV_INTR 2u /* Sig return should not restart system call */
131#define _SV_RESET 4u /* Set handler to SIG_DFL upon taken signal */
132#define _SV_IGNCHILD 8u /* Do not send SIGCHLD */
133
134/*
135 * sa_flags values: SA_STACK is not currently supported, but will allow the
136 * usage of signal stacks by using the (now obsolete) sa_restorer field in
137 * the sigaction structure as a stack pointer. This is now possible due to
138 * the changes in signal handling. LBT 010493.
139 * SA_RESTART flag to get restarting signals (which were the default long ago)
140 */
141#define SA_NOCLDSTOP _SV_IGNCHILD
142#define SA_STACK _SV_SSTACK
143#define SA_ONSTACK _SV_SSTACK
144#define SA_RESTART _SV_INTR
145#define SA_ONESHOT _SV_RESET
146#define SA_NOMASK 0x20u
147#define SA_NOCLDWAIT 0x100u
148#define SA_SIGINFO 0x200u
149
150
151#define SIG_BLOCK 0x01 /* for blocking signals */
152#define SIG_UNBLOCK 0x02 /* for unblocking signals */
153#define SIG_SETMASK 0x04 /* for setting the signal mask */
154
155/*
156 * sigaltstack controls
157 */
158#define SS_ONSTACK 1
159#define SS_DISABLE 2
160
161#define MINSIGSTKSZ 4096
162#define SIGSTKSZ 16384
163
164#ifdef __KERNEL__
165/*
166 * DJHR
167 * SA_STATIC_ALLOC is used for the sparc32 system to indicate that this
168 * interrupt handler's irq structure should be statically allocated
169 * by the request_irq routine.
170 * The alternative is that arch/sparc/kernel/irq.c has carnal knowledge
171 * of interrupt usage and that sucks. Also without a flag like this
172 * it may be possible for the free_irq routine to attempt to free
173 * statically allocated data.. which is NOT GOOD.
174 *
175 */
176#define SA_STATIC_ALLOC 0x8000
Sam Ravnborga439fe52008-07-27 23:00:59 +0200177#endif
Sam Ravnborgece93482009-01-02 19:21:06 -0800178
Arnd Bergmann63b852a2009-05-13 22:56:24 +0000179#include <asm-generic/signal-defs.h>
Sam Ravnborgece93482009-01-02 19:21:06 -0800180
181struct __new_sigaction {
182 __sighandler_t sa_handler;
183 unsigned long sa_flags;
184 __sigrestore_t sa_restorer; /* not used by Linux/SPARC yet */
185 __new_sigset_t sa_mask;
186};
187
188struct __old_sigaction {
189 __sighandler_t sa_handler;
190 __old_sigset_t sa_mask;
191 unsigned long sa_flags;
192 void (*sa_restorer)(void); /* not used by Linux/SPARC yet */
193};
194
195typedef struct sigaltstack {
196 void __user *ss_sp;
197 int ss_flags;
198 size_t ss_size;
199} stack_t;
200
201#ifdef __KERNEL__
202
203struct k_sigaction {
204 struct __new_sigaction sa;
205 void __user *ka_restorer;
206};
207
208#define ptrace_signal_deliver(regs, cookie) do { } while (0)
209
210#endif /* !(__KERNEL__) */
211
212#endif /* !(__ASSEMBLY__) */
213
214#endif /* !(__SPARC_SIGNAL_H) */