12 #include <linux/sched.h>
14 #include <linux/personality.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>
22 #include <linux/compiler.h>
29 #include <linux/bitops.h>
30 #include <asm/cacheflush.h>
33 #include <asm/ucontext.h>
34 #include <asm/cpu-features.h>
67 static int protected_save_fp_context(
struct sigcontext __user *
sc)
73 err = save_fp_context(sc);
87 static int protected_restore_fp_context(
struct sigcontext __user *sc)
93 err = restore_fp_context(sc);
116 for (i = 1; i < 32; i++)
119 #ifdef CONFIG_CPU_HAS_SMARTMIPS
135 err |=
__put_user(used_math, &sc->sc_used_math);
142 err |= protected_save_fp_context(sc);
167 check_and_restore_fp_context(
struct sigcontext __user *sc)
174 err |= protected_restore_fp_context(sc);
190 #ifdef CONFIG_CPU_HAS_SMARTMIPS
205 for (i = 1; i < 32; i++)
208 err |=
__get_user(used_math, &sc->sc_used_math);
214 err = check_and_restore_fp_context(sc);
239 if ((ka->
sa.sa_flags &
SA_ONSTACK) && (sas_ss_flags (sp) == 0))
249 #ifdef CONFIG_TRAD_SIGNALS
269 sigsetsize = regs.regs[5];
279 #ifdef CONFIG_TRAD_SIGNALS
292 err |=
__get_user(new_ka.sa.sa_handler, &act->sa_handler);
293 err |=
__get_user(new_ka.sa.sa_flags, &act->sa_flags);
294 err |=
__get_user(mask, &act->sa_mask.sig[0]);
298 siginitset(&new_ka.sa.sa_mask, mask);
306 err |=
__put_user(old_ka.sa.sa_flags, &oact->sa_flags);
307 err |=
__put_user(old_ka.sa.sa_handler, &oact->sa_handler);
308 err |=
__put_user(old_ka.sa.sa_mask.sig[0], oact->sa_mask.sig);
322 const stack_t __user *uss = (
const stack_t __user *) regs.regs[4];
324 unsigned long usp = regs.regs[29];
329 #ifdef CONFIG_TRAD_SIGNALS
336 frame = (
struct sigframe __user *) regs.regs[29];
371 frame = (
struct rt_sigframe __user *) regs.regs[29];
403 #ifdef CONFIG_TRAD_SIGNALS
404 static int setup_frame(
void *sig_return,
struct k_sigaction *ka,
429 regs->
regs[ 4] = signr;
433 regs->
regs[31] = (
unsigned long) sig_return;
436 DEBUGP(
"SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%lx\n",
447 static int setup_rt_frame(
void *sig_return,
struct k_sigaction *ka,
465 &frame->
rs_uc.uc_stack.ss_sp);
467 &frame->
rs_uc.uc_stack.ss_flags);
469 &frame->
rs_uc.uc_stack.ss_size);
486 regs->
regs[ 4] = signr;
488 regs->
regs[ 6] = (
unsigned long) &frame->
rs_uc;
489 regs->
regs[29] = (
unsigned long) frame;
490 regs->
regs[31] = (
unsigned long) sig_return;
493 DEBUGP(
"SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%lx\n",
505 #ifdef CONFIG_TRAD_SIGNALS
510 .rt_signal_return_offset =
515 static void handle_signal(
unsigned long sig,
siginfo_t *info,
518 sigset_t *oldset = sigmask_to_save();
520 struct mips_abi *abi =
current->thread.abi;
521 void *vdso =
current->mm->context.vdso;
524 switch(regs->
regs[2]) {
546 ka, regs, sig, oldset, info);
549 ka, regs, sig, oldset);
566 handle_signal(signr, &info, &ka, regs);
590 restore_saved_sigmask();
598 __u32 thread_info_flags)
608 tracehook_notify_resume(regs);
613 static int smp_save_fp_context(
struct sigcontext __user *sc)
620 static int smp_restore_fp_context(
struct sigcontext __user *sc)
628 static int signal_setup(
void)
632 save_fp_context = smp_save_fp_context;
633 restore_fp_context = smp_restore_fp_context;