Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 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 | */ |
Ralf Baechle | 02416dc | 2005-06-15 13:00:12 +0000 | [diff] [blame] | 10 | #include <linux/cache.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | #include <linux/sched.h> |
| 12 | #include <linux/mm.h> |
| 13 | #include <linux/personality.h> |
| 14 | #include <linux/smp.h> |
| 15 | #include <linux/smp_lock.h> |
| 16 | #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/compiler.h> |
| 23 | |
Ralf Baechle | e50c0a8 | 2005-05-31 11:49:19 +0000 | [diff] [blame] | 24 | #include <asm/abi.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | #include <asm/asm.h> |
| 26 | #include <linux/bitops.h> |
| 27 | #include <asm/cacheflush.h> |
| 28 | #include <asm/fpu.h> |
| 29 | #include <asm/sim.h> |
| 30 | #include <asm/uaccess.h> |
| 31 | #include <asm/ucontext.h> |
| 32 | #include <asm/cpu-features.h> |
Ralf Baechle | 02416dc | 2005-06-15 13:00:12 +0000 | [diff] [blame] | 33 | #include <asm/war.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
| 35 | #include "signal-common.h" |
| 36 | |
Ralf Baechle | 6668058 | 2007-02-13 01:31:48 +0000 | [diff] [blame] | 37 | /* |
| 38 | * Horribly complicated - with the bloody RM9000 workarounds enabled |
| 39 | * the signal trampolines is moving to the end of the structure so we can |
| 40 | * increase the alignment without breaking software compatibility. |
| 41 | */ |
Franck Bui-Huu | c0b9bae | 2007-02-05 15:24:21 +0100 | [diff] [blame] | 42 | #if ICACHE_REFILLS_WORKAROUND_WAR == 0 |
| 43 | |
Ralf Baechle | 6668058 | 2007-02-13 01:31:48 +0000 | [diff] [blame] | 44 | struct sigframe { |
| 45 | u32 sf_ass[4]; /* argument save space for o32 */ |
| 46 | u32 sf_code[2]; /* signal trampoline */ |
| 47 | struct sigcontext sf_sc; |
| 48 | sigset_t sf_mask; |
| 49 | }; |
| 50 | |
Franck Bui-Huu | c0b9bae | 2007-02-05 15:24:21 +0100 | [diff] [blame] | 51 | struct rt_sigframe { |
| 52 | u32 rs_ass[4]; /* argument save space for o32 */ |
| 53 | u32 rs_code[2]; /* signal trampoline */ |
| 54 | struct siginfo rs_info; |
| 55 | struct ucontext rs_uc; |
| 56 | }; |
| 57 | |
| 58 | #else |
| 59 | |
Ralf Baechle | 6668058 | 2007-02-13 01:31:48 +0000 | [diff] [blame] | 60 | struct sigframe { |
| 61 | u32 sf_ass[4]; /* argument save space for o32 */ |
| 62 | u32 sf_pad[2]; |
| 63 | struct sigcontext sf_sc; /* hw context */ |
| 64 | sigset_t sf_mask; |
| 65 | u32 sf_code[8] ____cacheline_aligned; /* signal trampoline */ |
| 66 | }; |
| 67 | |
Franck Bui-Huu | c0b9bae | 2007-02-05 15:24:21 +0100 | [diff] [blame] | 68 | struct rt_sigframe { |
| 69 | u32 rs_ass[4]; /* argument save space for o32 */ |
| 70 | u32 rs_pad[2]; |
| 71 | struct siginfo rs_info; |
| 72 | struct ucontext rs_uc; |
| 73 | u32 rs_code[8] ____cacheline_aligned; /* signal trampoline */ |
| 74 | }; |
| 75 | |
| 76 | #endif |
| 77 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | /* |
Franck Bui-Huu | c3fc4ab | 2007-02-05 15:24:20 +0100 | [diff] [blame] | 79 | * Helper routines |
| 80 | */ |
| 81 | int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) |
| 82 | { |
| 83 | int err = 0; |
| 84 | int i; |
Atsushi Nemoto | 53dc802 | 2007-03-10 01:07:45 +0900 | [diff] [blame] | 85 | unsigned int used_math; |
Franck Bui-Huu | c3fc4ab | 2007-02-05 15:24:20 +0100 | [diff] [blame] | 86 | |
| 87 | err |= __put_user(regs->cp0_epc, &sc->sc_pc); |
| 88 | |
| 89 | err |= __put_user(0, &sc->sc_regs[0]); |
| 90 | for (i = 1; i < 32; i++) |
| 91 | err |= __put_user(regs->regs[i], &sc->sc_regs[i]); |
| 92 | |
Franck Bui-Huu | 9693a85 | 2007-02-02 17:41:47 +0100 | [diff] [blame] | 93 | #ifdef CONFIG_CPU_HAS_SMARTMIPS |
| 94 | err |= __put_user(regs->acx, &sc->sc_acx); |
| 95 | #endif |
Franck Bui-Huu | c3fc4ab | 2007-02-05 15:24:20 +0100 | [diff] [blame] | 96 | err |= __put_user(regs->hi, &sc->sc_mdhi); |
| 97 | err |= __put_user(regs->lo, &sc->sc_mdlo); |
| 98 | if (cpu_has_dsp) { |
| 99 | err |= __put_user(mfhi1(), &sc->sc_hi1); |
| 100 | err |= __put_user(mflo1(), &sc->sc_lo1); |
| 101 | err |= __put_user(mfhi2(), &sc->sc_hi2); |
| 102 | err |= __put_user(mflo2(), &sc->sc_lo2); |
| 103 | err |= __put_user(mfhi3(), &sc->sc_hi3); |
| 104 | err |= __put_user(mflo3(), &sc->sc_lo3); |
| 105 | err |= __put_user(rddsp(DSP_MASK), &sc->sc_dsp); |
| 106 | } |
| 107 | |
Atsushi Nemoto | 53dc802 | 2007-03-10 01:07:45 +0900 | [diff] [blame] | 108 | used_math = !!used_math(); |
| 109 | err |= __put_user(used_math, &sc->sc_used_math); |
Franck Bui-Huu | c3fc4ab | 2007-02-05 15:24:20 +0100 | [diff] [blame] | 110 | |
Atsushi Nemoto | 53dc802 | 2007-03-10 01:07:45 +0900 | [diff] [blame] | 111 | if (used_math) { |
Franck Bui-Huu | c3fc4ab | 2007-02-05 15:24:20 +0100 | [diff] [blame] | 112 | /* |
| 113 | * Save FPU state to signal context. Signal handler |
| 114 | * will "inherit" current FPU state. |
| 115 | */ |
Atsushi Nemoto | 5323180 | 2007-04-14 02:37:26 +0900 | [diff] [blame^] | 116 | preempt_disable(); |
Atsushi Nemoto | 53dc802 | 2007-03-10 01:07:45 +0900 | [diff] [blame] | 117 | own_fpu(1); |
Franck Bui-Huu | c3fc4ab | 2007-02-05 15:24:20 +0100 | [diff] [blame] | 118 | err |= save_fp_context(sc); |
Atsushi Nemoto | 5323180 | 2007-04-14 02:37:26 +0900 | [diff] [blame^] | 119 | preempt_enable(); |
Franck Bui-Huu | c3fc4ab | 2007-02-05 15:24:20 +0100 | [diff] [blame] | 120 | } |
| 121 | return err; |
| 122 | } |
| 123 | |
Atsushi Nemoto | c6a2f46 | 2007-03-10 01:03:48 +0900 | [diff] [blame] | 124 | int fpcsr_pending(unsigned int __user *fpcsr) |
| 125 | { |
| 126 | int err, sig = 0; |
| 127 | unsigned int csr, enabled; |
| 128 | |
| 129 | err = __get_user(csr, fpcsr); |
| 130 | enabled = FPU_CSR_UNI_X | ((csr & FPU_CSR_ALL_E) << 5); |
| 131 | /* |
| 132 | * If the signal handler set some FPU exceptions, clear it and |
| 133 | * send SIGFPE. |
| 134 | */ |
| 135 | if (csr & enabled) { |
| 136 | csr &= ~enabled; |
| 137 | err |= __put_user(csr, fpcsr); |
| 138 | sig = SIGFPE; |
| 139 | } |
| 140 | return err ?: sig; |
| 141 | } |
| 142 | |
| 143 | static int |
| 144 | check_and_restore_fp_context(struct sigcontext __user *sc) |
| 145 | { |
| 146 | int err, sig; |
| 147 | |
| 148 | err = sig = fpcsr_pending(&sc->sc_fpc_csr); |
| 149 | if (err > 0) |
| 150 | err = 0; |
Atsushi Nemoto | 5323180 | 2007-04-14 02:37:26 +0900 | [diff] [blame^] | 151 | preempt_disable(); |
| 152 | own_fpu(0); |
Atsushi Nemoto | c6a2f46 | 2007-03-10 01:03:48 +0900 | [diff] [blame] | 153 | err |= restore_fp_context(sc); |
Atsushi Nemoto | 5323180 | 2007-04-14 02:37:26 +0900 | [diff] [blame^] | 154 | preempt_enable(); |
Atsushi Nemoto | c6a2f46 | 2007-03-10 01:03:48 +0900 | [diff] [blame] | 155 | return err ?: sig; |
| 156 | } |
| 157 | |
Franck Bui-Huu | c3fc4ab | 2007-02-05 15:24:20 +0100 | [diff] [blame] | 158 | int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) |
| 159 | { |
| 160 | unsigned int used_math; |
| 161 | unsigned long treg; |
| 162 | int err = 0; |
| 163 | int i; |
| 164 | |
| 165 | /* Always make any pending restarted system calls return -EINTR */ |
| 166 | current_thread_info()->restart_block.fn = do_no_restart_syscall; |
| 167 | |
| 168 | err |= __get_user(regs->cp0_epc, &sc->sc_pc); |
Franck Bui-Huu | 9693a85 | 2007-02-02 17:41:47 +0100 | [diff] [blame] | 169 | |
| 170 | #ifdef CONFIG_CPU_HAS_SMARTMIPS |
| 171 | err |= __get_user(regs->acx, &sc->sc_acx); |
| 172 | #endif |
Franck Bui-Huu | c3fc4ab | 2007-02-05 15:24:20 +0100 | [diff] [blame] | 173 | err |= __get_user(regs->hi, &sc->sc_mdhi); |
| 174 | err |= __get_user(regs->lo, &sc->sc_mdlo); |
| 175 | if (cpu_has_dsp) { |
| 176 | err |= __get_user(treg, &sc->sc_hi1); mthi1(treg); |
| 177 | err |= __get_user(treg, &sc->sc_lo1); mtlo1(treg); |
| 178 | err |= __get_user(treg, &sc->sc_hi2); mthi2(treg); |
| 179 | err |= __get_user(treg, &sc->sc_lo2); mtlo2(treg); |
| 180 | err |= __get_user(treg, &sc->sc_hi3); mthi3(treg); |
| 181 | err |= __get_user(treg, &sc->sc_lo3); mtlo3(treg); |
| 182 | err |= __get_user(treg, &sc->sc_dsp); wrdsp(treg, DSP_MASK); |
| 183 | } |
| 184 | |
| 185 | for (i = 1; i < 32; i++) |
| 186 | err |= __get_user(regs->regs[i], &sc->sc_regs[i]); |
| 187 | |
| 188 | err |= __get_user(used_math, &sc->sc_used_math); |
| 189 | conditional_used_math(used_math); |
| 190 | |
Atsushi Nemoto | 53dc802 | 2007-03-10 01:07:45 +0900 | [diff] [blame] | 191 | if (used_math) { |
Franck Bui-Huu | c3fc4ab | 2007-02-05 15:24:20 +0100 | [diff] [blame] | 192 | /* restore fpu context if we have used it before */ |
Atsushi Nemoto | c6a2f46 | 2007-03-10 01:03:48 +0900 | [diff] [blame] | 193 | if (!err) |
| 194 | err = check_and_restore_fp_context(sc); |
Franck Bui-Huu | c3fc4ab | 2007-02-05 15:24:20 +0100 | [diff] [blame] | 195 | } else { |
| 196 | /* signal handler may have used FPU. Give it up. */ |
Atsushi Nemoto | 53dc802 | 2007-03-10 01:07:45 +0900 | [diff] [blame] | 197 | lose_fpu(0); |
Franck Bui-Huu | c3fc4ab | 2007-02-05 15:24:20 +0100 | [diff] [blame] | 198 | } |
| 199 | |
Franck Bui-Huu | c3fc4ab | 2007-02-05 15:24:20 +0100 | [diff] [blame] | 200 | return err; |
| 201 | } |
| 202 | |
| 203 | void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, |
| 204 | size_t frame_size) |
| 205 | { |
| 206 | unsigned long sp; |
| 207 | |
| 208 | /* Default to using normal stack */ |
| 209 | sp = regs->regs[29]; |
| 210 | |
| 211 | /* |
| 212 | * FPU emulator may have it's own trampoline active just |
| 213 | * above the user stack, 16-bytes before the next lowest |
| 214 | * 16 byte boundary. Try to avoid trashing it. |
| 215 | */ |
| 216 | sp -= 32; |
| 217 | |
| 218 | /* This is the X/Open sanctioned signal stack switching. */ |
| 219 | if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0)) |
| 220 | sp = current->sas_ss_sp + current->sas_ss_size; |
| 221 | |
| 222 | return (void __user *)((sp - frame_size) & (ICACHE_REFILLS_WORKAROUND_WAR ? ~(cpu_icache_line_size()-1) : ALMASK)); |
| 223 | } |
| 224 | |
| 225 | int install_sigtramp(unsigned int __user *tramp, unsigned int syscall) |
| 226 | { |
| 227 | int err; |
| 228 | |
| 229 | /* |
| 230 | * Set up the return code ... |
| 231 | * |
| 232 | * li v0, __NR__foo_sigreturn |
| 233 | * syscall |
| 234 | */ |
| 235 | |
| 236 | err = __put_user(0x24020000 + syscall, tramp + 0); |
Franck Bui-Huu | 601dde4 | 2007-02-05 15:24:23 +0100 | [diff] [blame] | 237 | err |= __put_user(0x0000000c , tramp + 1); |
Franck Bui-Huu | c3fc4ab | 2007-02-05 15:24:20 +0100 | [diff] [blame] | 238 | if (ICACHE_REFILLS_WORKAROUND_WAR) { |
| 239 | err |= __put_user(0, tramp + 2); |
| 240 | err |= __put_user(0, tramp + 3); |
| 241 | err |= __put_user(0, tramp + 4); |
| 242 | err |= __put_user(0, tramp + 5); |
| 243 | err |= __put_user(0, tramp + 6); |
| 244 | err |= __put_user(0, tramp + 7); |
| 245 | } |
| 246 | flush_cache_sigtramp((unsigned long) tramp); |
| 247 | |
| 248 | return err; |
| 249 | } |
| 250 | |
| 251 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | * Atomically swap in the new signal mask, and wait for a signal. |
| 253 | */ |
| 254 | |
| 255 | #ifdef CONFIG_TRAD_SIGNALS |
Franck Bui-Huu | f90080a | 2007-02-05 15:24:27 +0100 | [diff] [blame] | 256 | asmlinkage int sys_sigsuspend(nabi_no_regargs struct pt_regs regs) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 | { |
Ralf Baechle | 7b3e2fc | 2006-02-08 12:58:41 +0000 | [diff] [blame] | 258 | sigset_t newset; |
Ralf Baechle | fe00f94 | 2005-03-01 19:22:29 +0000 | [diff] [blame] | 259 | sigset_t __user *uset; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 260 | |
Ralf Baechle | fe00f94 | 2005-03-01 19:22:29 +0000 | [diff] [blame] | 261 | uset = (sigset_t __user *) regs.regs[4]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 262 | if (copy_from_user(&newset, uset, sizeof(sigset_t))) |
| 263 | return -EFAULT; |
| 264 | sigdelsetmask(&newset, ~_BLOCKABLE); |
| 265 | |
| 266 | spin_lock_irq(¤t->sighand->siglock); |
Ralf Baechle | 7b3e2fc | 2006-02-08 12:58:41 +0000 | [diff] [blame] | 267 | current->saved_sigmask = current->blocked; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | current->blocked = newset; |
| 269 | recalc_sigpending(); |
| 270 | spin_unlock_irq(¤t->sighand->siglock); |
| 271 | |
Ralf Baechle | 7b3e2fc | 2006-02-08 12:58:41 +0000 | [diff] [blame] | 272 | current->state = TASK_INTERRUPTIBLE; |
| 273 | schedule(); |
| 274 | set_thread_flag(TIF_RESTORE_SIGMASK); |
| 275 | return -ERESTARTNOHAND; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 276 | } |
| 277 | #endif |
| 278 | |
Franck Bui-Huu | f90080a | 2007-02-05 15:24:27 +0100 | [diff] [blame] | 279 | asmlinkage int sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 280 | { |
Ralf Baechle | 7b3e2fc | 2006-02-08 12:58:41 +0000 | [diff] [blame] | 281 | sigset_t newset; |
Ralf Baechle | fe00f94 | 2005-03-01 19:22:29 +0000 | [diff] [blame] | 282 | sigset_t __user *unewset; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 283 | size_t sigsetsize; |
| 284 | |
| 285 | /* XXX Don't preclude handling different sized sigset_t's. */ |
| 286 | sigsetsize = regs.regs[5]; |
| 287 | if (sigsetsize != sizeof(sigset_t)) |
| 288 | return -EINVAL; |
| 289 | |
Ralf Baechle | fe00f94 | 2005-03-01 19:22:29 +0000 | [diff] [blame] | 290 | unewset = (sigset_t __user *) regs.regs[4]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 291 | if (copy_from_user(&newset, unewset, sizeof(newset))) |
| 292 | return -EFAULT; |
| 293 | sigdelsetmask(&newset, ~_BLOCKABLE); |
| 294 | |
| 295 | spin_lock_irq(¤t->sighand->siglock); |
Ralf Baechle | 7b3e2fc | 2006-02-08 12:58:41 +0000 | [diff] [blame] | 296 | current->saved_sigmask = current->blocked; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 297 | current->blocked = newset; |
Ralf Baechle | e0daad4 | 2007-02-05 00:10:11 +0000 | [diff] [blame] | 298 | recalc_sigpending(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | spin_unlock_irq(¤t->sighand->siglock); |
| 300 | |
Ralf Baechle | 7b3e2fc | 2006-02-08 12:58:41 +0000 | [diff] [blame] | 301 | current->state = TASK_INTERRUPTIBLE; |
| 302 | schedule(); |
| 303 | set_thread_flag(TIF_RESTORE_SIGMASK); |
| 304 | return -ERESTARTNOHAND; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | } |
| 306 | |
| 307 | #ifdef CONFIG_TRAD_SIGNALS |
Atsushi Nemoto | 9c6031c | 2006-02-19 23:46:44 +0900 | [diff] [blame] | 308 | asmlinkage int sys_sigaction(int sig, const struct sigaction __user *act, |
| 309 | struct sigaction __user *oact) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 310 | { |
| 311 | struct k_sigaction new_ka, old_ka; |
| 312 | int ret; |
| 313 | int err = 0; |
| 314 | |
| 315 | if (act) { |
| 316 | old_sigset_t mask; |
| 317 | |
| 318 | if (!access_ok(VERIFY_READ, act, sizeof(*act))) |
| 319 | return -EFAULT; |
| 320 | err |= __get_user(new_ka.sa.sa_handler, &act->sa_handler); |
| 321 | err |= __get_user(new_ka.sa.sa_flags, &act->sa_flags); |
| 322 | err |= __get_user(mask, &act->sa_mask.sig[0]); |
| 323 | if (err) |
| 324 | return -EFAULT; |
| 325 | |
| 326 | siginitset(&new_ka.sa.sa_mask, mask); |
| 327 | } |
| 328 | |
| 329 | ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); |
| 330 | |
| 331 | if (!ret && oact) { |
| 332 | if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact))) |
Ralf Baechle | e0daad4 | 2007-02-05 00:10:11 +0000 | [diff] [blame] | 333 | return -EFAULT; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | err |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags); |
| 335 | err |= __put_user(old_ka.sa.sa_handler, &oact->sa_handler); |
| 336 | err |= __put_user(old_ka.sa.sa_mask.sig[0], oact->sa_mask.sig); |
| 337 | err |= __put_user(0, &oact->sa_mask.sig[1]); |
| 338 | err |= __put_user(0, &oact->sa_mask.sig[2]); |
| 339 | err |= __put_user(0, &oact->sa_mask.sig[3]); |
| 340 | if (err) |
| 341 | return -EFAULT; |
| 342 | } |
| 343 | |
| 344 | return ret; |
| 345 | } |
| 346 | #endif |
| 347 | |
| 348 | asmlinkage int sys_sigaltstack(nabi_no_regargs struct pt_regs regs) |
| 349 | { |
Ralf Baechle | fe00f94 | 2005-03-01 19:22:29 +0000 | [diff] [blame] | 350 | const stack_t __user *uss = (const stack_t __user *) regs.regs[4]; |
| 351 | stack_t __user *uoss = (stack_t __user *) regs.regs[5]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 352 | unsigned long usp = regs.regs[29]; |
| 353 | |
| 354 | return do_sigaltstack(uss, uoss, usp); |
| 355 | } |
| 356 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 357 | #ifdef CONFIG_TRAD_SIGNALS |
Franck Bui-Huu | f90080a | 2007-02-05 15:24:27 +0100 | [diff] [blame] | 358 | asmlinkage void sys_sigreturn(nabi_no_regargs struct pt_regs regs) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 359 | { |
Atsushi Nemoto | 9bbf28a3 | 2006-02-01 01:41:09 +0900 | [diff] [blame] | 360 | struct sigframe __user *frame; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 361 | sigset_t blocked; |
Atsushi Nemoto | c6a2f46 | 2007-03-10 01:03:48 +0900 | [diff] [blame] | 362 | int sig; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 363 | |
Atsushi Nemoto | 9bbf28a3 | 2006-02-01 01:41:09 +0900 | [diff] [blame] | 364 | frame = (struct sigframe __user *) regs.regs[29]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 365 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) |
| 366 | goto badframe; |
| 367 | if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked))) |
| 368 | goto badframe; |
| 369 | |
| 370 | sigdelsetmask(&blocked, ~_BLOCKABLE); |
| 371 | spin_lock_irq(¤t->sighand->siglock); |
| 372 | current->blocked = blocked; |
| 373 | recalc_sigpending(); |
| 374 | spin_unlock_irq(¤t->sighand->siglock); |
| 375 | |
Atsushi Nemoto | c6a2f46 | 2007-03-10 01:03:48 +0900 | [diff] [blame] | 376 | sig = restore_sigcontext(®s, &frame->sf_sc); |
| 377 | if (sig < 0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 378 | goto badframe; |
Atsushi Nemoto | c6a2f46 | 2007-03-10 01:03:48 +0900 | [diff] [blame] | 379 | else if (sig) |
| 380 | force_sig(sig, current); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 381 | |
| 382 | /* |
| 383 | * Don't let your children do this ... |
| 384 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 385 | __asm__ __volatile__( |
| 386 | "move\t$29, %0\n\t" |
| 387 | "j\tsyscall_exit" |
| 388 | :/* no outputs */ |
| 389 | :"r" (®s)); |
| 390 | /* Unreached */ |
| 391 | |
| 392 | badframe: |
| 393 | force_sig(SIGSEGV, current); |
| 394 | } |
Ralf Baechle | e50c0a8 | 2005-05-31 11:49:19 +0000 | [diff] [blame] | 395 | #endif /* CONFIG_TRAD_SIGNALS */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 396 | |
Franck Bui-Huu | f90080a | 2007-02-05 15:24:27 +0100 | [diff] [blame] | 397 | asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 398 | { |
Atsushi Nemoto | 9bbf28a3 | 2006-02-01 01:41:09 +0900 | [diff] [blame] | 399 | struct rt_sigframe __user *frame; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 400 | sigset_t set; |
| 401 | stack_t st; |
Atsushi Nemoto | c6a2f46 | 2007-03-10 01:03:48 +0900 | [diff] [blame] | 402 | int sig; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 403 | |
Atsushi Nemoto | 9bbf28a3 | 2006-02-01 01:41:09 +0900 | [diff] [blame] | 404 | frame = (struct rt_sigframe __user *) regs.regs[29]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 405 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) |
| 406 | goto badframe; |
| 407 | if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set))) |
| 408 | goto badframe; |
| 409 | |
| 410 | sigdelsetmask(&set, ~_BLOCKABLE); |
| 411 | spin_lock_irq(¤t->sighand->siglock); |
| 412 | current->blocked = set; |
| 413 | recalc_sigpending(); |
| 414 | spin_unlock_irq(¤t->sighand->siglock); |
| 415 | |
Atsushi Nemoto | c6a2f46 | 2007-03-10 01:03:48 +0900 | [diff] [blame] | 416 | sig = restore_sigcontext(®s, &frame->rs_uc.uc_mcontext); |
| 417 | if (sig < 0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 418 | goto badframe; |
Atsushi Nemoto | c6a2f46 | 2007-03-10 01:03:48 +0900 | [diff] [blame] | 419 | else if (sig) |
| 420 | force_sig(sig, current); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 421 | |
| 422 | if (__copy_from_user(&st, &frame->rs_uc.uc_stack, sizeof(st))) |
| 423 | goto badframe; |
| 424 | /* It is more difficult to avoid calling this function than to |
| 425 | call it and ignore errors. */ |
Atsushi Nemoto | 9bbf28a3 | 2006-02-01 01:41:09 +0900 | [diff] [blame] | 426 | do_sigaltstack((stack_t __user *)&st, NULL, regs.regs[29]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 427 | |
| 428 | /* |
| 429 | * Don't let your children do this ... |
| 430 | */ |
| 431 | __asm__ __volatile__( |
| 432 | "move\t$29, %0\n\t" |
| 433 | "j\tsyscall_exit" |
| 434 | :/* no outputs */ |
| 435 | :"r" (®s)); |
| 436 | /* Unreached */ |
| 437 | |
| 438 | badframe: |
| 439 | force_sig(SIGSEGV, current); |
| 440 | } |
| 441 | |
| 442 | #ifdef CONFIG_TRAD_SIGNALS |
Ralf Baechle | 151fd6a | 2007-02-15 11:40:37 +0000 | [diff] [blame] | 443 | static int setup_frame(struct k_sigaction * ka, struct pt_regs *regs, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 444 | int signr, sigset_t *set) |
| 445 | { |
Atsushi Nemoto | 9bbf28a3 | 2006-02-01 01:41:09 +0900 | [diff] [blame] | 446 | struct sigframe __user *frame; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 447 | int err = 0; |
| 448 | |
| 449 | frame = get_sigframe(ka, regs, sizeof(*frame)); |
| 450 | if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame))) |
| 451 | goto give_sigsegv; |
| 452 | |
Franck Bui-Huu | 601dde4 | 2007-02-05 15:24:23 +0100 | [diff] [blame] | 453 | err |= install_sigtramp(frame->sf_code, __NR_sigreturn); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 454 | |
| 455 | err |= setup_sigcontext(regs, &frame->sf_sc); |
| 456 | err |= __copy_to_user(&frame->sf_mask, set, sizeof(*set)); |
| 457 | if (err) |
| 458 | goto give_sigsegv; |
| 459 | |
| 460 | /* |
| 461 | * Arguments to signal handler: |
| 462 | * |
| 463 | * a0 = signal number |
| 464 | * a1 = 0 (should be cause) |
| 465 | * a2 = pointer to struct sigcontext |
| 466 | * |
| 467 | * $25 and c0_epc point to the signal handler, $29 points to the |
| 468 | * struct sigframe. |
| 469 | */ |
| 470 | regs->regs[ 4] = signr; |
| 471 | regs->regs[ 5] = 0; |
| 472 | regs->regs[ 6] = (unsigned long) &frame->sf_sc; |
| 473 | regs->regs[29] = (unsigned long) frame; |
| 474 | regs->regs[31] = (unsigned long) frame->sf_code; |
| 475 | regs->cp0_epc = regs->regs[25] = (unsigned long) ka->sa.sa_handler; |
| 476 | |
Franck Bui-Huu | 722bb63 | 2007-02-05 15:24:24 +0100 | [diff] [blame] | 477 | DEBUGP("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%lx\n", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 478 | current->comm, current->pid, |
Franck Bui-Huu | 722bb63 | 2007-02-05 15:24:24 +0100 | [diff] [blame] | 479 | frame, regs->cp0_epc, regs->regs[31]); |
Ralf Baechle | e0daad4 | 2007-02-05 00:10:11 +0000 | [diff] [blame] | 480 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 481 | |
| 482 | give_sigsegv: |
| 483 | force_sigsegv(signr, current); |
Ralf Baechle | 7b3e2fc | 2006-02-08 12:58:41 +0000 | [diff] [blame] | 484 | return -EFAULT; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 485 | } |
| 486 | #endif |
| 487 | |
Ralf Baechle | 151fd6a | 2007-02-15 11:40:37 +0000 | [diff] [blame] | 488 | static int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 489 | int signr, sigset_t *set, siginfo_t *info) |
| 490 | { |
Atsushi Nemoto | 9bbf28a3 | 2006-02-01 01:41:09 +0900 | [diff] [blame] | 491 | struct rt_sigframe __user *frame; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 492 | int err = 0; |
| 493 | |
| 494 | frame = get_sigframe(ka, regs, sizeof(*frame)); |
| 495 | if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame))) |
| 496 | goto give_sigsegv; |
| 497 | |
Franck Bui-Huu | 601dde4 | 2007-02-05 15:24:23 +0100 | [diff] [blame] | 498 | err |= install_sigtramp(frame->rs_code, __NR_rt_sigreturn); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 499 | |
| 500 | /* Create siginfo. */ |
| 501 | err |= copy_siginfo_to_user(&frame->rs_info, info); |
| 502 | |
| 503 | /* Create the ucontext. */ |
| 504 | err |= __put_user(0, &frame->rs_uc.uc_flags); |
Atsushi Nemoto | 5665a0a | 2006-02-02 01:26:34 +0900 | [diff] [blame] | 505 | err |= __put_user(NULL, &frame->rs_uc.uc_link); |
Atsushi Nemoto | 9c6031c | 2006-02-19 23:46:44 +0900 | [diff] [blame] | 506 | err |= __put_user((void __user *)current->sas_ss_sp, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 507 | &frame->rs_uc.uc_stack.ss_sp); |
| 508 | err |= __put_user(sas_ss_flags(regs->regs[29]), |
| 509 | &frame->rs_uc.uc_stack.ss_flags); |
| 510 | err |= __put_user(current->sas_ss_size, |
| 511 | &frame->rs_uc.uc_stack.ss_size); |
| 512 | err |= setup_sigcontext(regs, &frame->rs_uc.uc_mcontext); |
| 513 | err |= __copy_to_user(&frame->rs_uc.uc_sigmask, set, sizeof(*set)); |
| 514 | |
| 515 | if (err) |
| 516 | goto give_sigsegv; |
| 517 | |
| 518 | /* |
| 519 | * Arguments to signal handler: |
| 520 | * |
| 521 | * a0 = signal number |
| 522 | * a1 = 0 (should be cause) |
| 523 | * a2 = pointer to ucontext |
| 524 | * |
| 525 | * $25 and c0_epc point to the signal handler, $29 points to |
| 526 | * the struct rt_sigframe. |
| 527 | */ |
| 528 | regs->regs[ 4] = signr; |
| 529 | regs->regs[ 5] = (unsigned long) &frame->rs_info; |
| 530 | regs->regs[ 6] = (unsigned long) &frame->rs_uc; |
| 531 | regs->regs[29] = (unsigned long) frame; |
| 532 | regs->regs[31] = (unsigned long) frame->rs_code; |
| 533 | regs->cp0_epc = regs->regs[25] = (unsigned long) ka->sa.sa_handler; |
| 534 | |
Franck Bui-Huu | 722bb63 | 2007-02-05 15:24:24 +0100 | [diff] [blame] | 535 | DEBUGP("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%lx\n", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 536 | current->comm, current->pid, |
| 537 | frame, regs->cp0_epc, regs->regs[31]); |
Franck Bui-Huu | 722bb63 | 2007-02-05 15:24:24 +0100 | [diff] [blame] | 538 | |
Ralf Baechle | 7b3e2fc | 2006-02-08 12:58:41 +0000 | [diff] [blame] | 539 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 540 | |
| 541 | give_sigsegv: |
| 542 | force_sigsegv(signr, current); |
Ralf Baechle | 7b3e2fc | 2006-02-08 12:58:41 +0000 | [diff] [blame] | 543 | return -EFAULT; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 544 | } |
| 545 | |
Ralf Baechle | 151fd6a | 2007-02-15 11:40:37 +0000 | [diff] [blame] | 546 | struct mips_abi mips_abi = { |
| 547 | #ifdef CONFIG_TRAD_SIGNALS |
| 548 | .setup_frame = setup_frame, |
| 549 | #endif |
| 550 | .setup_rt_frame = setup_rt_frame, |
| 551 | .restart = __NR_restart_syscall |
| 552 | }; |
| 553 | |
Franck Bui-Huu | e692eb3 | 2007-02-05 15:24:28 +0100 | [diff] [blame] | 554 | static int handle_signal(unsigned long sig, siginfo_t *info, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 555 | struct k_sigaction *ka, sigset_t *oldset, struct pt_regs *regs) |
| 556 | { |
Ralf Baechle | 129bc8f | 2005-07-11 20:45:51 +0000 | [diff] [blame] | 557 | int ret; |
| 558 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 559 | switch(regs->regs[0]) { |
| 560 | case ERESTART_RESTARTBLOCK: |
| 561 | case ERESTARTNOHAND: |
| 562 | regs->regs[2] = EINTR; |
| 563 | break; |
| 564 | case ERESTARTSYS: |
Ralf Baechle | 7b3e2fc | 2006-02-08 12:58:41 +0000 | [diff] [blame] | 565 | if (!(ka->sa.sa_flags & SA_RESTART)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 566 | regs->regs[2] = EINTR; |
| 567 | break; |
| 568 | } |
| 569 | /* fallthrough */ |
| 570 | case ERESTARTNOINTR: /* Userland will reload $v0. */ |
| 571 | regs->regs[7] = regs->regs[26]; |
| 572 | regs->cp0_epc -= 8; |
| 573 | } |
| 574 | |
| 575 | regs->regs[0] = 0; /* Don't deal with this again. */ |
| 576 | |
Ralf Baechle | e50c0a8 | 2005-05-31 11:49:19 +0000 | [diff] [blame] | 577 | if (sig_uses_siginfo(ka)) |
Ralf Baechle | 129bc8f | 2005-07-11 20:45:51 +0000 | [diff] [blame] | 578 | ret = current->thread.abi->setup_rt_frame(ka, regs, sig, oldset, info); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 579 | else |
Ralf Baechle | 129bc8f | 2005-07-11 20:45:51 +0000 | [diff] [blame] | 580 | ret = current->thread.abi->setup_frame(ka, regs, sig, oldset); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 581 | |
Steven Rostedt | 69be8f1 | 2005-08-29 11:44:09 -0400 | [diff] [blame] | 582 | spin_lock_irq(¤t->sighand->siglock); |
| 583 | sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); |
| 584 | if (!(ka->sa.sa_flags & SA_NODEFER)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 585 | sigaddset(¤t->blocked,sig); |
Steven Rostedt | 69be8f1 | 2005-08-29 11:44:09 -0400 | [diff] [blame] | 586 | recalc_sigpending(); |
| 587 | spin_unlock_irq(¤t->sighand->siglock); |
Ralf Baechle | 129bc8f | 2005-07-11 20:45:51 +0000 | [diff] [blame] | 588 | |
| 589 | return ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 590 | } |
| 591 | |
Ralf Baechle | 151fd6a | 2007-02-15 11:40:37 +0000 | [diff] [blame] | 592 | static void do_signal(struct pt_regs *regs) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 593 | { |
| 594 | struct k_sigaction ka; |
Ralf Baechle | 7b3e2fc | 2006-02-08 12:58:41 +0000 | [diff] [blame] | 595 | sigset_t *oldset; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 596 | siginfo_t info; |
| 597 | int signr; |
| 598 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 599 | /* |
| 600 | * We want the common case to go fast, which is why we may in certain |
| 601 | * cases get here from kernel mode. Just return without doing anything |
| 602 | * if so. |
| 603 | */ |
| 604 | if (!user_mode(regs)) |
Ralf Baechle | 40ac5d4 | 2006-02-08 13:38:18 +0000 | [diff] [blame] | 605 | return; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 606 | |
Ralf Baechle | 7b3e2fc | 2006-02-08 12:58:41 +0000 | [diff] [blame] | 607 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) |
| 608 | oldset = ¤t->saved_sigmask; |
| 609 | else |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 610 | oldset = ¤t->blocked; |
| 611 | |
| 612 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
Ralf Baechle | 7b3e2fc | 2006-02-08 12:58:41 +0000 | [diff] [blame] | 613 | if (signr > 0) { |
| 614 | /* Whee! Actually deliver the signal. */ |
| 615 | if (handle_signal(signr, &info, &ka, oldset, regs) == 0) { |
| 616 | /* |
| 617 | * A signal was successfully delivered; the saved |
| 618 | * sigmask will have been stored in the signal frame, |
| 619 | * and will be restored by sigreturn, so we can simply |
| 620 | * clear the TIF_RESTORE_SIGMASK flag. |
| 621 | */ |
| 622 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) |
| 623 | clear_thread_flag(TIF_RESTORE_SIGMASK); |
| 624 | } |
Ralf Baechle | 45887e1 | 2006-08-03 21:54:13 +0100 | [diff] [blame] | 625 | |
| 626 | return; |
Ralf Baechle | 7b3e2fc | 2006-02-08 12:58:41 +0000 | [diff] [blame] | 627 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 628 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 629 | /* |
| 630 | * Who's code doesn't conform to the restartable syscall convention |
| 631 | * dies here!!! The li instruction, a single machine instruction, |
| 632 | * must directly be followed by the syscall instruction. |
| 633 | */ |
| 634 | if (regs->regs[0]) { |
| 635 | if (regs->regs[2] == ERESTARTNOHAND || |
| 636 | regs->regs[2] == ERESTARTSYS || |
| 637 | regs->regs[2] == ERESTARTNOINTR) { |
| 638 | regs->regs[7] = regs->regs[26]; |
| 639 | regs->cp0_epc -= 8; |
| 640 | } |
| 641 | if (regs->regs[2] == ERESTART_RESTARTBLOCK) { |
Ralf Baechle | 151fd6a | 2007-02-15 11:40:37 +0000 | [diff] [blame] | 642 | regs->regs[2] = current->thread.abi->restart; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 643 | regs->regs[7] = regs->regs[26]; |
| 644 | regs->cp0_epc -= 4; |
| 645 | } |
Ralf Baechle | 13fdd31 | 2006-08-08 03:47:01 +0100 | [diff] [blame] | 646 | regs->regs[0] = 0; /* Don't deal with this again. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 647 | } |
Ralf Baechle | 7b3e2fc | 2006-02-08 12:58:41 +0000 | [diff] [blame] | 648 | |
| 649 | /* |
| 650 | * If there's no signal to deliver, we just put the saved sigmask |
| 651 | * back |
| 652 | */ |
| 653 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) { |
| 654 | clear_thread_flag(TIF_RESTORE_SIGMASK); |
| 655 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); |
| 656 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 657 | } |
| 658 | |
| 659 | /* |
| 660 | * notification of userspace execution resumption |
Ralf Baechle | 7b3e2fc | 2006-02-08 12:58:41 +0000 | [diff] [blame] | 661 | * - triggered by the TIF_WORK_MASK flags |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 662 | */ |
Ralf Baechle | 7b3e2fc | 2006-02-08 12:58:41 +0000 | [diff] [blame] | 663 | asmlinkage void do_notify_resume(struct pt_regs *regs, void *unused, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 664 | __u32 thread_info_flags) |
| 665 | { |
| 666 | /* deal with pending signal delivery */ |
Ralf Baechle | 7b3e2fc | 2006-02-08 12:58:41 +0000 | [diff] [blame] | 667 | if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)) |
Ralf Baechle | 151fd6a | 2007-02-15 11:40:37 +0000 | [diff] [blame] | 668 | do_signal(regs); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 669 | } |