patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / include / asm-sparc / signal.h
1 /* $Id: signal.h,v 1.35 1999/09/06 08:22:04 jj Exp $ */
2 #ifndef _ASMSPARC_SIGNAL_H
3 #define _ASMSPARC_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 #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
86 #define __OLD_NSIG      32
87 #define __NEW_NSIG      64
88 #define _NSIG_BPW       32
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 __old_sigset_t  old_sigset_t
99 #define __old_sigaction old_sigaction
100 #else
101 #define _NSIG           __OLD_NSIG
102 #define __old_sigset_t  sigset_t
103 #define __old_sigaction sigaction
104 #endif
105
106 #ifndef __ASSEMBLY__
107
108 typedef unsigned long __old_sigset_t;
109
110 typedef struct {
111         unsigned long   sig[_NSIG_WORDS];
112 } __new_sigset_t;
113
114 /* A SunOS sigstack */
115 struct sigstack {
116         char *the_stack;
117         int   cur_status;
118 };
119
120 /* Sigvec flags */
121 #define _SV_SSTACK    1u    /* This signal handler should use sig-stack */
122 #define _SV_INTR      2u    /* Sig return should not restart system call */
123 #define _SV_RESET     4u    /* Set handler to SIG_DFL upon taken signal */
124 #define _SV_IGNCHILD  8u    /* Do not send SIGCHLD */
125
126 /*
127  * sa_flags values: SA_STACK is not currently supported, but will allow the
128  * usage of signal stacks by using the (now obsolete) sa_restorer field in
129  * the sigaction structure as a stack pointer. This is now possible due to
130  * the changes in signal handling. LBT 010493.
131  * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
132  * SA_RESTART flag to get restarting signals (which were the default long ago)
133  * SA_SHIRQ flag is for shared interrupt support on PCI and EISA.
134  */
135 #define SA_NOCLDSTOP    _SV_IGNCHILD
136 #define SA_STACK        _SV_SSTACK
137 #define SA_ONSTACK      _SV_SSTACK
138 #define SA_RESTART      _SV_INTR
139 #define SA_ONESHOT      _SV_RESET
140 #define SA_INTERRUPT    0x10u
141 #define SA_NOMASK       0x20u
142 #define SA_SHIRQ        0x40u
143 #define SA_NOCLDWAIT    0x100u
144 #define SA_SIGINFO      0x200u
145
146 #define SIG_BLOCK          0x01 /* for blocking signals */
147 #define SIG_UNBLOCK        0x02 /* for unblocking signals */
148 #define SIG_SETMASK        0x04 /* for setting the signal mask */
149
150 /* 
151  * sigaltstack controls
152  */
153 #define SS_ONSTACK      1
154 #define SS_DISABLE      2
155
156 #define MINSIGSTKSZ     4096
157 #define SIGSTKSZ        16384
158
159 #ifdef __KERNEL__
160 /*
161  * These values of sa_flags are used only by the kernel as part of the
162  * irq handling routines.
163  *
164  * SA_INTERRUPT is also used by the irq handling routines.
165  *
166  * DJHR
167  * SA_STATIC_ALLOC is used for the SPARC 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_PROBE SA_ONESHOT
177 #define SA_SAMPLE_RANDOM SA_RESTART
178 #define SA_STATIC_ALLOC         0x80
179 #endif
180
181 /* Type of a signal handler.  */
182 #ifdef __KERNEL__
183 typedef void (*__sighandler_t)(int, int, struct sigcontext *, char *);
184 #else
185 typedef void (*__sighandler_t)(int);
186 #endif
187
188 #define SIG_DFL ((__sighandler_t)0)     /* default signal handling */
189 #define SIG_IGN ((__sighandler_t)1)     /* ignore signal */
190 #define SIG_ERR ((__sighandler_t)-1)    /* error return from signal */
191
192 struct __new_sigaction {
193         __sighandler_t  sa_handler;
194         unsigned long   sa_flags;
195         void            (*sa_restorer)(void);   /* Not used by Linux/SPARC */
196         __new_sigset_t  sa_mask;
197 };
198
199 #ifdef __KERNEL__
200 struct k_sigaction {
201         struct __new_sigaction  sa;
202         void                    __user *ka_restorer;
203 };
204 #endif
205
206 struct __old_sigaction {
207         __sighandler_t  sa_handler;
208         __old_sigset_t  sa_mask;
209         unsigned long   sa_flags;
210         void            (*sa_restorer) (void);  /* not used by Linux/SPARC */
211 };
212
213 typedef struct sigaltstack {
214         void            __user *ss_sp;
215         int             ss_flags;
216         size_t          ss_size;
217 } stack_t;
218
219 #ifdef __KERNEL__
220 struct sparc_deliver_cookie {
221         int restart_syscall;
222         unsigned long orig_i0;
223 };
224
225 struct pt_regs;
226 extern void ptrace_signal_deliver(struct pt_regs *regs, void *cookie);
227
228 #endif /* !(__KERNEL__) */
229
230 #endif /* !(__ASSEMBLY__) */
231
232 #endif /* !(_ASMSPARC_SIGNAL_H) */