提交 e19c025b 编写于 作者: R Richard Weinberger 提交者: Richard Weinberger

c6x: Use get_signal() signal_setup_done()

Use the more generic functions get_signal() signal_setup_done()
for signal delivery.
Tested-by: NMark Salter <msalter@redhat.com>
Acked-by: NMark Salter <msalter@redhat.com>
Signed-off-by: NRichard Weinberger <richard@nod.at>
上级 1270cff1
...@@ -146,21 +146,21 @@ static inline void __user *get_sigframe(struct k_sigaction *ka, ...@@ -146,21 +146,21 @@ static inline void __user *get_sigframe(struct k_sigaction *ka,
return (void __user *)((sp - framesize) & ~7); return (void __user *)((sp - framesize) & ~7);
} }
static int setup_rt_frame(int signr, struct k_sigaction *ka, siginfo_t *info, static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
sigset_t *set, struct pt_regs *regs) struct pt_regs *regs)
{ {
struct rt_sigframe __user *frame; struct rt_sigframe __user *frame;
unsigned long __user *retcode; unsigned long __user *retcode;
int err = 0; int err = 0;
frame = get_sigframe(ka, regs, sizeof(*frame)); frame = get_sigframe(&ksig->ka, regs, sizeof(*frame));
if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
goto segv_and_exit; return -EFAULT;
err |= __put_user(&frame->info, &frame->pinfo); err |= __put_user(&frame->info, &frame->pinfo);
err |= __put_user(&frame->uc, &frame->puc); err |= __put_user(&frame->uc, &frame->puc);
err |= copy_siginfo_to_user(&frame->info, info); err |= copy_siginfo_to_user(&frame->info, &ksig->info);
/* Clear all the bits of the ucontext we don't use. */ /* Clear all the bits of the ucontext we don't use. */
err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext)); err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext));
...@@ -188,7 +188,7 @@ static int setup_rt_frame(int signr, struct k_sigaction *ka, siginfo_t *info, ...@@ -188,7 +188,7 @@ static int setup_rt_frame(int signr, struct k_sigaction *ka, siginfo_t *info,
#undef COPY #undef COPY
if (err) if (err)
goto segv_and_exit; return -EFAULT;
flush_icache_range((unsigned long) &frame->retcode, flush_icache_range((unsigned long) &frame->retcode,
(unsigned long) &frame->retcode + RETCODE_SIZE); (unsigned long) &frame->retcode + RETCODE_SIZE);
...@@ -198,10 +198,10 @@ static int setup_rt_frame(int signr, struct k_sigaction *ka, siginfo_t *info, ...@@ -198,10 +198,10 @@ static int setup_rt_frame(int signr, struct k_sigaction *ka, siginfo_t *info,
/* Change user context to branch to signal handler */ /* Change user context to branch to signal handler */
regs->sp = (unsigned long) frame - 8; regs->sp = (unsigned long) frame - 8;
regs->b3 = (unsigned long) retcode; regs->b3 = (unsigned long) retcode;
regs->pc = (unsigned long) ka->sa.sa_handler; regs->pc = (unsigned long) ksig->ka.sa.sa_handler;
/* Give the signal number to the handler */ /* Give the signal number to the handler */
regs->a4 = signr; regs->a4 = ksig->sig;
/* /*
* For realtime signals we must also set the second and third * For realtime signals we must also set the second and third
...@@ -212,10 +212,6 @@ static int setup_rt_frame(int signr, struct k_sigaction *ka, siginfo_t *info, ...@@ -212,10 +212,6 @@ static int setup_rt_frame(int signr, struct k_sigaction *ka, siginfo_t *info,
regs->a6 = (unsigned long)&frame->uc; regs->a6 = (unsigned long)&frame->uc;
return 0; return 0;
segv_and_exit:
force_sigsegv(signr, current);
return -EFAULT;
} }
static inline void static inline void
...@@ -245,10 +241,11 @@ handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler) ...@@ -245,10 +241,11 @@ handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler)
/* /*
* handle the actual delivery of a signal to userspace * handle the actual delivery of a signal to userspace
*/ */
static void handle_signal(int sig, static void handle_signal(struct ksignal *ksig, struct pt_regs *regs,
siginfo_t *info, struct k_sigaction *ka, int syscall)
struct pt_regs *regs, int syscall)
{ {
int ret;
/* Are we from a system call? */ /* Are we from a system call? */
if (syscall) { if (syscall) {
/* If so, check system call restarting.. */ /* If so, check system call restarting.. */
...@@ -259,7 +256,7 @@ static void handle_signal(int sig, ...@@ -259,7 +256,7 @@ static void handle_signal(int sig,
break; break;
case -ERESTARTSYS: case -ERESTARTSYS:
if (!(ka->sa.sa_flags & SA_RESTART)) { if (!(ksig->ka.sa.sa_flags & SA_RESTART)) {
regs->a4 = -EINTR; regs->a4 = -EINTR;
break; break;
} }
...@@ -272,9 +269,8 @@ static void handle_signal(int sig, ...@@ -272,9 +269,8 @@ static void handle_signal(int sig,
} }
/* Set up the stack frame */ /* Set up the stack frame */
if (setup_rt_frame(sig, ka, info, sigmask_to_save(), regs) < 0) ret = setup_rt_frame(ksig, sigmask_to_save(), regs);
return; signal_setup_done(ret, ksig, 0);
signal_delivered(sig, info, ka, regs, 0);
} }
/* /*
...@@ -282,18 +278,15 @@ static void handle_signal(int sig, ...@@ -282,18 +278,15 @@ static void handle_signal(int sig,
*/ */
static void do_signal(struct pt_regs *regs, int syscall) static void do_signal(struct pt_regs *regs, int syscall)
{ {
struct k_sigaction ka; struct ksignal ksig;
siginfo_t info;
int signr;
/* we want the common case to go fast, which is why we may in certain /* we want the common case to go fast, which is why we may in certain
* cases get here from kernel mode */ * cases get here from kernel mode */
if (!user_mode(regs)) if (!user_mode(regs))
return; return;
signr = get_signal_to_deliver(&info, &ka, regs, NULL); if (get_signal(&ksig)) {
if (signr > 0) { handle_signal(&ksig, regs, syscall);
handle_signal(signr, &info, &ka, regs, syscall);
return; return;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册