~ubuntu-branches/ubuntu/saucy/linux-ti-omap4/saucy-proposed

« back to all changes in this revision

Viewing changes to arch/blackfin/kernel/signal.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati, Stefan Bader, Upstream Kernel Changes
  • Date: 2012-08-15 17:17:43 UTC
  • Revision ID: package-import@ubuntu.com-20120815171743-h5wnuf51xe7pvdid
Tags: 3.5.0-207.13
[ Paolo Pisati ]

* Start new release

[ Stefan Bader ]

* (config) Enable getabis to use local package copies

[ Upstream Kernel Changes ]

* fixup: gargabe collect iva_seq[0|1] init
* [Config] enable all SND_OMAP_SOC_*s
* fixup: cm2xxx_3xxx.o is needed for omap2_cm_read|write_reg
* fixup: add some snd_soc_dai* helper functions
* fixup: s/snd_soc_dpcm_params/snd_soc_dpcm/g
* fixup: typo, no_host_mode and useless SDP4430 init
* fixup: enable again aess hwmod

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#include <asm/fixed_code.h>
20
20
#include <asm/syscall.h>
21
21
 
22
 
#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
23
 
 
24
22
/* Location of the trace bit in SYSCFG. */
25
23
#define TRACE_BITS 0x0001
26
24
 
98
96
        if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
99
97
                goto badframe;
100
98
 
101
 
        sigdelsetmask(&set, ~_BLOCKABLE);
102
 
        spin_lock_irq(&current->sighand->siglock);
103
 
        current->blocked = set;
104
 
        recalc_sigpending();
105
 
        spin_unlock_irq(&current->sighand->siglock);
 
99
        set_current_blocked(&set);
106
100
 
107
101
        if (rt_restore_sigcontext(regs, &frame->uc.uc_mcontext, &r0))
108
102
                goto badframe;
193
187
        err |= copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
194
188
 
195
189
        if (err)
196
 
                goto give_sigsegv;
 
190
                return -EFAULT;
197
191
 
198
192
        /* Set up registers for signal handler */
199
 
        wrusp((unsigned long)frame);
200
193
        if (current->personality & FDPIC_FUNCPTRS) {
201
194
                struct fdpic_func_descriptor __user *funcptr =
202
195
                        (struct fdpic_func_descriptor *) ka->sa.sa_handler;
203
 
                __get_user(regs->pc, &funcptr->text);
204
 
                __get_user(regs->p3, &funcptr->GOT);
 
196
                u32 pc, p3;
 
197
                err |= __get_user(pc, &funcptr->text);
 
198
                err |= __get_user(p3, &funcptr->GOT);
 
199
                if (err)
 
200
                        return -EFAULT;
 
201
                regs->pc = pc;
 
202
                regs->p3 = p3;
205
203
        } else
206
204
                regs->pc = (unsigned long)ka->sa.sa_handler;
 
205
        wrusp((unsigned long)frame);
207
206
        regs->rets = SIGRETURN_STUB;
208
207
 
209
208
        regs->r0 = frame->sig;
211
210
        regs->r2 = (unsigned long)(&frame->uc);
212
211
 
213
212
        return 0;
214
 
 
215
 
 give_sigsegv:
216
 
        if (sig == SIGSEGV)
217
 
                ka->sa.sa_handler = SIG_DFL;
218
 
        force_sig(SIGSEGV, current);
219
 
        return -EFAULT;
220
213
}
221
214
 
222
215
static inline void
252
245
/*
253
246
 * OK, we're invoking a handler
254
247
 */
255
 
static int
 
248
static void
256
249
handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka,
257
 
              sigset_t *oldset, struct pt_regs *regs)
 
250
              struct pt_regs *regs)
