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