blob: c974cc9b30eb73bae60e0329df1ff425887c4b05 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1991, 1992 Linus Torvalds
7 * Copyright (C) 1994 - 2000 Ralf Baechle
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 */
10#include <linux/config.h>
Ralf Baechle02416dc2005-06-15 13:00:12 +000011#include <linux/cache.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <linux/sched.h>
13#include <linux/mm.h>
14#include <linux/personality.h>
15#include <linux/smp.h>
16#include <linux/smp_lock.h>
17#include <linux/kernel.h>
18#include <linux/signal.h>
19#include <linux/errno.h>
20#include <linux/wait.h>
21#include <linux/ptrace.h>
22#include <linux/unistd.h>
23#include <linux/compiler.h>
24
Ralf Baechlee50c0a82005-05-31 11:49:19 +000025#include <asm/abi.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070026#include <asm/asm.h>
27#include <linux/bitops.h>
28#include <asm/cacheflush.h>
29#include <asm/fpu.h>
30#include <asm/sim.h>
31#include <asm/uaccess.h>
32#include <asm/ucontext.h>
33#include <asm/cpu-features.h>
Ralf Baechle02416dc2005-06-15 13:00:12 +000034#include <asm/war.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070035
36#include "signal-common.h"
37
38#define DEBUG_SIG 0
39
40#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
41
Linus Torvalds1da177e2005-04-16 15:20:36 -070042/*
43 * Atomically swap in the new signal mask, and wait for a signal.
44 */
45
46#ifdef CONFIG_TRAD_SIGNALS
47save_static_function(sys_sigsuspend);
48__attribute_used__ noinline static int
49_sys_sigsuspend(nabi_no_regargs struct pt_regs regs)
50{
Ralf Baechle7b3e2fc2006-02-08 12:58:41 +000051 sigset_t newset;
Ralf Baechlefe00f942005-03-01 19:22:29 +000052 sigset_t __user *uset;
Linus Torvalds1da177e2005-04-16 15:20:36 -070053
Ralf Baechlefe00f942005-03-01 19:22:29 +000054 uset = (sigset_t __user *) regs.regs[4];
Linus Torvalds1da177e2005-04-16 15:20:36 -070055 if (copy_from_user(&newset, uset, sizeof(sigset_t)))
56 return -EFAULT;
57 sigdelsetmask(&newset, ~_BLOCKABLE);
58
59 spin_lock_irq(&current->sighand->siglock);
Ralf Baechle7b3e2fc2006-02-08 12:58:41 +000060 current->saved_sigmask = current->blocked;
Linus Torvalds1da177e2005-04-16 15:20:36 -070061 current->blocked = newset;
62 recalc_sigpending();
63 spin_unlock_irq(&current->sighand->siglock);
64
Ralf Baechle7b3e2fc2006-02-08 12:58:41 +000065 current->state = TASK_INTERRUPTIBLE;
66 schedule();
67 set_thread_flag(TIF_RESTORE_SIGMASK);
68 return -ERESTARTNOHAND;
Linus Torvalds1da177e2005-04-16 15:20:36 -070069}
70#endif
71
72save_static_function(sys_rt_sigsuspend);
73__attribute_used__ noinline static int
74_sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
75{
Ralf Baechle7b3e2fc2006-02-08 12:58:41 +000076 sigset_t newset;
Ralf Baechlefe00f942005-03-01 19:22:29 +000077 sigset_t __user *unewset;
Linus Torvalds1da177e2005-04-16 15:20:36 -070078 size_t sigsetsize;
79
80 /* XXX Don't preclude handling different sized sigset_t's. */
81 sigsetsize = regs.regs[5];
82 if (sigsetsize != sizeof(sigset_t))
83 return -EINVAL;
84
Ralf Baechlefe00f942005-03-01 19:22:29 +000085 unewset = (sigset_t __user *) regs.regs[4];
Linus Torvalds1da177e2005-04-16 15:20:36 -070086 if (copy_from_user(&newset, unewset, sizeof(newset)))
87 return -EFAULT;
88 sigdelsetmask(&newset, ~_BLOCKABLE);
89
90 spin_lock_irq(&current->sighand->siglock);
Ralf Baechle7b3e2fc2006-02-08 12:58:41 +000091 current->saved_sigmask = current->blocked;
Linus Torvalds1da177e2005-04-16 15:20:36 -070092 current->blocked = newset;
93 recalc_sigpending();
94 spin_unlock_irq(&current->sighand->siglock);
95
Ralf Baechle7b3e2fc2006-02-08 12:58:41 +000096 current->state = TASK_INTERRUPTIBLE;
97 schedule();
98 set_thread_flag(TIF_RESTORE_SIGMASK);
99 return -ERESTARTNOHAND;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100}
101
102#ifdef CONFIG_TRAD_SIGNALS
103asmlinkage int sys_sigaction(int sig, const struct sigaction *act,
104 struct sigaction *oact)
105{
106 struct k_sigaction new_ka, old_ka;
107 int ret;
108 int err = 0;
109
110 if (act) {
111 old_sigset_t mask;
112
113 if (!access_ok(VERIFY_READ, act, sizeof(*act)))
114 return -EFAULT;
115 err |= __get_user(new_ka.sa.sa_handler, &act->sa_handler);
116 err |= __get_user(new_ka.sa.sa_flags, &act->sa_flags);
117 err |= __get_user(mask, &act->sa_mask.sig[0]);
118 if (err)
119 return -EFAULT;
120
121 siginitset(&new_ka.sa.sa_mask, mask);
122 }
123
124 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
125
126 if (!ret && oact) {
127 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)))
128 return -EFAULT;
129 err |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
130 err |= __put_user(old_ka.sa.sa_handler, &oact->sa_handler);
131 err |= __put_user(old_ka.sa.sa_mask.sig[0], oact->sa_mask.sig);
132 err |= __put_user(0, &oact->sa_mask.sig[1]);
133 err |= __put_user(0, &oact->sa_mask.sig[2]);
134 err |= __put_user(0, &oact->sa_mask.sig[3]);
135 if (err)
136 return -EFAULT;
137 }
138
139 return ret;
140}
141#endif
142
143asmlinkage int sys_sigaltstack(nabi_no_regargs struct pt_regs regs)
144{
Ralf Baechlefe00f942005-03-01 19:22:29 +0000145 const stack_t __user *uss = (const stack_t __user *) regs.regs[4];
146 stack_t __user *uoss = (stack_t __user *) regs.regs[5];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147 unsigned long usp = regs.regs[29];
148
149 return do_sigaltstack(uss, uoss, usp);
150}
151
Ralf Baechle02416dc2005-06-15 13:00:12 +0000152/*
153 * Horribly complicated - with the bloody RM9000 workarounds enabled
154 * the signal trampolines is moving to the end of the structure so we can
155 * increase the alignment without breaking software compatibility.
156 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157#ifdef CONFIG_TRAD_SIGNALS
158struct sigframe {
159 u32 sf_ass[4]; /* argument save space for o32 */
Ralf Baechle02416dc2005-06-15 13:00:12 +0000160#if ICACHE_REFILLS_WORKAROUND_WAR
161 u32 sf_pad[2];
162#else
163 u32 sf_code[2]; /* signal trampoline */
164#endif
165 struct sigcontext sf_sc;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700166 sigset_t sf_mask;
Ralf Baechle02416dc2005-06-15 13:00:12 +0000167#if ICACHE_REFILLS_WORKAROUND_WAR
168 u32 sf_code[8] ____cacheline_aligned; /* signal trampoline */
169#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170};
171#endif
172
173struct rt_sigframe {
174 u32 rs_ass[4]; /* argument save space for o32 */
Ralf Baechle02416dc2005-06-15 13:00:12 +0000175#if ICACHE_REFILLS_WORKAROUND_WAR
176 u32 rs_pad[2];
177#else
178 u32 rs_code[2]; /* signal trampoline */
179#endif
180 struct siginfo rs_info;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700181 struct ucontext rs_uc;
Ralf Baechle02416dc2005-06-15 13:00:12 +0000182#if ICACHE_REFILLS_WORKAROUND_WAR
183 u32 rs_code[8] ____cacheline_aligned; /* signal trampoline */
184#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185};
186
187#ifdef CONFIG_TRAD_SIGNALS
188save_static_function(sys_sigreturn);
189__attribute_used__ noinline static void
190_sys_sigreturn(nabi_no_regargs struct pt_regs regs)
191{
Atsushi Nemoto9bbf28a32006-02-01 01:41:09 +0900192 struct sigframe __user *frame;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700193 sigset_t blocked;
194
Atsushi Nemoto9bbf28a32006-02-01 01:41:09 +0900195 frame = (struct sigframe __user *) regs.regs[29];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700196 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
197 goto badframe;
198 if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked)))
199 goto badframe;
200
201 sigdelsetmask(&blocked, ~_BLOCKABLE);
202 spin_lock_irq(&current->sighand->siglock);
203 current->blocked = blocked;
204 recalc_sigpending();
205 spin_unlock_irq(&current->sighand->siglock);
206
207 if (restore_sigcontext(&regs, &frame->sf_sc))
208 goto badframe;
209
210 /*
211 * Don't let your children do this ...
212 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700213 __asm__ __volatile__(
214 "move\t$29, %0\n\t"
215 "j\tsyscall_exit"
216 :/* no outputs */
217 :"r" (&regs));
218 /* Unreached */
219
220badframe:
221 force_sig(SIGSEGV, current);
222}
Ralf Baechlee50c0a82005-05-31 11:49:19 +0000223#endif /* CONFIG_TRAD_SIGNALS */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224
225save_static_function(sys_rt_sigreturn);
226__attribute_used__ noinline static void
227_sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
228{
Atsushi Nemoto9bbf28a32006-02-01 01:41:09 +0900229 struct rt_sigframe __user *frame;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700230 sigset_t set;
231 stack_t st;
232
Atsushi Nemoto9bbf28a32006-02-01 01:41:09 +0900233 frame = (struct rt_sigframe __user *) regs.regs[29];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700234 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
235 goto badframe;
236 if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set)))
237 goto badframe;
238
239 sigdelsetmask(&set, ~_BLOCKABLE);
240 spin_lock_irq(&current->sighand->siglock);
241 current->blocked = set;
242 recalc_sigpending();
243 spin_unlock_irq(&current->sighand->siglock);
244
245 if (restore_sigcontext(&regs, &frame->rs_uc.uc_mcontext))
246 goto badframe;
247
248 if (__copy_from_user(&st, &frame->rs_uc.uc_stack, sizeof(st)))
249 goto badframe;
250 /* It is more difficult to avoid calling this function than to
251 call it and ignore errors. */
Atsushi Nemoto9bbf28a32006-02-01 01:41:09 +0900252 do_sigaltstack((stack_t __user *)&st, NULL, regs.regs[29]);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700253
254 /*
255 * Don't let your children do this ...
256 */
257 __asm__ __volatile__(
258 "move\t$29, %0\n\t"
259 "j\tsyscall_exit"
260 :/* no outputs */
261 :"r" (&regs));
262 /* Unreached */
263
264badframe:
265 force_sig(SIGSEGV, current);
266}
267
268#ifdef CONFIG_TRAD_SIGNALS
Ralf Baechle129bc8f2005-07-11 20:45:51 +0000269int setup_frame(struct k_sigaction * ka, struct pt_regs *regs,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700270 int signr, sigset_t *set)
271{
Atsushi Nemoto9bbf28a32006-02-01 01:41:09 +0900272 struct sigframe __user *frame;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700273 int err = 0;
274
275 frame = get_sigframe(ka, regs, sizeof(*frame));
276 if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
277 goto give_sigsegv;
278
Ralf Baechle02416dc2005-06-15 13:00:12 +0000279 install_sigtramp(frame->sf_code, __NR_sigreturn);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700280
281 err |= setup_sigcontext(regs, &frame->sf_sc);
282 err |= __copy_to_user(&frame->sf_mask, set, sizeof(*set));
283 if (err)
284 goto give_sigsegv;
285
286 /*
287 * Arguments to signal handler:
288 *
289 * a0 = signal number
290 * a1 = 0 (should be cause)
291 * a2 = pointer to struct sigcontext
292 *
293 * $25 and c0_epc point to the signal handler, $29 points to the
294 * struct sigframe.
295 */
296 regs->regs[ 4] = signr;
297 regs->regs[ 5] = 0;
298 regs->regs[ 6] = (unsigned long) &frame->sf_sc;
299 regs->regs[29] = (unsigned long) frame;
300 regs->regs[31] = (unsigned long) frame->sf_code;
301 regs->cp0_epc = regs->regs[25] = (unsigned long) ka->sa.sa_handler;
302
303#if DEBUG_SIG
304 printk("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%p\n",
305 current->comm, current->pid,
306 frame, regs->cp0_epc, frame->regs[31]);
307#endif
Ralf Baechle7b3e2fc2006-02-08 12:58:41 +0000308 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700309
310give_sigsegv:
311 force_sigsegv(signr, current);
Ralf Baechle7b3e2fc2006-02-08 12:58:41 +0000312 return -EFAULT;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700313}
314#endif
315
Ralf Baechle129bc8f2005-07-11 20:45:51 +0000316int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700317 int signr, sigset_t *set, siginfo_t *info)
318{
Atsushi Nemoto9bbf28a32006-02-01 01:41:09 +0900319 struct rt_sigframe __user *frame;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700320 int err = 0;
321
322 frame = get_sigframe(ka, regs, sizeof(*frame));
323 if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
324 goto give_sigsegv;
325
Ralf Baechle02416dc2005-06-15 13:00:12 +0000326 install_sigtramp(frame->rs_code, __NR_rt_sigreturn);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700327
328 /* Create siginfo. */
329 err |= copy_siginfo_to_user(&frame->rs_info, info);
330
331 /* Create the ucontext. */
332 err |= __put_user(0, &frame->rs_uc.uc_flags);
Atsushi Nemoto5665a0a2006-02-02 01:26:34 +0900333 err |= __put_user(NULL, &frame->rs_uc.uc_link);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700334 err |= __put_user((void *)current->sas_ss_sp,
335 &frame->rs_uc.uc_stack.ss_sp);
336 err |= __put_user(sas_ss_flags(regs->regs[29]),
337 &frame->rs_uc.uc_stack.ss_flags);
338 err |= __put_user(current->sas_ss_size,
339 &frame->rs_uc.uc_stack.ss_size);
340 err |= setup_sigcontext(regs, &frame->rs_uc.uc_mcontext);
341 err |= __copy_to_user(&frame->rs_uc.uc_sigmask, set, sizeof(*set));
342
343 if (err)
344 goto give_sigsegv;
345
346 /*
347 * Arguments to signal handler:
348 *
349 * a0 = signal number
350 * a1 = 0 (should be cause)
351 * a2 = pointer to ucontext
352 *
353 * $25 and c0_epc point to the signal handler, $29 points to
354 * the struct rt_sigframe.
355 */
356 regs->regs[ 4] = signr;
357 regs->regs[ 5] = (unsigned long) &frame->rs_info;
358 regs->regs[ 6] = (unsigned long) &frame->rs_uc;
359 regs->regs[29] = (unsigned long) frame;
360 regs->regs[31] = (unsigned long) frame->rs_code;
361 regs->cp0_epc = regs->regs[25] = (unsigned long) ka->sa.sa_handler;
362
363#if DEBUG_SIG
364 printk("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%p\n",
365 current->comm, current->pid,
366 frame, regs->cp0_epc, regs->regs[31]);
367#endif
Ralf Baechle7b3e2fc2006-02-08 12:58:41 +0000368 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700369
370give_sigsegv:
371 force_sigsegv(signr, current);
Ralf Baechle7b3e2fc2006-02-08 12:58:41 +0000372 return -EFAULT;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700373}
374
Ralf Baechle129bc8f2005-07-11 20:45:51 +0000375static inline int handle_signal(unsigned long sig, siginfo_t *info,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700376 struct k_sigaction *ka, sigset_t *oldset, struct pt_regs *regs)
377{
Ralf Baechle129bc8f2005-07-11 20:45:51 +0000378 int ret;
379
Linus Torvalds1da177e2005-04-16 15:20:36 -0700380 switch(regs->regs[0]) {
381 case ERESTART_RESTARTBLOCK:
382 case ERESTARTNOHAND:
383 regs->regs[2] = EINTR;
384 break;
385 case ERESTARTSYS:
Ralf Baechle7b3e2fc2006-02-08 12:58:41 +0000386 if (!(ka->sa.sa_flags & SA_RESTART)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700387 regs->regs[2] = EINTR;
388 break;
389 }
390 /* fallthrough */
391 case ERESTARTNOINTR: /* Userland will reload $v0. */
392 regs->regs[7] = regs->regs[26];
393 regs->cp0_epc -= 8;
394 }
395
396 regs->regs[0] = 0; /* Don't deal with this again. */
397
Ralf Baechlee50c0a82005-05-31 11:49:19 +0000398 if (sig_uses_siginfo(ka))
Ralf Baechle129bc8f2005-07-11 20:45:51 +0000399 ret = current->thread.abi->setup_rt_frame(ka, regs, sig, oldset, info);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700400 else
Ralf Baechle129bc8f2005-07-11 20:45:51 +0000401 ret = current->thread.abi->setup_frame(ka, regs, sig, oldset);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700402
Steven Rostedt69be8f12005-08-29 11:44:09 -0400403 spin_lock_irq(&current->sighand->siglock);
404 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
405 if (!(ka->sa.sa_flags & SA_NODEFER))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700406 sigaddset(&current->blocked,sig);
Steven Rostedt69be8f12005-08-29 11:44:09 -0400407 recalc_sigpending();
408 spin_unlock_irq(&current->sighand->siglock);
Ralf Baechle129bc8f2005-07-11 20:45:51 +0000409
410 return ret;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700411}
412
Ralf Baechle40ac5d42006-02-08 13:38:18 +0000413void do_signal(struct pt_regs *regs)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700414{
415 struct k_sigaction ka;
Ralf Baechle7b3e2fc2006-02-08 12:58:41 +0000416 sigset_t *oldset;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700417 siginfo_t info;
418 int signr;
419
Linus Torvalds1da177e2005-04-16 15:20:36 -0700420 /*
421 * We want the common case to go fast, which is why we may in certain
422 * cases get here from kernel mode. Just return without doing anything
423 * if so.
424 */
425 if (!user_mode(regs))
Ralf Baechle40ac5d42006-02-08 13:38:18 +0000426 return;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700427
Yoichi Yuasad4b3a802005-06-27 14:36:30 -0700428 if (try_to_freeze())
Linus Torvalds1da177e2005-04-16 15:20:36 -0700429 goto no_signal;
430
Ralf Baechle7b3e2fc2006-02-08 12:58:41 +0000431 if (test_thread_flag(TIF_RESTORE_SIGMASK))
432 oldset = &current->saved_sigmask;
433 else
Linus Torvalds1da177e2005-04-16 15:20:36 -0700434 oldset = &current->blocked;
435
Ralf Baechle7b3e2fc2006-02-08 12:58:41 +0000436
Linus Torvalds1da177e2005-04-16 15:20:36 -0700437 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
Ralf Baechle7b3e2fc2006-02-08 12:58:41 +0000438 if (signr > 0) {
439 /* Whee! Actually deliver the signal. */
440 if (handle_signal(signr, &info, &ka, oldset, regs) == 0) {
441 /*
442 * A signal was successfully delivered; the saved
443 * sigmask will have been stored in the signal frame,
444 * and will be restored by sigreturn, so we can simply
445 * clear the TIF_RESTORE_SIGMASK flag.
446 */
447 if (test_thread_flag(TIF_RESTORE_SIGMASK))
448 clear_thread_flag(TIF_RESTORE_SIGMASK);
449 }
450 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700451
452no_signal:
453 /*
454 * Who's code doesn't conform to the restartable syscall convention
455 * dies here!!! The li instruction, a single machine instruction,
456 * must directly be followed by the syscall instruction.
457 */
458 if (regs->regs[0]) {
459 if (regs->regs[2] == ERESTARTNOHAND ||
460 regs->regs[2] == ERESTARTSYS ||
461 regs->regs[2] == ERESTARTNOINTR) {
462 regs->regs[7] = regs->regs[26];
463 regs->cp0_epc -= 8;
464 }
465 if (regs->regs[2] == ERESTART_RESTARTBLOCK) {
466 regs->regs[2] = __NR_restart_syscall;
467 regs->regs[7] = regs->regs[26];
468 regs->cp0_epc -= 4;
469 }
470 }
Ralf Baechle7b3e2fc2006-02-08 12:58:41 +0000471
472 /*
473 * If there's no signal to deliver, we just put the saved sigmask
474 * back
475 */
476 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
477 clear_thread_flag(TIF_RESTORE_SIGMASK);
478 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
479 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700480}
481
482/*
483 * notification of userspace execution resumption
Ralf Baechle7b3e2fc2006-02-08 12:58:41 +0000484 * - triggered by the TIF_WORK_MASK flags
Linus Torvalds1da177e2005-04-16 15:20:36 -0700485 */
Ralf Baechle7b3e2fc2006-02-08 12:58:41 +0000486asmlinkage void do_notify_resume(struct pt_regs *regs, void *unused,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700487 __u32 thread_info_flags)
488{
489 /* deal with pending signal delivery */
Ralf Baechle7b3e2fc2006-02-08 12:58:41 +0000490 if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK))
491 current->thread.abi->do_signal(regs);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700492}