debugfs: Modified default dir of debugfs for debugging UHCI.
[linux/fpc-iii.git] / arch / arm / kernel / signal.c
blob1423a3419789c0d2ddaacbb7ae763da8c17e55c9
1 /*
2 * linux/arch/arm/kernel/signal.c
4 * Copyright (C) 1995-2002 Russell King
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10 #include <linux/errno.h>
11 #include <linux/signal.h>
12 #include <linux/personality.h>
13 #include <linux/freezer.h>
14 #include <linux/uaccess.h>
15 #include <linux/tracehook.h>
17 #include <asm/elf.h>
18 #include <asm/cacheflush.h>
19 #include <asm/ucontext.h>
20 #include <asm/unistd.h>
22 #include "ptrace.h"
23 #include "signal.h"
25 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
28 * For ARM syscalls, we encode the syscall number into the instruction.
30 #define SWI_SYS_SIGRETURN (0xef000000|(__NR_sigreturn)|(__NR_OABI_SYSCALL_BASE))
31 #define SWI_SYS_RT_SIGRETURN (0xef000000|(__NR_rt_sigreturn)|(__NR_OABI_SYSCALL_BASE))
34 * With EABI, the syscall number has to be loaded into r7.
36 #define MOV_R7_NR_SIGRETURN (0xe3a07000 | (__NR_sigreturn - __NR_SYSCALL_BASE))
37 #define MOV_R7_NR_RT_SIGRETURN (0xe3a07000 | (__NR_rt_sigreturn - __NR_SYSCALL_BASE))
40 * For Thumb syscalls, we pass the syscall number via r7. We therefore
41 * need two 16-bit instructions.
43 #define SWI_THUMB_SIGRETURN (0xdf00 << 16 | 0x2700 | (__NR_sigreturn - __NR_SYSCALL_BASE))
44 #define SWI_THUMB_RT_SIGRETURN (0xdf00 << 16 | 0x2700 | (__NR_rt_sigreturn - __NR_SYSCALL_BASE))
46 const unsigned long sigreturn_codes[7] = {
47 MOV_R7_NR_SIGRETURN, SWI_SYS_SIGRETURN, SWI_THUMB_SIGRETURN,
48 MOV_R7_NR_RT_SIGRETURN, SWI_SYS_RT_SIGRETURN, SWI_THUMB_RT_SIGRETURN,
52 * atomically swap in the new signal mask, and wait for a signal.
54 asmlinkage int sys_sigsuspend(int restart, unsigned long oldmask, old_sigset_t mask)
56 mask &= _BLOCKABLE;
57 spin_lock_irq(&current->sighand->siglock);
58 current->saved_sigmask = current->blocked;
59 siginitset(&current->blocked, mask);
60 recalc_sigpending();
61 spin_unlock_irq(&current->sighand->siglock);
63 current->state = TASK_INTERRUPTIBLE;
64 schedule();
65 set_restore_sigmask();
66 return -ERESTARTNOHAND;
69 asmlinkage int
70 sys_sigaction(int sig, const struct old_sigaction __user *act,
71 struct old_sigaction __user *oact)
73 struct k_sigaction new_ka, old_ka;
74 int ret;
76 if (act) {
77 old_sigset_t mask;
78 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
79 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
80 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
81 return -EFAULT;
82 __get_user(new_ka.sa.sa_flags, &act->sa_flags);
83 __get_user(mask, &act->sa_mask);
84 siginitset(&new_ka.sa.sa_mask, mask);
87 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
89 if (!ret && oact) {
90 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
91 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
92 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
93 return -EFAULT;
94 __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
95 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
98 return ret;
101 #ifdef CONFIG_CRUNCH
102 static int preserve_crunch_context(struct crunch_sigframe __user *frame)
104 char kbuf[sizeof(*frame) + 8];
105 struct crunch_sigframe *kframe;
107 /* the crunch context must be 64 bit aligned */
108 kframe = (struct crunch_sigframe *)((unsigned long)(kbuf + 8) & ~7);
109 kframe->magic = CRUNCH_MAGIC;
110 kframe->size = CRUNCH_STORAGE_SIZE;
111 crunch_task_copy(current_thread_info(), &kframe->storage);
112 return __copy_to_user(frame, kframe, sizeof(*frame));
115 static int restore_crunch_context(struct crunch_sigframe __user *frame)
117 char kbuf[sizeof(*frame) + 8];
118 struct crunch_sigframe *kframe;
120 /* the crunch context must be 64 bit aligned */
121 kframe = (struct crunch_sigframe *)((unsigned long)(kbuf + 8) & ~7);
122 if (__copy_from_user(kframe, frame, sizeof(*frame)))
123 return -1;
124 if (kframe->magic != CRUNCH_MAGIC ||
125 kframe->size != CRUNCH_STORAGE_SIZE)
126 return -1;
127 crunch_task_restore(current_thread_info(), &kframe->storage);
128 return 0;
130 #endif
132 #ifdef CONFIG_IWMMXT
134 static int preserve_iwmmxt_context(struct iwmmxt_sigframe *frame)
136 char kbuf[sizeof(*frame) + 8];
137 struct iwmmxt_sigframe *kframe;
139 /* the iWMMXt context must be 64 bit aligned */
140 kframe = (struct iwmmxt_sigframe *)((unsigned long)(kbuf + 8) & ~7);
141 kframe->magic = IWMMXT_MAGIC;
142 kframe->size = IWMMXT_STORAGE_SIZE;
143 iwmmxt_task_copy(current_thread_info(), &kframe->storage);
144 return __copy_to_user(frame, kframe, sizeof(*frame));
147 static int restore_iwmmxt_context(struct iwmmxt_sigframe *frame)
149 char kbuf[sizeof(*frame) + 8];
150 struct iwmmxt_sigframe *kframe;
152 /* the iWMMXt context must be 64 bit aligned */
153 kframe = (struct iwmmxt_sigframe *)((unsigned long)(kbuf + 8) & ~7);
154 if (__copy_from_user(kframe, frame, sizeof(*frame)))
155 return -1;
156 if (kframe->magic != IWMMXT_MAGIC ||
157 kframe->size != IWMMXT_STORAGE_SIZE)
158 return -1;
159 iwmmxt_task_restore(current_thread_info(), &kframe->storage);
160 return 0;
163 #endif
166 * Do a signal return; undo the signal stack. These are aligned to 64-bit.
168 struct sigframe {
169 struct ucontext uc;
170 unsigned long retcode[2];
173 struct rt_sigframe {
174 struct siginfo info;
175 struct sigframe sig;
178 static int restore_sigframe(struct pt_regs *regs, struct sigframe __user *sf)
180 struct aux_sigframe __user *aux;
181 sigset_t set;
182 int err;
184 err = __copy_from_user(&set, &sf->uc.uc_sigmask, sizeof(set));
185 if (err == 0) {
186 sigdelsetmask(&set, ~_BLOCKABLE);
187 spin_lock_irq(&current->sighand->siglock);
188 current->blocked = set;
189 recalc_sigpending();
190 spin_unlock_irq(&current->sighand->siglock);
193 __get_user_error(regs->ARM_r0, &sf->uc.uc_mcontext.arm_r0, err);
194 __get_user_error(regs->ARM_r1, &sf->uc.uc_mcontext.arm_r1, err);
195 __get_user_error(regs->ARM_r2, &sf->uc.uc_mcontext.arm_r2, err);
196 __get_user_error(regs->ARM_r3, &sf->uc.uc_mcontext.arm_r3, err);
197 __get_user_error(regs->ARM_r4, &sf->uc.uc_mcontext.arm_r4, err);
198 __get_user_error(regs->ARM_r5, &sf->uc.uc_mcontext.arm_r5, err);
199 __get_user_error(regs->ARM_r6, &sf->uc.uc_mcontext.arm_r6, err);
200 __get_user_error(regs->ARM_r7, &sf->uc.uc_mcontext.arm_r7, err);
201 __get_user_error(regs->ARM_r8, &sf->uc.uc_mcontext.arm_r8, err);
202 __get_user_error(regs->ARM_r9, &sf->uc.uc_mcontext.arm_r9, err);
203 __get_user_error(regs->ARM_r10, &sf->uc.uc_mcontext.arm_r10, err);
204 __get_user_error(regs->ARM_fp, &sf->uc.uc_mcontext.arm_fp, err);
205 __get_user_error(regs->ARM_ip, &sf->uc.uc_mcontext.arm_ip, err);
206 __get_user_error(regs->ARM_sp, &sf->uc.uc_mcontext.arm_sp, err);
207 __get_user_error(regs->ARM_lr, &sf->uc.uc_mcontext.arm_lr, err);
208 __get_user_error(regs->ARM_pc, &sf->uc.uc_mcontext.arm_pc, err);
209 __get_user_error(regs->ARM_cpsr, &sf->uc.uc_mcontext.arm_cpsr, err);
211 err |= !valid_user_regs(regs);
213 aux = (struct aux_sigframe __user *) sf->uc.uc_regspace;
214 #ifdef CONFIG_CRUNCH
215 if (err == 0)
216 err |= restore_crunch_context(&aux->crunch);
217 #endif
218 #ifdef CONFIG_IWMMXT
219 if (err == 0 && test_thread_flag(TIF_USING_IWMMXT))
220 err |= restore_iwmmxt_context(&aux->iwmmxt);
221 #endif
222 #ifdef CONFIG_VFP
223 // if (err == 0)
224 // err |= vfp_restore_state(&sf->aux.vfp);
225 #endif
227 return err;
230 asmlinkage int sys_sigreturn(struct pt_regs *regs)
232 struct sigframe __user *frame;
234 /* Always make any pending restarted system calls return -EINTR */
235 current_thread_info()->restart_block.fn = do_no_restart_syscall;
238 * Since we stacked the signal on a 64-bit boundary,
239 * then 'sp' should be word aligned here. If it's
240 * not, then the user is trying to mess with us.
242 if (regs->ARM_sp & 7)
243 goto badframe;
245 frame = (struct sigframe __user *)regs->ARM_sp;
247 if (!access_ok(VERIFY_READ, frame, sizeof (*frame)))
248 goto badframe;
250 if (restore_sigframe(regs, frame))
251 goto badframe;
253 single_step_trap(current);
255 return regs->ARM_r0;
257 badframe:
258 force_sig(SIGSEGV, current);
259 return 0;
262 asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
264 struct rt_sigframe __user *frame;
266 /* Always make any pending restarted system calls return -EINTR */
267 current_thread_info()->restart_block.fn = do_no_restart_syscall;
270 * Since we stacked the signal on a 64-bit boundary,
271 * then 'sp' should be word aligned here. If it's
272 * not, then the user is trying to mess with us.
274 if (regs->ARM_sp & 7)
275 goto badframe;
277 frame = (struct rt_sigframe __user *)regs->ARM_sp;
279 if (!access_ok(VERIFY_READ, frame, sizeof (*frame)))
280 goto badframe;
282 if (restore_sigframe(regs, &frame->sig))
283 goto badframe;
285 if (do_sigaltstack(&frame->sig.uc.uc_stack, NULL, regs->ARM_sp) == -EFAULT)
286 goto badframe;
288 single_step_trap(current);
290 return regs->ARM_r0;
292 badframe:
293 force_sig(SIGSEGV, current);
294 return 0;
297 static int
298 setup_sigframe(struct sigframe __user *sf, struct pt_regs *regs, sigset_t *set)
300 struct aux_sigframe __user *aux;
301 int err = 0;
303 __put_user_error(regs->ARM_r0, &sf->uc.uc_mcontext.arm_r0, err);
304 __put_user_error(regs->ARM_r1, &sf->uc.uc_mcontext.arm_r1, err);
305 __put_user_error(regs->ARM_r2, &sf->uc.uc_mcontext.arm_r2, err);
306 __put_user_error(regs->ARM_r3, &sf->uc.uc_mcontext.arm_r3, err);
307 __put_user_error(regs->ARM_r4, &sf->uc.uc_mcontext.arm_r4, err);
308 __put_user_error(regs->ARM_r5, &sf->uc.uc_mcontext.arm_r5, err);
309 __put_user_error(regs->ARM_r6, &sf->uc.uc_mcontext.arm_r6, err);
310 __put_user_error(regs->ARM_r7, &sf->uc.uc_mcontext.arm_r7, err);
311 __put_user_error(regs->ARM_r8, &sf->uc.uc_mcontext.arm_r8, err);
312 __put_user_error(regs->ARM_r9, &sf->uc.uc_mcontext.arm_r9, err);
313 __put_user_error(regs->ARM_r10, &sf->uc.uc_mcontext.arm_r10, err);
314 __put_user_error(regs->ARM_fp, &sf->uc.uc_mcontext.arm_fp, err);
315 __put_user_error(regs->ARM_ip, &sf->uc.uc_mcontext.arm_ip, err);
316 __put_user_error(regs->ARM_sp, &sf->uc.uc_mcontext.arm_sp, err);
317 __put_user_error(regs->ARM_lr, &sf->uc.uc_mcontext.arm_lr, err);
318 __put_user_error(regs->ARM_pc, &sf->uc.uc_mcontext.arm_pc, err);
319 __put_user_error(regs->ARM_cpsr, &sf->uc.uc_mcontext.arm_cpsr, err);
321 __put_user_error(current->thread.trap_no, &sf->uc.uc_mcontext.trap_no, err);
322 __put_user_error(current->thread.error_code, &sf->uc.uc_mcontext.error_code, err);
323 __put_user_error(current->thread.address, &sf->uc.uc_mcontext.fault_address, err);
324 __put_user_error(set->sig[0], &sf->uc.uc_mcontext.oldmask, err);
326 err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(*set));
328 aux = (struct aux_sigframe __user *) sf->uc.uc_regspace;
329 #ifdef CONFIG_CRUNCH
330 if (err == 0)
331 err |= preserve_crunch_context(&aux->crunch);
332 #endif
333 #ifdef CONFIG_IWMMXT
334 if (err == 0 && test_thread_flag(TIF_USING_IWMMXT))
335 err |= preserve_iwmmxt_context(&aux->iwmmxt);
336 #endif
337 #ifdef CONFIG_VFP
338 // if (err == 0)
339 // err |= vfp_save_state(&sf->aux.vfp);
340 #endif
341 __put_user_error(0, &aux->end_magic, err);
343 return err;
346 static inline void __user *
347 get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, int framesize)
349 unsigned long sp = regs->ARM_sp;
350 void __user *frame;
353 * This is the X/Open sanctioned signal stack switching.
355 if ((ka->sa.sa_flags & SA_ONSTACK) && !sas_ss_flags(sp))
356 sp = current->sas_ss_sp + current->sas_ss_size;
359 * ATPCS B01 mandates 8-byte alignment
361 frame = (void __user *)((sp - framesize) & ~7);
364 * Check that we can actually write to the signal frame.
366 if (!access_ok(VERIFY_WRITE, frame, framesize))
367 frame = NULL;
369 return frame;
372 static int
373 setup_return(struct pt_regs *regs, struct k_sigaction *ka,
374 unsigned long __user *rc, void __user *frame, int usig)
376 unsigned long handler = (unsigned long)ka->sa.sa_handler;
377 unsigned long retcode;
378 int thumb = 0;
379 unsigned long cpsr = regs->ARM_cpsr & ~PSR_f;
382 * Maybe we need to deliver a 32-bit signal to a 26-bit task.
384 if (ka->sa.sa_flags & SA_THIRTYTWO)
385 cpsr = (cpsr & ~MODE_MASK) | USR_MODE;
387 #ifdef CONFIG_ARM_THUMB
388 if (elf_hwcap & HWCAP_THUMB) {
390 * The LSB of the handler determines if we're going to
391 * be using THUMB or ARM mode for this signal handler.
393 thumb = handler & 1;
395 if (thumb) {
396 cpsr |= PSR_T_BIT;
397 #if __LINUX_ARM_ARCH__ >= 7
398 /* clear the If-Then Thumb-2 execution state */
399 cpsr &= ~PSR_IT_MASK;
400 #endif
401 } else
402 cpsr &= ~PSR_T_BIT;
404 #endif
406 if (ka->sa.sa_flags & SA_RESTORER) {
407 retcode = (unsigned long)ka->sa.sa_restorer;
408 } else {
409 unsigned int idx = thumb << 1;
411 if (ka->sa.sa_flags & SA_SIGINFO)
412 idx += 3;
414 if (__put_user(sigreturn_codes[idx], rc) ||
415 __put_user(sigreturn_codes[idx+1], rc+1))
416 return 1;
418 if (cpsr & MODE32_BIT) {
420 * 32-bit code can use the new high-page
421 * signal return code support.
423 retcode = KERN_SIGRETURN_CODE + (idx << 2) + thumb;
424 } else {
426 * Ensure that the instruction cache sees
427 * the return code written onto the stack.
429 flush_icache_range((unsigned long)rc,
430 (unsigned long)(rc + 2));
432 retcode = ((unsigned long)rc) + thumb;
436 regs->ARM_r0 = usig;
437 regs->ARM_sp = (unsigned long)frame;
438 regs->ARM_lr = retcode;
439 regs->ARM_pc = handler;
440 regs->ARM_cpsr = cpsr;
442 return 0;
445 static int
446 setup_frame(int usig, struct k_sigaction *ka, sigset_t *set, struct pt_regs *regs)
448 struct sigframe __user *frame = get_sigframe(ka, regs, sizeof(*frame));
449 int err = 0;
451 if (!frame)
452 return 1;
455 * Set uc.uc_flags to a value which sc.trap_no would never have.
457 __put_user_error(0x5ac3c35a, &frame->uc.uc_flags, err);
459 err |= setup_sigframe(frame, regs, set);
460 if (err == 0)
461 err = setup_return(regs, ka, frame->retcode, frame, usig);
463 return err;
466 static int
467 setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
468 sigset_t *set, struct pt_regs *regs)
470 struct rt_sigframe __user *frame = get_sigframe(ka, regs, sizeof(*frame));
471 stack_t stack;
472 int err = 0;
474 if (!frame)
475 return 1;
477 err |= copy_siginfo_to_user(&frame->info, info);
479 __put_user_error(0, &frame->sig.uc.uc_flags, err);
480 __put_user_error(NULL, &frame->sig.uc.uc_link, err);
482 memset(&stack, 0, sizeof(stack));
483 stack.ss_sp = (void __user *)current->sas_ss_sp;
484 stack.ss_flags = sas_ss_flags(regs->ARM_sp);
485 stack.ss_size = current->sas_ss_size;
486 err |= __copy_to_user(&frame->sig.uc.uc_stack, &stack, sizeof(stack));
488 err |= setup_sigframe(&frame->sig, regs, set);
489 if (err == 0)
490 err = setup_return(regs, ka, frame->sig.retcode, frame, usig);
492 if (err == 0) {
494 * For realtime signals we must also set the second and third
495 * arguments for the signal handler.
496 * -- Peter Maydell <pmaydell@chiark.greenend.org.uk> 2000-12-06
498 regs->ARM_r1 = (unsigned long)&frame->info;
499 regs->ARM_r2 = (unsigned long)&frame->sig.uc;
502 return err;
505 static inline void setup_syscall_restart(struct pt_regs *regs)
507 regs->ARM_r0 = regs->ARM_ORIG_r0;
508 regs->ARM_pc -= thumb_mode(regs) ? 2 : 4;
512 * OK, we're invoking a handler
514 static int
515 handle_signal(unsigned long sig, struct k_sigaction *ka,
516 siginfo_t *info, sigset_t *oldset,
517 struct pt_regs * regs, int syscall)
519 struct thread_info *thread = current_thread_info();
520 struct task_struct *tsk = current;
521 int usig = sig;
522 int ret;
525 * If we were from a system call, check for system call restarting...
527 if (syscall) {
528 switch (regs->ARM_r0) {
529 case -ERESTART_RESTARTBLOCK:
530 case -ERESTARTNOHAND:
531 regs->ARM_r0 = -EINTR;
532 break;
533 case -ERESTARTSYS:
534 if (!(ka->sa.sa_flags & SA_RESTART)) {
535 regs->ARM_r0 = -EINTR;
536 break;
538 /* fallthrough */
539 case -ERESTARTNOINTR:
540 setup_syscall_restart(regs);
545 * translate the signal
547 if (usig < 32 && thread->exec_domain && thread->exec_domain->signal_invmap)
548 usig = thread->exec_domain->signal_invmap[usig];
551 * Set up the stack frame
553 if (ka->sa.sa_flags & SA_SIGINFO)
554 ret = setup_rt_frame(usig, ka, info, oldset, regs);
555 else
556 ret = setup_frame(usig, ka, oldset, regs);
559 * Check that the resulting registers are actually sane.
561 ret |= !valid_user_regs(regs);
563 if (ret != 0) {
564 force_sigsegv(sig, tsk);
565 return ret;
569 * Block the signal if we were successful.
571 spin_lock_irq(&tsk->sighand->siglock);
572 sigorsets(&tsk->blocked, &tsk->blocked,
573 &ka->sa.sa_mask);
574 if (!(ka->sa.sa_flags & SA_NODEFER))
575 sigaddset(&tsk->blocked, sig);
576 recalc_sigpending();
577 spin_unlock_irq(&tsk->sighand->siglock);
579 return 0;
583 * Note that 'init' is a special process: it doesn't get signals it doesn't
584 * want to handle. Thus you cannot kill init even with a SIGKILL even by
585 * mistake.
587 * Note that we go through the signals twice: once to check the signals that
588 * the kernel can handle, and then we build all the user-level signal handling
589 * stack-frames in one go after that.
591 static void do_signal(struct pt_regs *regs, int syscall)
593 struct k_sigaction ka;
594 siginfo_t info;
595 int signr;
598 * We want the common case to go fast, which
599 * is why we may in certain cases get here from
600 * kernel mode. Just return without doing anything
601 * if so.
603 if (!user_mode(regs))
604 return;
606 if (try_to_freeze())
607 goto no_signal;
609 single_step_clear(current);
611 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
612 if (signr > 0) {
613 sigset_t *oldset;
615 if (test_thread_flag(TIF_RESTORE_SIGMASK))
616 oldset = &current->saved_sigmask;
617 else
618 oldset = &current->blocked;
619 if (handle_signal(signr, &ka, &info, oldset, regs, syscall) == 0) {
621 * A signal was successfully delivered; the saved
622 * sigmask will have been stored in the signal frame,
623 * and will be restored by sigreturn, so we can simply
624 * clear the TIF_RESTORE_SIGMASK flag.
626 if (test_thread_flag(TIF_RESTORE_SIGMASK))
627 clear_thread_flag(TIF_RESTORE_SIGMASK);
629 single_step_set(current);
630 return;
633 no_signal:
635 * No signal to deliver to the process - restart the syscall.
637 if (syscall) {
638 if (regs->ARM_r0 == -ERESTART_RESTARTBLOCK) {
639 if (thumb_mode(regs)) {
640 regs->ARM_r7 = __NR_restart_syscall - __NR_SYSCALL_BASE;
641 regs->ARM_pc -= 2;
642 } else {
643 #if defined(CONFIG_AEABI) && !defined(CONFIG_OABI_COMPAT)
644 regs->ARM_r7 = __NR_restart_syscall;
645 regs->ARM_pc -= 4;
646 #else
647 u32 __user *usp;
648 u32 swival = __NR_restart_syscall;
650 regs->ARM_sp -= 12;
651 usp = (u32 __user *)regs->ARM_sp;
654 * Either we supports OABI only, or we have
655 * EABI with the OABI compat layer enabled.
656 * In the later case we don't know if user
657 * space is EABI or not, and if not we must
658 * not clobber r7. Always using the OABI
659 * syscall solves that issue and works for
660 * all those cases.
662 swival = swival - __NR_SYSCALL_BASE + __NR_OABI_SYSCALL_BASE;
664 put_user(regs->ARM_pc, &usp[0]);
665 /* swi __NR_restart_syscall */
666 put_user(0xef000000 | swival, &usp[1]);
667 /* ldr pc, [sp], #12 */
668 put_user(0xe49df00c, &usp[2]);
670 flush_icache_range((unsigned long)usp,
671 (unsigned long)(usp + 3));
673 regs->ARM_pc = regs->ARM_sp + 4;
674 #endif
677 if (regs->ARM_r0 == -ERESTARTNOHAND ||
678 regs->ARM_r0 == -ERESTARTSYS ||
679 regs->ARM_r0 == -ERESTARTNOINTR) {
680 setup_syscall_restart(regs);
683 /* If there's no signal to deliver, we just put the saved sigmask
684 * back.
686 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
687 clear_thread_flag(TIF_RESTORE_SIGMASK);
688 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
691 single_step_set(current);
694 asmlinkage void
695 do_notify_resume(struct pt_regs *regs, unsigned int thread_flags, int syscall)
697 if (thread_flags & _TIF_SIGPENDING)
698 do_signal(regs, syscall);
700 if (thread_flags & _TIF_NOTIFY_RESUME) {
701 clear_thread_flag(TIF_NOTIFY_RESUME);
702 tracehook_notify_resume(regs);
703 if (current->replacement_session_keyring)
704 key_replace_session_keyring();