VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / include / asm-sparc64 / signal.h
1 /* $Id: signal.h,v 1.9 1999/09/06 08:22:11 jj Exp $ */
2 #ifndef _ASMSPARC64_SIGNAL_H
3 #define _ASMSPARC64_SIGNAL_H
4
5 #include <asm/sigcontext.h>
6
7 #ifdef __KERNEL__
8 #ifndef __ASSEMBLY__
9 #include <linux/config.h>
10 #include <linux/personality.h>
11 #include <linux/types.h>
12 #include <linux/compat.h>
13 #endif
14 #endif
15
16 /* On the Sparc the signal handlers get passed a 'sub-signal' code
17  * for certain signal types, which we document here.
18  */
19 #define SIGHUP           1
20 #define SIGINT           2
21 #define SIGQUIT          3
22 #define SIGILL           4
23 #define    SUBSIG_STACK       0
24 #define    SUBSIG_ILLINST     2
25 #define    SUBSIG_PRIVINST    3
26 #define    SUBSIG_BADTRAP(t)  (0x80 + (t))
27
28 #define SIGTRAP          5
29 #define SIGABRT          6
30 #define SIGIOT           6
31
32 #define SIGEMT           7
33 #define    SUBSIG_TAG    10
34
35 #define SIGFPE           8
36 #define    SUBSIG_FPDISABLED     0x400
37 #define    SUBSIG_FPERROR        0x404
38 #define    SUBSIG_FPINTOVFL      0x001
39 #define    SUBSIG_FPSTSIG        0x002
40 #define    SUBSIG_IDIVZERO       0x014
41 #define    SUBSIG_FPINEXACT      0x0c4
42 #define    SUBSIG_FPDIVZERO      0x0c8
43 #define    SUBSIG_FPUNFLOW       0x0cc
44 #define    SUBSIG_FPOPERROR      0x0d0
45 #define    SUBSIG_FPOVFLOW       0x0d4
46
47 #define SIGKILL          9
48 #define SIGBUS          10
49 #define    SUBSIG_BUSTIMEOUT    1
50 #define    SUBSIG_ALIGNMENT     2
51 #define    SUBSIG_MISCERROR     5
52
53 #define SIGSEGV         11
54 #define    SUBSIG_NOMAPPING     3
55 #define    SUBSIG_PROTECTION    4
56 #define    SUBSIG_SEGERROR      5
57
58 #define SIGSYS          12
59
60 #define SIGPIPE         13
61 #define SIGALRM         14
62 #define SIGTERM         15
63 #define SIGURG          16
64
65 /* SunOS values which deviate from the Linux/i386 ones */
66 #define SIGSTOP         17
67 #define SIGTSTP         18
68 #define SIGCONT         19
69 #define SIGCHLD         20
70 #define SIGTTIN         21
71 #define SIGTTOU         22
72 #define SIGIO           23
73 #define SIGPOLL         SIGIO   /* SysV name for SIGIO */
74 #define SIGXCPU         24
75 #define SIGXFSZ         25
76 #define SIGVTALRM       26
77 #define SIGPROF         27
78 #define SIGWINCH        28
79 #define SIGLOST         29
80 #define SIGPWR          SIGLOST
81 #define SIGUSR1         30
82 #define SIGUSR2         31
83
84 /* Most things should be clean enough to redefine this at will, if care
85    is taken to make libc match.  */
86
87 #define __OLD_NSIG      32
88 #define __NEW_NSIG      64
89 #define _NSIG_BPW       64
90 #define _NSIG_WORDS     (__NEW_NSIG / _NSIG_BPW)
91
92 #define SIGRTMIN       32
93 #define SIGRTMAX       __NEW_NSIG
94
95 #if defined(__KERNEL__) || defined(__WANT_POSIX1B_SIGNALS__)
96 #define _NSIG                   __NEW_NSIG
97 #define __new_sigset_t          sigset_t
98 #define __new_sigaction         sigaction
99 #define __new_sigaction32       sigaction32
100 #define __old_sigset_t          old_sigset_t
101 #define __old_sigaction         old_sigaction
102 #define __old_sigaction32       old_sigaction32
103 #else
104 #define _NSIG                   __OLD_NSIG
105 #define NSIG                    _NSIG
106 #define __old_sigset_t          sigset_t
107 #define __old_sigaction         sigaction
108 #define __old_sigaction32       sigaction32
109 #endif
110
111 #ifndef __ASSEMBLY__
112
113 typedef unsigned long __old_sigset_t;            /* at least 32 bits */
114
115 typedef struct {
116        unsigned long sig[_NSIG_WORDS];
117 } __new_sigset_t;
118
119 /* A SunOS sigstack */
120 struct sigstack {
121         /* XXX 32-bit pointers pinhead XXX */
122         char *the_stack;
123         int   cur_status;
124 };
125
126 /* Sigvec flags */
127 #define _SV_SSTACK    1u    /* This signal handler should use sig-stack */
128 #define _SV_INTR      2u    /* Sig return should not restart system call */
129 #define _SV_RESET     4u    /* Set handler to SIG_DFL upon taken signal */
130 #define _SV_IGNCHILD  8u    /* Do not send SIGCHLD */
131
132 /*
133  * sa_flags values: SA_STACK is not currently supported, but will allow the
134  * usage of signal stacks by using the (now obsolete) sa_restorer field in
135  * the sigaction structure as a stack pointer. This is now possible due to
136  * the changes in signal handling. LBT 010493.
137  * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
138  * SA_RESTART flag to get restarting signals (which were the default long ago)
139  * SA_SHIRQ flag is for shared interrupt support on PCI and EISA.
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_INTERRUPT    0x10u
147 #define SA_NOMASK       0x20u
148 #define SA_SHIRQ        0x40u
149 #define SA_NOCLDWAIT    0x100u
150 #define SA_SIGINFO      0x200u
151
152
153 #define SIG_BLOCK          0x01 /* for blocking signals */
154 #define SIG_UNBLOCK        0x02 /* for unblocking signals */
155 #define SIG_SETMASK        0x04 /* for setting the signal mask */
156
157 /* 
158  * sigaltstack controls
159  */
160 #define SS_ONSTACK      1
161 #define SS_DISABLE      2
162
163 #define MINSIGSTKSZ     4096
164 #define SIGSTKSZ        16384
165
166 #ifdef __KERNEL__
167 /*
168  * These values of sa_flags are used only by the kernel as part of the
169  * irq handling routines.
170  *
171  * SA_INTERRUPT is also used by the irq handling routines.
172  *
173  * DJHR
174  * SA_STATIC_ALLOC is used for the SPARC system to indicate that this
175  * interrupt handler's irq structure should be statically allocated
176  * by the request_irq routine.
177  * The alternative is that arch/sparc/kernel/irq.c has carnal knowledge
178  * of interrupt usage and that sucks. Also without a flag like this
179  * it may be possible for the free_irq routine to attempt to free
180  * statically allocated data.. which is NOT GOOD.
181  *
182  */
183 #define SA_PROBE SA_ONESHOT
184 #define SA_SAMPLE_RANDOM SA_RESTART
185 #define SA_STATIC_ALLOC         0x80
186 #endif
187
188 /* Type of a signal handler.  */
189 #ifdef __KERNEL__
190 typedef void __signalfn_t(int);
191 typedef __signalfn_t __user *__sighandler_t;
192
193 typedef void __restorefn_t(void);
194 typedef __restorefn_t __user *__sigrestore_t;
195 #else
196 typedef void (*__sighandler_t)(int);
197 typedef void (*__sigrestore_t)(void);
198 #endif
199
200 #define SIG_DFL ((__sighandler_t)0)     /* default signal handling */
201 #define SIG_IGN ((__sighandler_t)1)     /* ignore signal */
202 #define SIG_ERR ((__sighandler_t)-1)    /* error return from signal */
203
204 struct __new_sigaction {
205         __sighandler_t          sa_handler;
206         unsigned long           sa_flags;
207         __sigrestore_t          sa_restorer;  /* not used by Linux/SPARC yet */
208         __new_sigset_t          sa_mask;
209 };
210
211 #ifdef __KERNEL__
212
213 #ifdef CONFIG_COMPAT
214 struct __new_sigaction32 {
215         unsigned                sa_handler;
216         unsigned int            sa_flags;
217         unsigned                sa_restorer;     /* not used by Linux/SPARC yet */
218         compat_sigset_t         sa_mask;
219 };
220 #endif
221
222 struct k_sigaction {
223         struct __new_sigaction  sa;
224         void __user             *ka_restorer;
225 };
226 #endif
227
228 struct __old_sigaction {
229         __sighandler_t          sa_handler;
230         __old_sigset_t          sa_mask;
231         unsigned long           sa_flags;
232         void                    (*sa_restorer)(void);     /* not used by Linux/SPARC yet */
233 };
234
235 #ifdef __KERNEL__
236
237 #ifdef CONFIG_COMPAT
238 struct __old_sigaction32 {
239         unsigned                sa_handler;
240         compat_old_sigset_t     sa_mask;
241         unsigned int            sa_flags;
242         unsigned                sa_restorer;     /* not used by Linux/SPARC yet */
243 };
244 #endif
245
246 #endif
247
248 typedef struct sigaltstack {
249         void                    __user *ss_sp;
250         int                     ss_flags;
251         size_t                  ss_size;
252 } stack_t;
253
254 #ifdef __KERNEL__
255
256 #ifdef CONFIG_COMPAT
257 typedef struct sigaltstack32 {
258         u32                     ss_sp;
259         int                     ss_flags;
260         compat_size_t           ss_size;
261 } stack_t32;
262 #endif
263
264 struct signal_deliver_cookie {
265         int restart_syscall;
266         unsigned long orig_i0;
267 };
268
269 struct pt_regs;
270 extern void ptrace_signal_deliver(struct pt_regs *regs, void *cookie);
271
272 #endif /* !(__KERNEL__) */
273
274 #endif /* !(__ASSEMBLY__) */
275
276 #endif /* !(_ASMSPARC64_SIGNAL_H) */