Commit d809709a authored by Richard Weinberger's avatar Richard Weinberger Committed by Richard Weinberger

avr32: Use get_signal() signal_setup_done()

Use the more generic functions get_signal() signal_setup_done()
for signal delivery.
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
Acked-by: default avatarHans-Christian Egtvedt <egtvedt@samfundet.no>
parent 00554fa4
...@@ -138,13 +138,12 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, int framesize) ...@@ -138,13 +138,12 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, int framesize)
} }
static int static int
setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs)
sigset_t *set, struct pt_regs *regs)
{ {
struct rt_sigframe __user *frame; struct rt_sigframe __user *frame;
int err = 0; int err = 0;
frame = get_sigframe(ka, regs, sizeof(*frame)); frame = get_sigframe(&ksig->ka, regs, sizeof(*frame));
err = -EFAULT; err = -EFAULT;
if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame))) if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
goto out; goto out;
...@@ -164,7 +163,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -164,7 +163,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
err = __put_user(0x3008d733 | (__NR_rt_sigreturn << 20), err = __put_user(0x3008d733 | (__NR_rt_sigreturn << 20),
&frame->retcode); &frame->retcode);
err |= copy_siginfo_to_user(&frame->info, info); err |= copy_siginfo_to_user(&frame->info, &ksig->info);
/* Set up the ucontext */ /* Set up the ucontext */
err |= __put_user(0, &frame->uc.uc_flags); err |= __put_user(0, &frame->uc.uc_flags);
...@@ -176,12 +175,12 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -176,12 +175,12 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
if (err) if (err)
goto out; goto out;
regs->r12 = sig; regs->r12 = ksig->sig;
regs->r11 = (unsigned long) &frame->info; regs->r11 = (unsigned long) &frame->info;
regs->r10 = (unsigned long) &frame->uc; regs->r10 = (unsigned long) &frame->uc;
regs->sp = (unsigned long) frame; regs->sp = (unsigned long) frame;
if (ka->sa.sa_flags & SA_RESTORER) if (ksig->ka.sa.sa_flags & SA_RESTORER)
regs->lr = (unsigned long)ka->sa.sa_restorer; regs->lr = (unsigned long)ksig->ka.sa.sa_restorer;
else { else {
printk(KERN_NOTICE "[%s:%d] did not set SA_RESTORER\n", printk(KERN_NOTICE "[%s:%d] did not set SA_RESTORER\n",
current->comm, current->pid); current->comm, current->pid);
...@@ -189,10 +188,10 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -189,10 +188,10 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
} }
pr_debug("SIG deliver [%s:%d]: sig=%d sp=0x%lx pc=0x%lx->0x%p lr=0x%lx\n", pr_debug("SIG deliver [%s:%d]: sig=%d sp=0x%lx pc=0x%lx->0x%p lr=0x%lx\n",
current->comm, current->pid, sig, regs->sp, current->comm, current->pid, ksig->sig, regs->sp,
regs->pc, ka->sa.sa_handler, regs->lr); regs->pc, ksig->ka.sa.sa_handler, regs->lr);
regs->pc = (unsigned long) ka->sa.sa_handler; regs->pc = (unsigned long)ksig->ka.sa.sa_handler;
out: out:
return err; return err;
...@@ -208,15 +207,14 @@ static inline void setup_syscall_restart(struct pt_regs *regs) ...@@ -208,15 +207,14 @@ static inline void setup_syscall_restart(struct pt_regs *regs)
} }
static inline void static inline void
handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, handle_signal(struct ksignal *ksig, struct pt_regs *regs, int syscall)
struct pt_regs *regs, int syscall)
{ {
int ret; int ret;
/* /*
* Set up the stack frame * Set up the stack frame
*/ */
ret = setup_rt_frame(sig, ka, info, sigmask_to_save(), regs); ret = setup_rt_frame(ksig, sigmask_to_save(), regs);
/* /*
* Check that the resulting registers are sane * Check that the resulting registers are sane
...@@ -226,10 +224,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -226,10 +224,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
/* /*
* Block the signal if we were successful. * Block the signal if we were successful.
*/ */
if (ret != 0) signal_setup_done(ret, ksig, 0);
force_sigsegv(sig, current);
else
signal_delivered(sig, info, ka, regs, 0);
} }
/* /*
...@@ -239,9 +234,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -239,9 +234,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
*/ */
static void do_signal(struct pt_regs *regs, int syscall) static void do_signal(struct pt_regs *regs, int syscall)
{ {
siginfo_t info; struct ksignal ksig;
int signr;
struct k_sigaction ka;
/* /*
* We want the common case to go fast, which is why we may in * We want the common case to go fast, which is why we may in
...@@ -251,18 +244,18 @@ static void do_signal(struct pt_regs *regs, int syscall) ...@@ -251,18 +244,18 @@ static void do_signal(struct pt_regs *regs, int syscall)
if (!user_mode(regs)) if (!user_mode(regs))
return; return;
signr = get_signal_to_deliver(&info, &ka, regs, NULL); get_signal(&ksig);
if (syscall) { if (syscall) {
switch (regs->r12) { switch (regs->r12) {
case -ERESTART_RESTARTBLOCK: case -ERESTART_RESTARTBLOCK:
case -ERESTARTNOHAND: case -ERESTARTNOHAND:
if (signr > 0) { if (ksig.sig > 0) {
regs->r12 = -EINTR; regs->r12 = -EINTR;
break; break;
} }
/* fall through */ /* fall through */
case -ERESTARTSYS: case -ERESTARTSYS:
if (signr > 0 && !(ka.sa.sa_flags & SA_RESTART)) { if (ksig.sig > 0 && !(ksig.ka.sa.sa_flags & SA_RESTART)) {
regs->r12 = -EINTR; regs->r12 = -EINTR;
break; break;
} }
...@@ -272,13 +265,13 @@ static void do_signal(struct pt_regs *regs, int syscall) ...@@ -272,13 +265,13 @@ static void do_signal(struct pt_regs *regs, int syscall)
} }
} }
if (signr == 0) { if (!ksig.sig) {
/* No signal to deliver -- put the saved sigmask back */ /* No signal to deliver -- put the saved sigmask back */
restore_saved_sigmask(); restore_saved_sigmask();
return; return;
} }
handle_signal(signr, &ka, &info, regs, syscall); handle_signal(&ksig, regs, syscall);
} }
asmlinkage void do_notify_resume(struct pt_regs *regs, struct thread_info *ti) asmlinkage void do_notify_resume(struct pt_regs *regs, struct thread_info *ti)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment