blob: c45becf82e0179e17fcc9b1372b1ba25ef7c2131 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Heiko Carstensa53c8fa2012-07-20 11:15:04 +02002 * Copyright IBM Corp. 1999, 2006
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
4 *
5 * Based on Intel version
6 *
7 * Copyright (C) 1991, 1992 Linus Torvalds
8 *
9 * 1997-11-28 Modified for POSIX.1b signals by Richard Henderson
10 */
11
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <linux/sched.h>
13#include <linux/mm.h>
14#include <linux/smp.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015#include <linux/kernel.h>
16#include <linux/signal.h>
17#include <linux/errno.h>
18#include <linux/wait.h>
19#include <linux/ptrace.h>
20#include <linux/unistd.h>
21#include <linux/stddef.h>
22#include <linux/tty.h>
23#include <linux/personality.h>
24#include <linux/binfmts.h>
Martin Schwidefsky753c4dd2008-10-10 21:33:20 +020025#include <linux/tracehook.h>
Heiko Carstens26689452009-01-14 14:14:36 +010026#include <linux/syscalls.h>
Heiko Carstens77575912009-06-12 10:26:25 +020027#include <linux/compat.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070028#include <asm/ucontext.h>
29#include <asm/uaccess.h>
30#include <asm/lowcore.h>
David Howellsa0616cd2012-03-28 18:30:02 +010031#include <asm/switch_to.h>
Heiko Carstensa8061702008-04-17 07:46:26 +020032#include "entry.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070033
Linus Torvalds1da177e2005-04-16 15:20:36 -070034typedef struct
35{
36 __u8 callee_used_stack[__SIGNAL_FRAMESIZE];
37 struct sigcontext sc;
38 _sigregs sregs;
39 int signo;
40 __u8 retcode[S390_SYSCALL_SIZE];
41} sigframe;
42
43typedef struct
44{
45 __u8 callee_used_stack[__SIGNAL_FRAMESIZE];
46 __u8 retcode[S390_SYSCALL_SIZE];
47 struct siginfo info;
48 struct ucontext uc;
49} rt_sigframe;
50
Linus Torvalds1da177e2005-04-16 15:20:36 -070051/* Returns non-zero on fault. */
52static int save_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
53{
Gerald Schaefer6837a8c2006-09-20 15:59:39 +020054 _sigregs user_sregs;
55
Linus Torvalds1da177e2005-04-16 15:20:36 -070056 save_access_regs(current->thread.acrs);
57
58 /* Copy a 'clean' PSW mask to the user to avoid leaking
59 information about whether PER is currently on. */
Martin Schwidefskyd4e81b32011-10-30 15:16:51 +010060 user_sregs.regs.psw.mask = psw_user_bits |
61 (regs->psw.mask & PSW_MASK_USER);
Martin Schwidefskyb05e3702006-10-04 20:01:58 +020062 user_sregs.regs.psw.addr = regs->psw.addr;
63 memcpy(&user_sregs.regs.gprs, &regs->gprs, sizeof(sregs->regs.gprs));
Gerald Schaefer6837a8c2006-09-20 15:59:39 +020064 memcpy(&user_sregs.regs.acrs, current->thread.acrs,
65 sizeof(sregs->regs.acrs));
Linus Torvalds1da177e2005-04-16 15:20:36 -070066 /*
67 * We have to store the fp registers to current->thread.fp_regs
68 * to merge them with the emulated registers.
69 */
70 save_fp_regs(&current->thread.fp_regs);
Gerald Schaefer6837a8c2006-09-20 15:59:39 +020071 memcpy(&user_sregs.fpregs, &current->thread.fp_regs,
72 sizeof(s390_fp_regs));
73 return __copy_to_user(sregs, &user_sregs, sizeof(_sigregs));
Linus Torvalds1da177e2005-04-16 15:20:36 -070074}
75
76/* Returns positive number on error */
77static int restore_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
78{
Linus Torvalds1da177e2005-04-16 15:20:36 -070079 int err;
Gerald Schaefer6837a8c2006-09-20 15:59:39 +020080 _sigregs user_sregs;
Linus Torvalds1da177e2005-04-16 15:20:36 -070081
82 /* Alwys make any pending restarted system call return -EINTR */
83 current_thread_info()->restart_block.fn = do_no_restart_syscall;
84
Gerald Schaefer6837a8c2006-09-20 15:59:39 +020085 err = __copy_from_user(&user_sregs, sregs, sizeof(_sigregs));
Linus Torvalds1da177e2005-04-16 15:20:36 -070086 if (err)
87 return err;
Martin Schwidefskyd4e81b32011-10-30 15:16:51 +010088 /* Use regs->psw.mask instead of psw_user_bits to preserve PER bit. */
Martin Schwidefskyb50511e2011-10-30 15:16:50 +010089 regs->psw.mask = (regs->psw.mask & ~PSW_MASK_USER) |
Martin Schwidefskyd4e81b32011-10-30 15:16:51 +010090 (user_sregs.regs.psw.mask & PSW_MASK_USER);
Martin Schwidefskyfa968ee2012-11-07 10:44:08 +010091 /* Check for invalid user address space control. */
92 if ((regs->psw.mask & PSW_MASK_ASC) >= (psw_kernel_bits & PSW_MASK_ASC))
93 regs->psw.mask = (psw_user_bits & PSW_MASK_ASC) |
94 (regs->psw.mask & ~PSW_MASK_ASC);
Martin Schwidefskyd4e81b32011-10-30 15:16:51 +010095 /* Check for invalid amode */
96 if (regs->psw.mask & PSW_MASK_EA)
97 regs->psw.mask |= PSW_MASK_BA;
98 regs->psw.addr = user_sregs.regs.psw.addr;
Martin Schwidefskyb05e3702006-10-04 20:01:58 +020099 memcpy(&regs->gprs, &user_sregs.regs.gprs, sizeof(sregs->regs.gprs));
Gerald Schaefer6837a8c2006-09-20 15:59:39 +0200100 memcpy(&current->thread.acrs, &user_sregs.regs.acrs,
101 sizeof(sregs->regs.acrs));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102 restore_access_regs(current->thread.acrs);
103
Gerald Schaefer6837a8c2006-09-20 15:59:39 +0200104 memcpy(&current->thread.fp_regs, &user_sregs.fpregs,
105 sizeof(s390_fp_regs));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106 current->thread.fp_regs.fpc &= FPC_VALID_MASK;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107
108 restore_fp_regs(&current->thread.fp_regs);
Martin Schwidefskyb6ef5bb2011-10-30 15:16:49 +0100109 clear_thread_flag(TIF_SYSCALL); /* No longer in a system call */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110 return 0;
111}
112
Heiko Carstens26689452009-01-14 14:14:36 +0100113SYSCALL_DEFINE0(sigreturn)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114{
Martin Schwidefsky03ff9a22007-04-27 16:01:40 +0200115 struct pt_regs *regs = task_pt_regs(current);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116 sigframe __user *frame = (sigframe __user *)regs->gprs[15];
117 sigset_t set;
118
Linus Torvalds1da177e2005-04-16 15:20:36 -0700119 if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE))
120 goto badframe;
Heiko Carstens391c62f2011-08-03 16:44:26 +0200121 set_current_blocked(&set);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122 if (restore_sigregs(regs, &frame->sregs))
123 goto badframe;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124 return regs->gprs[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125badframe:
126 force_sig(SIGSEGV, current);
127 return 0;
128}
129
Heiko Carstens26689452009-01-14 14:14:36 +0100130SYSCALL_DEFINE0(rt_sigreturn)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131{
Martin Schwidefsky03ff9a22007-04-27 16:01:40 +0200132 struct pt_regs *regs = task_pt_regs(current);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133 rt_sigframe __user *frame = (rt_sigframe __user *)regs->gprs[15];
134 sigset_t set;
135
Linus Torvalds1da177e2005-04-16 15:20:36 -0700136 if (__copy_from_user(&set.sig, &frame->uc.uc_sigmask, sizeof(set)))
137 goto badframe;
Heiko Carstens391c62f2011-08-03 16:44:26 +0200138 set_current_blocked(&set);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700139 if (restore_sigregs(regs, &frame->uc.uc_mcontext))
140 goto badframe;
Al Viroe2141252012-12-23 03:36:41 -0500141 if (restore_altstack(&frame->uc.uc_stack))
Cedric Le Goater4e3df372006-01-06 00:19:10 -0800142 goto badframe;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143 return regs->gprs[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144badframe:
145 force_sig(SIGSEGV, current);
146 return 0;
147}
148
149/*
150 * Set up a signal frame.
151 */
152
153
154/*
155 * Determine which stack to use..
156 */
157static inline void __user *
158get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
159{
160 unsigned long sp;
161
162 /* Default to using normal stack */
163 sp = regs->gprs[15];
164
Heiko Carstensde553432008-04-17 07:45:57 +0200165 /* Overflow on alternate signal stack gives SIGSEGV. */
166 if (on_sig_stack(sp) && !on_sig_stack((sp - frame_size) & -8UL))
167 return (void __user *) -1UL;
168
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169 /* This is the X/Open sanctioned signal stack switching. */
170 if (ka->sa.sa_flags & SA_ONSTACK) {
171 if (! sas_ss_flags(sp))
172 sp = current->sas_ss_sp + current->sas_ss_size;
173 }
174
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175 return (void __user *)((sp - frame_size) & -8ul);
176}
177
178static inline int map_signal(int sig)
179{
180 if (current_thread_info()->exec_domain
181 && current_thread_info()->exec_domain->signal_invmap
182 && sig < 32)
183 return current_thread_info()->exec_domain->signal_invmap[sig];
184 else
185 return sig;
186}
187
Heiko Carstens54dfe5d2006-02-01 03:06:38 -0800188static int setup_frame(int sig, struct k_sigaction *ka,
189 sigset_t *set, struct pt_regs * regs)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700190{
191 sigframe __user *frame;
192
193 frame = get_sigframe(ka, regs, sizeof(sigframe));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700194
Heiko Carstensde553432008-04-17 07:45:57 +0200195 if (frame == (void __user *) -1UL)
196 goto give_sigsegv;
197
Linus Torvalds1da177e2005-04-16 15:20:36 -0700198 if (__copy_to_user(&frame->sc.oldmask, &set->sig, _SIGMASK_COPY_SIZE))
199 goto give_sigsegv;
200
201 if (save_sigregs(regs, &frame->sregs))
202 goto give_sigsegv;
203 if (__put_user(&frame->sregs, &frame->sc.sregs))
204 goto give_sigsegv;
205
206 /* Set up to return from userspace. If provided, use a stub
207 already in userspace. */
208 if (ka->sa.sa_flags & SA_RESTORER) {
209 regs->gprs[14] = (unsigned long)
210 ka->sa.sa_restorer | PSW_ADDR_AMODE;
211 } else {
212 regs->gprs[14] = (unsigned long)
213 frame->retcode | PSW_ADDR_AMODE;
214 if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn,
215 (u16 __user *)(frame->retcode)))
216 goto give_sigsegv;
217 }
218
219 /* Set up backchain. */
220 if (__put_user(regs->gprs[15], (addr_t __user *) frame))
221 goto give_sigsegv;
222
223 /* Set up registers for signal handler */
224 regs->gprs[15] = (unsigned long) frame;
Martin Schwidefskyfa968ee2012-11-07 10:44:08 +0100225 /* Force default amode and default user address space control. */
226 regs->psw.mask = PSW_MASK_EA | PSW_MASK_BA |
227 (psw_user_bits & PSW_MASK_ASC) |
228 (regs->psw.mask & ~PSW_MASK_ASC);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229 regs->psw.addr = (unsigned long) ka->sa.sa_handler | PSW_ADDR_AMODE;
230
231 regs->gprs[2] = map_signal(sig);
232 regs->gprs[3] = (unsigned long) &frame->sc;
233
234 /* We forgot to include these in the sigcontext.
235 To avoid breaking binary compatibility, they are passed as args. */
Martin Schwidefskyaa33c8c2011-12-27 11:27:18 +0100236 if (sig == SIGSEGV || sig == SIGBUS || sig == SIGILL ||
237 sig == SIGTRAP || sig == SIGFPE) {
238 /* set extra registers only for synchronous signals */
239 regs->gprs[4] = regs->int_code & 127;
240 regs->gprs[5] = regs->int_parm_long;
241 regs->gprs[6] = task_thread_info(current)->last_break;
242 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700243
244 /* Place signal number on stack to allow backtrace from handler. */
245 if (__put_user(regs->gprs[2], (int __user *) &frame->signo))
246 goto give_sigsegv;
Heiko Carstens54dfe5d2006-02-01 03:06:38 -0800247 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700248
249give_sigsegv:
250 force_sigsegv(sig, current);
Heiko Carstens54dfe5d2006-02-01 03:06:38 -0800251 return -EFAULT;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252}
253
Heiko Carstens54dfe5d2006-02-01 03:06:38 -0800254static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700255 sigset_t *set, struct pt_regs * regs)
256{
257 int err = 0;
258 rt_sigframe __user *frame;
259
260 frame = get_sigframe(ka, regs, sizeof(rt_sigframe));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700261
Heiko Carstensde553432008-04-17 07:45:57 +0200262 if (frame == (void __user *) -1UL)
263 goto give_sigsegv;
264
Linus Torvalds1da177e2005-04-16 15:20:36 -0700265 if (copy_siginfo_to_user(&frame->info, info))
266 goto give_sigsegv;
267
268 /* Create the ucontext. */
269 err |= __put_user(0, &frame->uc.uc_flags);
Al Viroc2814472005-09-29 00:16:02 +0100270 err |= __put_user(NULL, &frame->uc.uc_link);
Al Viroe2141252012-12-23 03:36:41 -0500271 err |= __save_altstack(&frame->uc.uc_stack, regs->gprs[15]);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700272 err |= save_sigregs(regs, &frame->uc.uc_mcontext);
273 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
274 if (err)
275 goto give_sigsegv;
276
277 /* Set up to return from userspace. If provided, use a stub
278 already in userspace. */
279 if (ka->sa.sa_flags & SA_RESTORER) {
280 regs->gprs[14] = (unsigned long)
281 ka->sa.sa_restorer | PSW_ADDR_AMODE;
282 } else {
283 regs->gprs[14] = (unsigned long)
284 frame->retcode | PSW_ADDR_AMODE;
Heiko Carstensb44df332006-05-01 12:16:15 -0700285 if (__put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn,
286 (u16 __user *)(frame->retcode)))
287 goto give_sigsegv;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700288 }
289
290 /* Set up backchain. */
291 if (__put_user(regs->gprs[15], (addr_t __user *) frame))
292 goto give_sigsegv;
293
294 /* Set up registers for signal handler */
295 regs->gprs[15] = (unsigned long) frame;
Martin Schwidefskyfa968ee2012-11-07 10:44:08 +0100296 /* Force default amode and default user address space control. */
297 regs->psw.mask = PSW_MASK_EA | PSW_MASK_BA |
298 (psw_user_bits & PSW_MASK_ASC) |
299 (regs->psw.mask & ~PSW_MASK_ASC);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700300 regs->psw.addr = (unsigned long) ka->sa.sa_handler | PSW_ADDR_AMODE;
301
302 regs->gprs[2] = map_signal(sig);
303 regs->gprs[3] = (unsigned long) &frame->info;
304 regs->gprs[4] = (unsigned long) &frame->uc;
Martin Schwidefsky86f25522010-05-17 10:00:05 +0200305 regs->gprs[5] = task_thread_info(current)->last_break;
Heiko Carstens54dfe5d2006-02-01 03:06:38 -0800306 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700307
308give_sigsegv:
309 force_sigsegv(sig, current);
Heiko Carstens54dfe5d2006-02-01 03:06:38 -0800310 return -EFAULT;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700311}
312
Al Viroa610d6e2012-05-21 23:42:15 -0400313static void handle_signal(unsigned long sig, struct k_sigaction *ka,
Heiko Carstens391c62f2011-08-03 16:44:26 +0200314 siginfo_t *info, sigset_t *oldset,
315 struct pt_regs *regs)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700316{
Heiko Carstens54dfe5d2006-02-01 03:06:38 -0800317 int ret;
318
Linus Torvalds1da177e2005-04-16 15:20:36 -0700319 /* Set up the stack frame */
320 if (ka->sa.sa_flags & SA_SIGINFO)
Heiko Carstens54dfe5d2006-02-01 03:06:38 -0800321 ret = setup_rt_frame(sig, ka, info, oldset, regs);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700322 else
Heiko Carstens54dfe5d2006-02-01 03:06:38 -0800323 ret = setup_frame(sig, ka, oldset, regs);
Heiko Carstens391c62f2011-08-03 16:44:26 +0200324 if (ret)
Al Viroa610d6e2012-05-21 23:42:15 -0400325 return;
Al Viroefee9842012-04-28 02:04:15 -0400326 signal_delivered(sig, info, ka, regs,
Al Viroa610d6e2012-05-21 23:42:15 -0400327 test_thread_flag(TIF_SINGLE_STEP));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700328}
329
330/*
331 * Note that 'init' is a special process: it doesn't get signals it doesn't
332 * want to handle. Thus you cannot kill init even with a SIGKILL even by
333 * mistake.
334 *
335 * Note that we go through the signals twice: once to check the signals that
336 * the kernel can handle, and then we build all the user-level signal handling
337 * stack-frames in one go after that.
338 */
Heiko Carstens54dfe5d2006-02-01 03:06:38 -0800339void do_signal(struct pt_regs *regs)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700340{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700341 siginfo_t info;
342 int signr;
343 struct k_sigaction ka;
Al Virob7f9a112012-05-02 09:59:21 -0400344 sigset_t *oldset = sigmask_to_save();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700345
Martin Schwidefsky20b40a72011-10-30 15:16:47 +0100346 /*
347 * Get signal to deliver. When running under ptrace, at this point
348 * the debugger may change all our registers, including the system
349 * call information.
350 */
Martin Schwidefskyb6ef5bb2011-10-30 15:16:49 +0100351 current_thread_info()->system_call =
Martin Schwidefskyaa33c8c2011-12-27 11:27:18 +0100352 test_thread_flag(TIF_SYSCALL) ? regs->int_code : 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700353 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700354
355 if (signr > 0) {
356 /* Whee! Actually deliver the signal. */
Martin Schwidefskyb6ef5bb2011-10-30 15:16:49 +0100357 if (current_thread_info()->system_call) {
Martin Schwidefskyaa33c8c2011-12-27 11:27:18 +0100358 regs->int_code = current_thread_info()->system_call;
Martin Schwidefsky20b40a72011-10-30 15:16:47 +0100359 /* Check for system call restarting. */
360 switch (regs->gprs[2]) {
361 case -ERESTART_RESTARTBLOCK:
362 case -ERESTARTNOHAND:
363 regs->gprs[2] = -EINTR;
364 break;
365 case -ERESTARTSYS:
366 if (!(ka.sa.sa_flags & SA_RESTART)) {
367 regs->gprs[2] = -EINTR;
368 break;
369 }
370 /* fallthrough */
371 case -ERESTARTNOINTR:
372 regs->gprs[2] = regs->orig_gpr2;
Martin Schwidefskyccf45ca2011-10-30 15:16:48 +0100373 regs->psw.addr =
374 __rewind_psw(regs->psw,
Martin Schwidefskyaa33c8c2011-12-27 11:27:18 +0100375 regs->int_code >> 16);
Martin Schwidefsky20b40a72011-10-30 15:16:47 +0100376 break;
377 }
Martin Schwidefsky20b40a72011-10-30 15:16:47 +0100378 }
Martin Schwidefskyd9ae6772011-12-01 13:32:15 +0100379 /* No longer in a system call */
380 clear_thread_flag(TIF_SYSCALL);
Martin Schwidefsky20b40a72011-10-30 15:16:47 +0100381
Al Viroa610d6e2012-05-21 23:42:15 -0400382 if (is_compat_task())
383 handle_signal32(signr, &ka, &info, oldset, regs);
384 else
385 handle_signal(signr, &ka, &info, oldset, regs);
Heiko Carstens54dfe5d2006-02-01 03:06:38 -0800386 return;
387 }
388
Martin Schwidefsky20b40a72011-10-30 15:16:47 +0100389 /* No handlers present - check for system call restart */
Martin Schwidefskyd9ae6772011-12-01 13:32:15 +0100390 clear_thread_flag(TIF_SYSCALL);
Martin Schwidefskyb6ef5bb2011-10-30 15:16:49 +0100391 if (current_thread_info()->system_call) {
Martin Schwidefskyaa33c8c2011-12-27 11:27:18 +0100392 regs->int_code = current_thread_info()->system_call;
Martin Schwidefsky20b40a72011-10-30 15:16:47 +0100393 switch (regs->gprs[2]) {
394 case -ERESTART_RESTARTBLOCK:
395 /* Restart with sys_restart_syscall */
Martin Schwidefskyaa33c8c2011-12-27 11:27:18 +0100396 regs->int_code = __NR_restart_syscall;
Martin Schwidefsky20b40a72011-10-30 15:16:47 +0100397 /* fallthrough */
398 case -ERESTARTNOHAND:
399 case -ERESTARTSYS:
400 case -ERESTARTNOINTR:
401 /* Restart system call with magic TIF bit. */
402 regs->gprs[2] = regs->orig_gpr2;
Martin Schwidefskyb6ef5bb2011-10-30 15:16:49 +0100403 set_thread_flag(TIF_SYSCALL);
Martin Schwidefsky39efd4e2012-11-21 16:36:27 +0100404 if (test_thread_flag(TIF_SINGLE_STEP))
405 set_thread_flag(TIF_PER_TRAP);
Martin Schwidefskyb6ef5bb2011-10-30 15:16:49 +0100406 break;
Martin Schwidefsky20b40a72011-10-30 15:16:47 +0100407 }
408 }
409
Heiko Carstens54dfe5d2006-02-01 03:06:38 -0800410 /*
411 * If there's no signal to deliver, we just put the saved sigmask back.
412 */
Al Viro51a7b442012-05-21 23:33:55 -0400413 restore_saved_sigmask();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700414}
Martin Schwidefsky753c4dd2008-10-10 21:33:20 +0200415
416void do_notify_resume(struct pt_regs *regs)
417{
418 clear_thread_flag(TIF_NOTIFY_RESUME);
419 tracehook_notify_resume(regs);
420}