blob: 535810a3217a25bf64e3f5d53059f8a5ff1a7ea4 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* signal.c: FRV specific bits of signal handling
2 *
3 * Copyright (C) 2003-5 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 * - Derived from arch/m68k/kernel/signal.c
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#include <linux/sched.h>
14#include <linux/mm.h>
15#include <linux/smp.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016#include <linux/kernel.h>
17#include <linux/signal.h>
18#include <linux/errno.h>
19#include <linux/wait.h>
20#include <linux/ptrace.h>
21#include <linux/unistd.h>
22#include <linux/personality.h>
David Howells4a3b9892009-06-11 13:05:24 +010023#include <linux/tracehook.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070024#include <asm/ucontext.h>
25#include <asm/uaccess.h>
26#include <asm/cacheflush.h>
27
28#define DEBUG_SIG 0
29
Linus Torvalds1da177e2005-04-16 15:20:36 -070030struct fdpic_func_descriptor {
31 unsigned long text;
32 unsigned long GOT;
33};
34
Linus Torvalds1da177e2005-04-16 15:20:36 -070035/*
36 * Atomically swap in the new signal mask, and wait for a signal.
37 */
38asmlinkage int sys_sigsuspend(int history0, int history1, old_sigset_t mask)
39{
Al Viro68f3f162012-05-21 21:42:32 -040040 sigset_t blocked;
41 siginitset(&blocked, mask);
42 return sigsuspend(&blocked);
Linus Torvalds1da177e2005-04-16 15:20:36 -070043}
44
45asmlinkage int sys_sigaction(int sig,
46 const struct old_sigaction __user *act,
47 struct old_sigaction __user *oact)
48{
49 struct k_sigaction new_ka, old_ka;
50 int ret;
51
52 if (act) {
53 old_sigset_t mask;
54 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
55 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
Al Virof0c22cd2012-04-22 17:20:02 -040056 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer) ||
57 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
58 __get_user(mask, &act->sa_mask))
Linus Torvalds1da177e2005-04-16 15:20:36 -070059 return -EFAULT;
Linus Torvalds1da177e2005-04-16 15:20:36 -070060 siginitset(&new_ka.sa.sa_mask, mask);
61 }
62
63 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
64
65 if (!ret && oact) {
66 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
67 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
Al Virof0c22cd2012-04-22 17:20:02 -040068 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer) ||
69 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
70 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
Linus Torvalds1da177e2005-04-16 15:20:36 -070071 return -EFAULT;
Linus Torvalds1da177e2005-04-16 15:20:36 -070072 }
73
74 return ret;
75}
76
77asmlinkage
78int sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
79{
80 return do_sigaltstack(uss, uoss, __frame->sp);
81}
82
83
84/*
85 * Do a signal return; undo the signal stack.
86 */
87
88struct sigframe
89{
Al Viro9e4d11f2006-06-23 02:04:04 -070090 __sigrestore_t pretcode;
Linus Torvalds1da177e2005-04-16 15:20:36 -070091 int sig;
92 struct sigcontext sc;
93 unsigned long extramask[_NSIG_WORDS-1];
94 uint32_t retcode[2];
95};
96
97struct rt_sigframe
98{
Al Viro9e4d11f2006-06-23 02:04:04 -070099 __sigrestore_t pretcode;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100 int sig;
Al Viro9e4d11f2006-06-23 02:04:04 -0700101 struct siginfo __user *pinfo;
102 void __user *puc;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103 struct siginfo info;
104 struct ucontext uc;
105 uint32_t retcode[2];
106};
107
108static int restore_sigcontext(struct sigcontext __user *sc, int *_gr8)
109{
110 struct user_context *user = current->thread.user;
111 unsigned long tbr, psr;
112
Al Viro20cd5142010-09-20 15:13:04 +0100113 /* Always make any pending restarted system calls return -EINTR */
114 current_thread_info()->restart_block.fn = do_no_restart_syscall;
115
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116 tbr = user->i.tbr;
117 psr = user->i.psr;
118 if (copy_from_user(user, &sc->sc_context, sizeof(sc->sc_context)))
119 goto badframe;
120 user->i.tbr = tbr;
121 user->i.psr = psr;
122
123 restore_user_regs(user);
124
125 user->i.syscallno = -1; /* disable syscall checks */
126
127 *_gr8 = user->i.gr[8];
128 return 0;
129
130 badframe:
131 return 1;
132}
133
134asmlinkage int sys_sigreturn(void)
135{
136 struct sigframe __user *frame = (struct sigframe __user *) __frame->sp;
137 sigset_t set;
138 int gr8;
139
140 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
141 goto badframe;
142 if (__get_user(set.sig[0], &frame->sc.sc_oldmask))
143 goto badframe;
144
145 if (_NSIG_WORDS > 1 &&
146 __copy_from_user(&set.sig[1], &frame->extramask, sizeof(frame->extramask)))
147 goto badframe;
148
Matt Fleming7ebe0c52012-05-11 10:58:52 +1000149 set_current_blocked(&set);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150
151 if (restore_sigcontext(&frame->sc, &gr8))
152 goto badframe;
153 return gr8;
154
155 badframe:
156 force_sig(SIGSEGV, current);
157 return 0;
158}
159
160asmlinkage int sys_rt_sigreturn(void)
161{
162 struct rt_sigframe __user *frame = (struct rt_sigframe __user *) __frame->sp;
163 sigset_t set;
164 int gr8;
165
166 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
167 goto badframe;
168 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
169 goto badframe;
170
Matt Fleming7ebe0c52012-05-11 10:58:52 +1000171 set_current_blocked(&set);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700172
173 if (restore_sigcontext(&frame->uc.uc_mcontext, &gr8))
174 goto badframe;
175
176 if (do_sigaltstack(&frame->uc.uc_stack, NULL, __frame->sp) == -EFAULT)
177 goto badframe;
178
179 return gr8;
180
181badframe:
182 force_sig(SIGSEGV, current);
183 return 0;
184}
185
186/*
187 * Set up a signal frame
188 */
189static int setup_sigcontext(struct sigcontext __user *sc, unsigned long mask)
190{
191 save_user_regs(current->thread.user);
192
193 if (copy_to_user(&sc->sc_context, current->thread.user, sizeof(sc->sc_context)) != 0)
194 goto badframe;
195
196 /* non-iBCS2 extensions.. */
197 if (__put_user(mask, &sc->sc_oldmask) < 0)
198 goto badframe;
199
200 return 0;
201
202 badframe:
203 return 1;
204}
205
206/*****************************************************************************/
207/*
208 * Determine which stack to use..
209 */
210static inline void __user *get_sigframe(struct k_sigaction *ka,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700211 size_t frame_size)
212{
213 unsigned long sp;
214
215 /* Default to using normal stack */
David Howellsfef2b582006-01-06 00:11:45 -0800216 sp = __frame->sp;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700217
218 /* This is the X/Open sanctioned signal stack switching. */
219 if (ka->sa.sa_flags & SA_ONSTACK) {
Laurent MEYERd09042d2006-06-23 02:05:36 -0700220 if (! sas_ss_flags(sp))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700221 sp = current->sas_ss_sp + current->sas_ss_size;
222 }
223
224 return (void __user *) ((sp - frame_size) & ~7UL);
David Howellsfef2b582006-01-06 00:11:45 -0800225
Linus Torvalds1da177e2005-04-16 15:20:36 -0700226} /* end get_sigframe() */
227
228/*****************************************************************************/
229/*
230 *
231 */
David Howellsfef2b582006-01-06 00:11:45 -0800232static int setup_frame(int sig, struct k_sigaction *ka, sigset_t *set)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233{
234 struct sigframe __user *frame;
235 int rsig;
236
Al Viro5f4ad042010-09-20 15:13:09 +0100237 set_fs(USER_DS);
238
David Howellsfef2b582006-01-06 00:11:45 -0800239 frame = get_sigframe(ka, sizeof(*frame));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700240
241 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
242 goto give_sigsegv;
243
244 rsig = sig;
245 if (sig < 32 &&
246 __current_thread_info->exec_domain &&
247 __current_thread_info->exec_domain->signal_invmap)
248 rsig = __current_thread_info->exec_domain->signal_invmap[sig];
249
250 if (__put_user(rsig, &frame->sig) < 0)
251 goto give_sigsegv;
252
253 if (setup_sigcontext(&frame->sc, set->sig[0]))
254 goto give_sigsegv;
255
256 if (_NSIG_WORDS > 1) {
257 if (__copy_to_user(frame->extramask, &set->sig[1],
258 sizeof(frame->extramask)))
259 goto give_sigsegv;
260 }
261
262 /* Set up to return from userspace. If provided, use a stub
263 * already in userspace. */
264 if (ka->sa.sa_flags & SA_RESTORER) {
265 if (__put_user(ka->sa.sa_restorer, &frame->pretcode) < 0)
266 goto give_sigsegv;
267 }
268 else {
269 /* Set up the following code on the stack:
270 * setlos #__NR_sigreturn,gr7
271 * tira gr0,0
272 */
Al Viro9e4d11f2006-06-23 02:04:04 -0700273 if (__put_user((__sigrestore_t)frame->retcode, &frame->pretcode) ||
Linus Torvalds1da177e2005-04-16 15:20:36 -0700274 __put_user(0x8efc0000|__NR_sigreturn, &frame->retcode[0]) ||
275 __put_user(0xc0700000, &frame->retcode[1]))
276 goto give_sigsegv;
277
278 flush_icache_range((unsigned long) frame->retcode,
279 (unsigned long) (frame->retcode + 2));
280 }
281
Al Viro5f4ad042010-09-20 15:13:09 +0100282 /* Set up registers for the signal handler */
WANG Congecd0fa92008-04-29 00:59:15 -0700283 if (current->personality & FDPIC_FUNCPTRS) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700284 struct fdpic_func_descriptor __user *funcptr =
Al Viro9e4d11f2006-06-23 02:04:04 -0700285 (struct fdpic_func_descriptor __user *) ka->sa.sa_handler;
Al Viro5f4ad042010-09-20 15:13:09 +0100286 struct fdpic_func_descriptor desc;
287 if (copy_from_user(&desc, funcptr, sizeof(desc)))
288 goto give_sigsegv;
289 __frame->pc = desc.text;
290 __frame->gr15 = desc.GOT;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700291 } else {
David Howellsfef2b582006-01-06 00:11:45 -0800292 __frame->pc = (unsigned long) ka->sa.sa_handler;
293 __frame->gr15 = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700294 }
295
Al Viro5f4ad042010-09-20 15:13:09 +0100296 __frame->sp = (unsigned long) frame;
297 __frame->lr = (unsigned long) &frame->retcode;
298 __frame->gr8 = sig;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700299
300#if DEBUG_SIG
301 printk("SIG deliver %d (%s:%d): sp=%p pc=%lx ra=%p\n",
David Howellsfef2b582006-01-06 00:11:45 -0800302 sig, current->comm, current->pid, frame, __frame->pc,
David Howells8efc0ab2006-01-06 00:11:44 -0800303 frame->pretcode);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700304#endif
305
David Howellsa411aee2006-01-18 17:43:59 -0800306 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700307
308give_sigsegv:
Al Viroad0acab2010-09-20 15:13:14 +0100309 force_sigsegv(sig, current);
David Howellsa411aee2006-01-18 17:43:59 -0800310 return -EFAULT;
David Howells8efc0ab2006-01-06 00:11:44 -0800311
Linus Torvalds1da177e2005-04-16 15:20:36 -0700312} /* end setup_frame() */
313
314/*****************************************************************************/
315/*
316 *
317 */
David Howells8efc0ab2006-01-06 00:11:44 -0800318static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
David Howellsfef2b582006-01-06 00:11:45 -0800319 sigset_t *set)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700320{
321 struct rt_sigframe __user *frame;
322 int rsig;
323
Al Viro5f4ad042010-09-20 15:13:09 +0100324 set_fs(USER_DS);
325
David Howellsfef2b582006-01-06 00:11:45 -0800326 frame = get_sigframe(ka, sizeof(*frame));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700327
328 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
329 goto give_sigsegv;
330
331 rsig = sig;
332 if (sig < 32 &&
333 __current_thread_info->exec_domain &&
334 __current_thread_info->exec_domain->signal_invmap)
335 rsig = __current_thread_info->exec_domain->signal_invmap[sig];
336
337 if (__put_user(rsig, &frame->sig) ||
338 __put_user(&frame->info, &frame->pinfo) ||
339 __put_user(&frame->uc, &frame->puc))
340 goto give_sigsegv;
341
342 if (copy_siginfo_to_user(&frame->info, info))
343 goto give_sigsegv;
344
345 /* Create the ucontext. */
346 if (__put_user(0, &frame->uc.uc_flags) ||
Al Viro9e4d11f2006-06-23 02:04:04 -0700347 __put_user(NULL, &frame->uc.uc_link) ||
348 __put_user((void __user *)current->sas_ss_sp, &frame->uc.uc_stack.ss_sp) ||
David Howellsfef2b582006-01-06 00:11:45 -0800349 __put_user(sas_ss_flags(__frame->sp), &frame->uc.uc_stack.ss_flags) ||
Linus Torvalds1da177e2005-04-16 15:20:36 -0700350 __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size))
351 goto give_sigsegv;
352
353 if (setup_sigcontext(&frame->uc.uc_mcontext, set->sig[0]))
354 goto give_sigsegv;
355
356 if (__copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)))
357 goto give_sigsegv;
358
359 /* Set up to return from userspace. If provided, use a stub
360 * already in userspace. */
361 if (ka->sa.sa_flags & SA_RESTORER) {
362 if (__put_user(ka->sa.sa_restorer, &frame->pretcode))
363 goto give_sigsegv;
364 }
365 else {
366 /* Set up the following code on the stack:
367 * setlos #__NR_sigreturn,gr7
368 * tira gr0,0
369 */
Al Viro9e4d11f2006-06-23 02:04:04 -0700370 if (__put_user((__sigrestore_t)frame->retcode, &frame->pretcode) ||
Linus Torvalds1da177e2005-04-16 15:20:36 -0700371 __put_user(0x8efc0000|__NR_rt_sigreturn, &frame->retcode[0]) ||
372 __put_user(0xc0700000, &frame->retcode[1]))
373 goto give_sigsegv;
374
375 flush_icache_range((unsigned long) frame->retcode,
376 (unsigned long) (frame->retcode + 2));
377 }
378
379 /* Set up registers for signal handler */
WANG Congecd0fa92008-04-29 00:59:15 -0700380 if (current->personality & FDPIC_FUNCPTRS) {
Al Viro9e4d11f2006-06-23 02:04:04 -0700381 struct fdpic_func_descriptor __user *funcptr =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700382 (struct fdpic_func_descriptor __user *) ka->sa.sa_handler;
Al Viro5f4ad042010-09-20 15:13:09 +0100383 struct fdpic_func_descriptor desc;
384 if (copy_from_user(&desc, funcptr, sizeof(desc)))
385 goto give_sigsegv;
386 __frame->pc = desc.text;
387 __frame->gr15 = desc.GOT;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700388 } else {
David Howellsfef2b582006-01-06 00:11:45 -0800389 __frame->pc = (unsigned long) ka->sa.sa_handler;
390 __frame->gr15 = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700391 }
392
Al Viro5f4ad042010-09-20 15:13:09 +0100393 __frame->sp = (unsigned long) frame;
394 __frame->lr = (unsigned long) &frame->retcode;
395 __frame->gr8 = sig;
396 __frame->gr9 = (unsigned long) &frame->info;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700397
398#if DEBUG_SIG
399 printk("SIG deliver %d (%s:%d): sp=%p pc=%lx ra=%p\n",
David Howellsfef2b582006-01-06 00:11:45 -0800400 sig, current->comm, current->pid, frame, __frame->pc,
David Howells8efc0ab2006-01-06 00:11:44 -0800401 frame->pretcode);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700402#endif
403
David Howellsa411aee2006-01-18 17:43:59 -0800404 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700405
406give_sigsegv:
Al Viroad0acab2010-09-20 15:13:14 +0100407 force_sigsegv(sig, current);
David Howellsa411aee2006-01-18 17:43:59 -0800408 return -EFAULT;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700409
410} /* end setup_rt_frame() */
411
412/*****************************************************************************/
413/*
414 * OK, we're invoking a handler
415 */
Al Viroa610d6e2012-05-21 23:42:15 -0400416static void handle_signal(unsigned long sig, siginfo_t *info,
Al Virob7f9a112012-05-02 09:59:21 -0400417 struct k_sigaction *ka)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700418{
Al Virob7f9a112012-05-02 09:59:21 -0400419 sigset_t *oldset = sigmask_to_save();
David Howells8efc0ab2006-01-06 00:11:44 -0800420 int ret;
421
Linus Torvalds1da177e2005-04-16 15:20:36 -0700422 /* Are we from a system call? */
Al Viroed1cde62010-09-20 15:13:25 +0100423 if (__frame->syscallno != -1) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700424 /* If so, check system call restarting.. */
David Howellsfef2b582006-01-06 00:11:45 -0800425 switch (__frame->gr8) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700426 case -ERESTART_RESTARTBLOCK:
427 case -ERESTARTNOHAND:
David Howellsfef2b582006-01-06 00:11:45 -0800428 __frame->gr8 = -EINTR;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700429 break;
430
431 case -ERESTARTSYS:
432 if (!(ka->sa.sa_flags & SA_RESTART)) {
David Howellsfef2b582006-01-06 00:11:45 -0800433 __frame->gr8 = -EINTR;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700434 break;
435 }
David Howells8efc0ab2006-01-06 00:11:44 -0800436
Linus Torvalds1da177e2005-04-16 15:20:36 -0700437 /* fallthrough */
438 case -ERESTARTNOINTR:
David Howellsfef2b582006-01-06 00:11:45 -0800439 __frame->gr8 = __frame->orig_gr8;
440 __frame->pc -= 4;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700441 }
Al Viroed1cde62010-09-20 15:13:25 +0100442 __frame->syscallno = -1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700443 }
444
445 /* Set up the stack frame */
446 if (ka->sa.sa_flags & SA_SIGINFO)
David Howellsfef2b582006-01-06 00:11:45 -0800447 ret = setup_rt_frame(sig, ka, info, oldset);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700448 else
David Howellsfef2b582006-01-06 00:11:45 -0800449 ret = setup_frame(sig, ka, oldset);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700450
Al Viroa610d6e2012-05-21 23:42:15 -0400451 if (ret)
452 return;
David Howells8efc0ab2006-01-06 00:11:44 -0800453
Al Viroefee9842012-04-28 02:04:15 -0400454 signal_delivered(sig, info, ka, __frame,
Al Viroa610d6e2012-05-21 23:42:15 -0400455 test_thread_flag(TIF_SINGLESTEP));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700456} /* end handle_signal() */
457
458/*****************************************************************************/
459/*
460 * Note that 'init' is a special process: it doesn't get signals it doesn't
461 * want to handle. Thus you cannot kill init even with a SIGKILL even by
462 * mistake.
463 */
David Howellsa411aee2006-01-18 17:43:59 -0800464static void do_signal(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700465{
466 struct k_sigaction ka;
467 siginfo_t info;
468 int signr;
469
David Howellsfef2b582006-01-06 00:11:45 -0800470 signr = get_signal_to_deliver(&info, &ka, __frame, NULL);
David Howellsa411aee2006-01-18 17:43:59 -0800471 if (signr > 0) {
Al Viroa610d6e2012-05-21 23:42:15 -0400472 handle_signal(signr, &info, &ka);
David Howellsa411aee2006-01-18 17:43:59 -0800473 return;
474 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700475
Linus Torvalds1da177e2005-04-16 15:20:36 -0700476 /* Did we come from a system call? */
Roel Kluinc896a2e2009-10-26 16:50:23 -0700477 if (__frame->syscallno != -1) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700478 /* Restart the system call - no handlers present */
David Howellsa411aee2006-01-18 17:43:59 -0800479 switch (__frame->gr8) {
480 case -ERESTARTNOHAND:
481 case -ERESTARTSYS:
482 case -ERESTARTNOINTR:
David Howellsfef2b582006-01-06 00:11:45 -0800483 __frame->gr8 = __frame->orig_gr8;
484 __frame->pc -= 4;
David Howellsa411aee2006-01-18 17:43:59 -0800485 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700486
David Howellsa411aee2006-01-18 17:43:59 -0800487 case -ERESTART_RESTARTBLOCK:
Al Viro44c7aff2010-09-20 15:13:19 +0100488 __frame->gr7 = __NR_restart_syscall;
David Howellsfef2b582006-01-06 00:11:45 -0800489 __frame->pc -= 4;
David Howellsa411aee2006-01-18 17:43:59 -0800490 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700491 }
Al Viroed1cde62010-09-20 15:13:25 +0100492 __frame->syscallno = -1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700493 }
494
David Howellsa411aee2006-01-18 17:43:59 -0800495 /* if there's no signal to deliver, we just put the saved sigmask
496 * back */
Al Viro51a7b442012-05-21 23:33:55 -0400497 restore_saved_sigmask();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700498} /* end do_signal() */
499
500/*****************************************************************************/
501/*
502 * notification of userspace execution resumption
David Howellsa411aee2006-01-18 17:43:59 -0800503 * - triggered by the TIF_WORK_MASK flags
Linus Torvalds1da177e2005-04-16 15:20:36 -0700504 */
505asmlinkage void do_notify_resume(__u32 thread_info_flags)
506{
507 /* pending single-step? */
508 if (thread_info_flags & _TIF_SINGLESTEP)
509 clear_thread_flag(TIF_SINGLESTEP);
510
511 /* deal with pending signal delivery */
Geert Uytterhoevena3936242012-06-02 13:08:39 +0200512 if (thread_info_flags & _TIF_SIGPENDING)
David Howellsa411aee2006-01-18 17:43:59 -0800513 do_signal();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700514
David Howellsb7bab882009-06-11 13:05:14 +0100515 /* deal with notification on about to resume userspace execution */
516 if (thread_info_flags & _TIF_NOTIFY_RESUME) {
517 clear_thread_flag(TIF_NOTIFY_RESUME);
David Howells4a3b9892009-06-11 13:05:24 +0100518 tracehook_notify_resume(__frame);
David Howellsb7bab882009-06-11 13:05:14 +0100519 }
520
Linus Torvalds1da177e2005-04-16 15:20:36 -0700521} /* end do_notify_resume() */