258
251
{
259
 
        int ret;
260
 
 
261
252
        /* are we from a system call? to see pt_regs->orig_p0 */
262
253
        if (regs->orig_p0 >= 0)
263
254
                /* If so, check system call restarting.. */
264
255
                handle_restart(regs, ka, 1);
265
256
 
266
257
        /* set up the stack frame */
267
 
        ret = setup_rt_frame(sig, ka, info, oldset, regs);
268
 
 
269
 
        if (ret == 0) {
270
 
                spin_lock_irq(&current->sighand->siglock);
271
 
                sigorsets(&current->blocked, &current->blocked,
272
 
                          &ka->sa.sa_mask);
273
 
                if (!(ka->sa.sa_flags & SA_NODEFER))
274
 
                        sigaddset(&current->blocked, sig);
275
 
                recalc_sigpending();
276
 
                spin_unlock_irq(&current->sighand->siglock);
277
 
        }
278
 
        return ret;
 
258
        if (setup_rt_frame(sig, ka, info, sigmask_to_save(), regs) < 0)
 
259
                force_sigsegv(sig, current);
 
260
        else 
 
261
                signal_delivered(sig, info, ka, regs,
 
262
                                test_thread_flag(TIF_SINGLESTEP));
279
263
}
280
264
 
281
265
/*
292
276
        siginfo_t info;
293
277
        int signr;
294
278
        struct k_sigaction ka;
295
 
        sigset_t *oldset;
296
279
 
297
280
        current->thread.esp0 = (unsigned long)regs;
298
281
 
299
 
        if (try_to_freeze())
300
 
                goto no_signal;
301
 
 
302
 
        if (test_thread_flag(TIF_RESTORE_SIGMASK))
303
 
                oldset = &current->saved_sigmask;
304
 
        else
305
 
                oldset = &current->blocked;
306
 
 
307
282
        signr = get_signal_to_deliver(&info, &ka, regs, NULL);
308
283
        if (signr > 0) {
309
284
                /* Whee!  Actually deliver the signal.  */
310
 
                if (handle_signal(signr, &info, &ka, oldset, regs) == 0) {
311
 
                        /* a signal was successfully delivered; the saved
312
 
                         * sigmask will have been stored in the signal frame,
313
 
                         * and will be restored by sigreturn, so we can simply
314
 
                         * clear the TIF_RESTORE_SIGMASK flag */
315
 
                        if (test_thread_flag(TIF_RESTORE_SIGMASK))
316
 
                                clear_thread_flag(TIF_RESTORE_SIGMASK);
317
 
 
318
 
                        tracehook_signal_handler(signr, &info, &ka, regs,
319
 
                                test_thread_flag(TIF_SINGLESTEP));
320
 
                }
321
 
 
 
285
                handle_signal(signr, &info, &ka, regs);
322
286
                return;
323
287
        }
324
288
 
325
 
 no_signal:
326
289
        /* Did we come from a system call? */
327
290
        if (regs->orig_p0 >= 0)
328
291
                /* Restart the system call - no handlers present */
330
293
 
331
294
        /* if there's no signal to deliver, we just put the saved sigmask
332
295
         * back */
333
 
        if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
334
 
                clear_thread_flag(TIF_RESTORE_SIGMASK);
335
 
                sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
336
 
        }
 
296
        restore_saved_sigmask();
337
297
}
338
298
 
339
299
/*
341
301
 */
342
302
asmlinkage void do_notify_resume(struct pt_regs *regs)
343
303
{
344
 
        if (test_thread_flag(TIF_SIGPENDING) || test_thread_flag(TIF_RESTORE_SIGMASK))
 
304
        if (test_thread_flag(TIF_SIGPENDING))
345
305
                do_signal(regs);
346
306
 
347
307
        if (test_thread_flag(TIF_NOTIFY_RESUME)) {
348
308
                clear_thread_flag(TIF_NOTIFY_RESUME);
349
309
                tracehook_notify_resume(regs);
350
 
                if (current->replacement_session_keyring)
351
 
                        key_replace_session_keyring();
352
310
        }
353
311
}
354
312