aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/asm-x86/Kbuild2
-rw-r--r--include/asm-x86/signal.h273
-rw-r--r--include/asm-x86/signal_32.h232
-rw-r--r--include/asm-x86/signal_64.h181
4 files changed, 263 insertions, 425 deletions
diff --git a/include/asm-x86/Kbuild b/include/asm-x86/Kbuild
index 4e4de4bfba41..294781c0e604 100644
--- a/include/asm-x86/Kbuild
+++ b/include/asm-x86/Kbuild
@@ -23,8 +23,6 @@ unifdef-y += posix_types_64.h
23unifdef-y += ptrace.h 23unifdef-y += ptrace.h
24unifdef-y += setup_32.h 24unifdef-y += setup_32.h
25unifdef-y += setup_64.h 25unifdef-y += setup_64.h
26unifdef-y += signal_32.h
27unifdef-y += signal_64.h
28unifdef-y += unistd_32.h 26unifdef-y += unistd_32.h
29unifdef-y += unistd_64.h 27unifdef-y += unistd_64.h
30unifdef-y += user_32.h 28unifdef-y += user_32.h
diff --git a/include/asm-x86/signal.h b/include/asm-x86/signal.h
index bf5a63f457da..987a422a2c78 100644
--- a/include/asm-x86/signal.h
+++ b/include/asm-x86/signal.h
@@ -1,13 +1,266 @@
1#ifndef _ASM_X86_SIGNAL_H
2#define _ASM_X86_SIGNAL_H
3
4#ifndef __ASSEMBLY__
5#include <linux/types.h>
6#include <linux/time.h>
7#include <linux/compiler.h>
8
9/* Avoid too many header ordering problems. */
10struct siginfo;
11
1#ifdef __KERNEL__ 12#ifdef __KERNEL__
2# ifdef CONFIG_X86_32 13#include <linux/linkage.h>
3# include "signal_32.h" 14
4# else 15/* Most things should be clean enough to redefine this at will, if care
5# include "signal_64.h" 16 is taken to make libc match. */
6# endif 17
18#define _NSIG 64
19
20#ifdef __i386__
21# define _NSIG_BPW 32
7#else 22#else
8# ifdef __i386__ 23# define _NSIG_BPW 64
9# include "signal_32.h" 24#endif
10# else 25
11# include "signal_64.h" 26#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
12# endif 27
28typedef unsigned long old_sigset_t; /* at least 32 bits */
29
30typedef struct {
31 unsigned long sig[_NSIG_WORDS];
32} sigset_t;
33
34#else
35/* Here we must cater to libcs that poke about in kernel headers. */
36
37#define NSIG 32
38typedef unsigned long sigset_t;
39
40#endif /* __KERNEL__ */
41#endif /* __ASSEMBLY__ */
42
43#define SIGHUP 1
44#define SIGINT 2
45#define SIGQUIT 3
46#define SIGILL 4
47#define SIGTRAP 5
48#define SIGABRT 6
49#define SIGIOT 6
50#define SIGBUS 7
51#define SIGFPE 8
52#define SIGKILL 9
53#define SIGUSR1 10
54#define SIGSEGV 11
55#define SIGUSR2 12
56#define SIGPIPE 13
57#define SIGALRM 14
58#define SIGTERM 15
59#define SIGSTKFLT 16
60#define SIGCHLD 17
61#define SIGCONT 18
62#define SIGSTOP 19
63#define SIGTSTP 20
64#define SIGTTIN 21
65#define SIGTTOU 22
66#define SIGURG 23
67#define SIGXCPU 24
68#define SIGXFSZ 25
69#define SIGVTALRM 26
70#define SIGPROF 27
71#define SIGWINCH 28
72#define SIGIO 29
73#define SIGPOLL SIGIO
74/*
75#define SIGLOST 29
76*/
77#define SIGPWR 30
78#define SIGSYS 31
79#define SIGUNUSED 31
80
81/* These should not be considered constants from userland. */
82#define SIGRTMIN 32
83#define SIGRTMAX _NSIG
84
85/*
86 * SA_FLAGS values:
87 *
88 * SA_ONSTACK indicates that a registered stack_t will be used.
89 * SA_RESTART flag to get restarting signals (which were the default long ago)
90 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
91 * SA_RESETHAND clears the handler when the signal is delivered.
92 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
93 * SA_NODEFER prevents the current signal from being masked in the handler.
94 *
95 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
96 * Unix names RESETHAND and NODEFER respectively.
97 */
98#define SA_NOCLDSTOP 0x00000001u
99#define SA_NOCLDWAIT 0x00000002u
100#define SA_SIGINFO 0x00000004u
101#define SA_ONSTACK 0x08000000u
102#define SA_RESTART 0x10000000u
103#define SA_NODEFER 0x40000000u
104#define SA_RESETHAND 0x80000000u
105
106#define SA_NOMASK SA_NODEFER
107#define SA_ONESHOT SA_RESETHAND
108
109#define SA_RESTORER 0x04000000
110
111/*
112 * sigaltstack controls
113 */
114#define SS_ONSTACK 1
115#define SS_DISABLE 2
116
117#define MINSIGSTKSZ 2048
118#define SIGSTKSZ 8192
119
120#include <asm-generic/signal.h>
121
122#ifndef __ASSEMBLY__
123
124#ifdef __i386__
125# ifdef __KERNEL__
126struct old_sigaction {
127 __sighandler_t sa_handler;
128 old_sigset_t sa_mask;
129 unsigned long sa_flags;
130 __sigrestore_t sa_restorer;
131};
132
133struct sigaction {
134 __sighandler_t sa_handler;
135 unsigned long sa_flags;
136 __sigrestore_t sa_restorer;
137 sigset_t sa_mask; /* mask last for extensibility */
138};
139
140struct k_sigaction {
141 struct sigaction sa;
142};
143# else /* __KERNEL__ */
144/* Here we must cater to libcs that poke about in kernel headers. */
145
146struct sigaction {
147 union {
148 __sighandler_t _sa_handler;
149 void (*_sa_sigaction)(int, struct siginfo *, void *);
150 } _u;
151 sigset_t sa_mask;
152 unsigned long sa_flags;
153 void (*sa_restorer)(void);
154};
155
156#define sa_handler _u._sa_handler
157#define sa_sigaction _u._sa_sigaction
158
159# endif /* ! __KERNEL__ */
160#else /* __i386__ */
161
162struct sigaction {
163 __sighandler_t sa_handler;
164 unsigned long sa_flags;
165 __sigrestore_t sa_restorer;
166 sigset_t sa_mask; /* mask last for extensibility */
167};
168
169struct k_sigaction {
170 struct sigaction sa;
171};
172
173#endif /* !__i386__ */
174
175typedef struct sigaltstack {
176 void __user *ss_sp;
177 int ss_flags;
178 size_t ss_size;
179} stack_t;
180
181#ifdef __KERNEL__
182#include <asm/sigcontext.h>
183
184#ifdef __386__
185
186#define __HAVE_ARCH_SIG_BITOPS
187
188#define sigaddset(set,sig) \
189 (__builtin_constantp(sig) ? \
190 __const_sigaddset((set),(sig)) : \
191 __gen_sigaddset((set),(sig)))
192
193static __inline__ void __gen_sigaddset(sigset_t *set, int _sig)
194{
195 __asm__("btsl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc");
196}
197
198static __inline__ void __const_sigaddset(sigset_t *set, int _sig)
199{
200 unsigned long sig = _sig - 1;
201 set->sig[sig / _NSIG_BPW] |= 1 << (sig % _NSIG_BPW);
202}
203
204#define sigdelset(set,sig) \
205 (__builtin_constant_p(sig) ? \
206 __const_sigdelset((set),(sig)) : \
207 __gen_sigdelset((set),(sig)))
208
209
210static __inline__ void __gen_sigdelset(sigset_t *set, int _sig)
211{
212 __asm__("btrl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc");
213}
214
215static __inline__ void __const_sigdelset(sigset_t *set, int _sig)
216{
217 unsigned long sig = _sig - 1;
218 set->sig[sig / _NSIG_BPW] &= ~(1 << (sig % _NSIG_BPW));
219}
220
221static __inline__ int __const_sigismember(sigset_t *set, int _sig)
222{
223 unsigned long sig = _sig - 1;
224 return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW));
225}
226
227static __inline__ int __gen_sigismember(sigset_t *set, int _sig)
228{
229 int ret;
230 __asm__("btl %2,%1\n\tsbbl %0,%0"
231 : "=r"(ret) : "m"(*set), "Ir"(_sig-1) : "cc");
232 return ret;
233}
234
235#define sigismember(set,sig) \
236 (__builtin_constant_p(sig) ? \
237 __const_sigismember((set),(sig)) : \
238 __gen_sigismember((set),(sig)))
239
240static __inline__ int sigfindinword(unsigned long word)
241{
242 __asm__("bsfl %1,%0" : "=r"(word) : "rm"(word) : "cc");
243 return word;
244}
245
246struct pt_regs;
247
248#define ptrace_signal_deliver(regs, cookie) \
249 do { \
250 if (current->ptrace & PT_DTRACE) { \
251 current->ptrace &= ~PT_DTRACE; \
252 (regs)->eflags &= ~TF_MASK; \
253 } \
254 } while (0)
255
256#else /* __i386__ */
257
258#undef __HAVE_ARCH_SIG_BITOPS
259
260#define ptrace_signal_deliver(regs, cookie) do { } while (0)
261
262#endif /* !__i386__ */
263#endif /* __KERNEL__ */
264#endif /* __ASSEMBLY__ */
265
13#endif 266#endif
diff --git a/include/asm-x86/signal_32.h b/include/asm-x86/signal_32.h
deleted file mode 100644
index c3e8adec5918..000000000000
--- a/include/asm-x86/signal_32.h
+++ /dev/null
@@ -1,232 +0,0 @@
1#ifndef _ASMi386_SIGNAL_H
2#define _ASMi386_SIGNAL_H
3
4#include <linux/types.h>
5#include <linux/time.h>
6#include <linux/compiler.h>
7
8/* Avoid too many header ordering problems. */
9struct siginfo;
10
11#ifdef __KERNEL__
12
13#include <linux/linkage.h>
14
15/* Most things should be clean enough to redefine this at will, if care
16 is taken to make libc match. */
17
18#define _NSIG 64
19#define _NSIG_BPW 32
20#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
21
22typedef unsigned long old_sigset_t; /* at least 32 bits */
23
24typedef struct {
25 unsigned long sig[_NSIG_WORDS];
26} sigset_t;
27
28#else
29/* Here we must cater to libcs that poke about in kernel headers. */
30
31#define NSIG 32
32typedef unsigned long sigset_t;
33
34#endif /* __KERNEL__ */
35
36#define SIGHUP 1
37#define SIGINT 2
38#define SIGQUIT 3
39#define SIGILL 4
40#define SIGTRAP 5
41#define SIGABRT 6
42#define SIGIOT 6
43#define SIGBUS 7
44#define SIGFPE 8
45#define SIGKILL 9
46#define SIGUSR1 10
47#define SIGSEGV 11
48#define SIGUSR2 12
49#define SIGPIPE 13
50#define SIGALRM 14
51#define SIGTERM 15
52#define SIGSTKFLT 16
53#define SIGCHLD 17
54#define SIGCONT 18
55#define SIGSTOP 19
56#define SIGTSTP 20
57#define SIGTTIN 21
58#define SIGTTOU 22
59#define SIGURG 23
60#define SIGXCPU 24
61#define SIGXFSZ 25
62#define SIGVTALRM 26
63#define SIGPROF 27
64#define SIGWINCH 28
65#define SIGIO 29
66#define SIGPOLL SIGIO
67/*
68#define SIGLOST 29
69*/
70#define SIGPWR 30
71#define SIGSYS 31
72#define SIGUNUSED 31
73
74/* These should not be considered constants from userland. */
75#define SIGRTMIN 32
76#define SIGRTMAX _NSIG
77
78/*
79 * SA_FLAGS values:
80 *
81 * SA_ONSTACK indicates that a registered stack_t will be used.
82 * SA_RESTART flag to get restarting signals (which were the default long ago)
83 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
84 * SA_RESETHAND clears the handler when the signal is delivered.
85 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
86 * SA_NODEFER prevents the current signal from being masked in the handler.
87 *
88 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
89 * Unix names RESETHAND and NODEFER respectively.
90 */
91#define SA_NOCLDSTOP 0x00000001u
92#define SA_NOCLDWAIT 0x00000002u
93#define SA_SIGINFO 0x00000004u
94#define SA_ONSTACK 0x08000000u
95#define SA_RESTART 0x10000000u
96#define SA_NODEFER 0x40000000u
97#define SA_RESETHAND 0x80000000u
98
99#define SA_NOMASK SA_NODEFER
100#define SA_ONESHOT SA_RESETHAND
101
102#define SA_RESTORER 0x04000000
103
104/*
105 * sigaltstack controls
106 */
107#define SS_ONSTACK 1
108#define SS_DISABLE 2
109
110#define MINSIGSTKSZ 2048
111#define SIGSTKSZ 8192
112
113#include <asm-generic/signal.h>
114
115#ifdef __KERNEL__
116struct old_sigaction {
117 __sighandler_t sa_handler;
118 old_sigset_t sa_mask;
119 unsigned long sa_flags;
120 __sigrestore_t sa_restorer;
121};
122
123struct sigaction {
124 __sighandler_t sa_handler;
125 unsigned long sa_flags;
126 __sigrestore_t sa_restorer;
127 sigset_t sa_mask; /* mask last for extensibility */
128};
129
130struct k_sigaction {
131 struct sigaction sa;
132};
133#else
134/* Here we must cater to libcs that poke about in kernel headers. */
135
136struct sigaction {
137 union {
138 __sighandler_t _sa_handler;
139 void (*_sa_sigaction)(int, struct siginfo *, void *);
140 } _u;
141 sigset_t sa_mask;
142 unsigned long sa_flags;
143 void (*sa_restorer)(void);
144};
145
146#define sa_handler _u._sa_handler
147#define sa_sigaction _u._sa_sigaction
148
149#endif /* __KERNEL__ */
150
151typedef struct sigaltstack {
152 void __user *ss_sp;
153 int ss_flags;
154 size_t ss_size;
155} stack_t;
156
157#ifdef __KERNEL__
158#include <asm/sigcontext.h>
159
160#define __HAVE_ARCH_SIG_BITOPS
161
162#define sigaddset(set,sig) \
163 (__builtin_constant_p(sig) ? \
164 __const_sigaddset((set),(sig)) : \
165 __gen_sigaddset((set),(sig)))
166
167static __inline__ void __gen_sigaddset(sigset_t *set, int _sig)
168{
169 __asm__("btsl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc");
170}
171
172static __inline__ void __const_sigaddset(sigset_t *set, int _sig)
173{
174 unsigned long sig = _sig - 1;
175 set->sig[sig / _NSIG_BPW] |= 1 << (sig % _NSIG_BPW);
176}
177
178#define sigdelset(set,sig) \
179 (__builtin_constant_p(sig) ? \
180 __const_sigdelset((set),(sig)) : \
181 __gen_sigdelset((set),(sig)))
182
183
184static __inline__ void __gen_sigdelset(sigset_t *set, int _sig)
185{
186 __asm__("btrl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc");
187}
188
189static __inline__ void __const_sigdelset(sigset_t *set, int _sig)
190{
191 unsigned long sig = _sig - 1;
192 set->sig[sig / _NSIG_BPW] &= ~(1 << (sig % _NSIG_BPW));
193}
194
195static __inline__ int __const_sigismember(sigset_t *set, int _sig)
196{
197 unsigned long sig = _sig - 1;
198 return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW));
199}
200
201static __inline__ int __gen_sigismember(sigset_t *set, int _sig)
202{
203 int ret;
204 __asm__("btl %2,%1\n\tsbbl %0,%0"
205 : "=r"(ret) : "m"(*set), "Ir"(_sig-1) : "cc");
206 return ret;
207}
208
209#define sigismember(set,sig) \
210 (__builtin_constant_p(sig) ? \
211 __const_sigismember((set),(sig)) : \
212 __gen_sigismember((set),(sig)))
213
214static __inline__ int sigfindinword(unsigned long word)
215{
216 __asm__("bsfl %1,%0" : "=r"(word) : "rm"(word) : "cc");
217 return word;
218}
219
220struct pt_regs;
221
222#define ptrace_signal_deliver(regs, cookie) \
223 do { \
224 if (current->ptrace & PT_DTRACE) { \
225 current->ptrace &= ~PT_DTRACE; \
226 (regs)->eflags &= ~TF_MASK; \
227 } \
228 } while (0)
229
230#endif /* __KERNEL__ */
231
232#endif
diff --git a/include/asm-x86/signal_64.h b/include/asm-x86/signal_64.h
deleted file mode 100644
index 4581f978b299..000000000000
--- a/include/asm-x86/signal_64.h
+++ /dev/null
@@ -1,181 +0,0 @@
1#ifndef _ASMx8664_SIGNAL_H
2#define _ASMx8664_SIGNAL_H
3
4#ifndef __ASSEMBLY__
5#include <linux/types.h>
6#include <linux/time.h>
7
8/* Avoid too many header ordering problems. */
9struct siginfo;
10
11#ifdef __KERNEL__
12#include <linux/linkage.h>
13/* Most things should be clean enough to redefine this at will, if care
14 is taken to make libc match. */
15
16#define _NSIG 64
17#define _NSIG_BPW 64
18#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
19
20typedef unsigned long old_sigset_t; /* at least 32 bits */
21
22typedef struct {
23 unsigned long sig[_NSIG_WORDS];
24} sigset_t;
25
26
27#else
28/* Here we must cater to libcs that poke about in kernel headers. */
29
30#define NSIG 32
31typedef unsigned long sigset_t;
32
33#endif /* __KERNEL__ */
34#endif
35
36#define SIGHUP 1
37#define SIGINT 2
38#define SIGQUIT 3
39#define SIGILL 4
40#define SIGTRAP 5
41#define SIGABRT 6
42#define SIGIOT 6
43#define SIGBUS 7
44#define SIGFPE 8
45#define SIGKILL 9
46#define SIGUSR1 10
47#define SIGSEGV 11
48#define SIGUSR2 12
49#define SIGPIPE 13
50#define SIGALRM 14
51#define SIGTERM 15
52#define SIGSTKFLT 16
53#define SIGCHLD 17
54#define SIGCONT 18
55#define SIGSTOP 19
56#define SIGTSTP 20
57#define SIGTTIN 21
58#define SIGTTOU 22
59#define SIGURG 23
60#define SIGXCPU 24
61#define SIGXFSZ 25
62#define SIGVTALRM 26
63#define SIGPROF 27
64#define SIGWINCH 28
65#define SIGIO 29
66#define SIGPOLL SIGIO
67/*
68#define SIGLOST 29
69*/
70#define SIGPWR 30
71#define SIGSYS 31
72#define SIGUNUSED 31
73
74/* These should not be considered constants from userland. */
75#define SIGRTMIN 32
76#define SIGRTMAX _NSIG
77
78/*
79 * SA_FLAGS values:
80 *
81 * SA_ONSTACK indicates that a registered stack_t will be used.
82 * SA_RESTART flag to get restarting signals (which were the default long ago)
83 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
84 * SA_RESETHAND clears the handler when the signal is delivered.
85 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
86 * SA_NODEFER prevents the current signal from being masked in the handler.
87 *
88 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
89 * Unix names RESETHAND and NODEFER respectively.
90 */
91#define SA_NOCLDSTOP 0x00000001
92#define SA_NOCLDWAIT 0x00000002
93#define SA_SIGINFO 0x00000004
94#define SA_ONSTACK 0x08000000
95#define SA_RESTART 0x10000000
96#define SA_NODEFER 0x40000000
97#define SA_RESETHAND 0x80000000
98
99#define SA_NOMASK SA_NODEFER
100#define SA_ONESHOT SA_RESETHAND
101
102#define SA_RESTORER 0x04000000
103
104/*
105 * sigaltstack controls
106 */
107#define SS_ONSTACK 1
108#define SS_DISABLE 2
109
110#define MINSIGSTKSZ 2048
111#define SIGSTKSZ 8192
112
113#include <asm-generic/signal.h>
114
115#ifndef __ASSEMBLY__
116
117struct sigaction {
118 __sighandler_t sa_handler;
119 unsigned long sa_flags;
120 __sigrestore_t sa_restorer;
121 sigset_t sa_mask; /* mask last for extensibility */
122};
123
124struct k_sigaction {
125 struct sigaction sa;
126};
127
128typedef struct sigaltstack {
129 void __user *ss_sp;
130 int ss_flags;
131 size_t ss_size;
132} stack_t;
133
134#ifdef __KERNEL__
135#include <asm/sigcontext.h>
136
137#undef __HAVE_ARCH_SIG_BITOPS
138#if 0
139
140static inline void sigaddset(sigset_t *set, int _sig)
141{
142 __asm__("btsq %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc");
143}
144
145static inline void sigdelset(sigset_t *set, int _sig)
146{
147 __asm__("btrq %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc");
148}
149
150static inline int __const_sigismember(sigset_t *set, int _sig)
151{
152 unsigned long sig = _sig - 1;
153 return 1 & (set->sig[sig / _NSIG_BPW] >> (sig & ~(_NSIG_BPW-1)));
154}
155
156static inline int __gen_sigismember(sigset_t *set, int _sig)
157{
158 int ret;
159 __asm__("btq %2,%1\n\tsbbq %0,%0"
160 : "=r"(ret) : "m"(*set), "Ir"(_sig-1) : "cc");
161 return ret;
162}
163
164#define sigismember(set,sig) \
165 (__builtin_constant_p(sig) ? \
166 __const_sigismember((set),(sig)) : \
167 __gen_sigismember((set),(sig)))
168
169static inline int sigfindinword(unsigned long word)
170{
171 __asm__("bsfq %1,%0" : "=r"(word) : "rm"(word) : "cc");
172 return word;
173}
174#endif
175#endif
176
177#define ptrace_signal_deliver(regs, cookie) do { } while (0)
178
179#endif /* __KERNEL__ */
180
181#endif