m68k: Use get_signal() signal_setup_done()
Use the more generic functions get_signal() signal_setup_done() for signal delivery. Signed-off-by: Richard Weinberger <richard@nod.at>
This commit is contained in:
parent
0f5bef660a
commit
0d97500d39
|
@ -850,23 +850,23 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
|
||||||
return (void __user *)((usp - frame_size) & -8UL);
|
return (void __user *)((usp - frame_size) & -8UL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int setup_frame (int sig, struct k_sigaction *ka,
|
static int setup_frame(struct ksignal *ksig, sigset_t *set,
|
||||||
sigset_t *set, struct pt_regs *regs)
|
struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
struct sigframe __user *frame;
|
struct sigframe __user *frame;
|
||||||
int fsize = frame_extra_sizes(regs->format);
|
int fsize = frame_extra_sizes(regs->format);
|
||||||
struct sigcontext context;
|
struct sigcontext context;
|
||||||
int err = 0;
|
int err = 0, sig = ksig->sig;
|
||||||
|
|
||||||
if (fsize < 0) {
|
if (fsize < 0) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printk ("setup_frame: Unknown frame format %#x\n",
|
printk ("setup_frame: Unknown frame format %#x\n",
|
||||||
regs->format);
|
regs->format);
|
||||||
#endif
|
#endif
|
||||||
goto give_sigsegv;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
frame = get_sigframe(ka, regs, sizeof(*frame) + fsize);
|
frame = get_sigframe(&ksig->ka, regs, sizeof(*frame) + fsize);
|
||||||
|
|
||||||
if (fsize)
|
if (fsize)
|
||||||
err |= copy_to_user (frame + 1, regs + 1, fsize);
|
err |= copy_to_user (frame + 1, regs + 1, fsize);
|
||||||
|
@ -899,7 +899,7 @@ static int setup_frame (int sig, struct k_sigaction *ka,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
goto give_sigsegv;
|
return -EFAULT;
|
||||||
|
|
||||||
push_cache ((unsigned long) &frame->retcode);
|
push_cache ((unsigned long) &frame->retcode);
|
||||||
|
|
||||||
|
@ -908,7 +908,7 @@ static int setup_frame (int sig, struct k_sigaction *ka,
|
||||||
* to destroy is successfully copied to sigframe.
|
* to destroy is successfully copied to sigframe.
|
||||||
*/
|
*/
|
||||||
wrusp ((unsigned long) frame);
|
wrusp ((unsigned long) frame);
|
||||||
regs->pc = (unsigned long) ka->sa.sa_handler;
|
regs->pc = (unsigned long) ksig->ka.sa.sa_handler;
|
||||||
adjustformat(regs);
|
adjustformat(regs);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -934,28 +934,24 @@ static int setup_frame (int sig, struct k_sigaction *ka,
|
||||||
tregs->sr = regs->sr;
|
tregs->sr = regs->sr;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
give_sigsegv:
|
|
||||||
force_sigsegv(sig, current);
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int setup_rt_frame (int sig, 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;
|
||||||
int fsize = frame_extra_sizes(regs->format);
|
int fsize = frame_extra_sizes(regs->format);
|
||||||
int err = 0;
|
int err = 0, sig = ksig->sig;
|
||||||
|
|
||||||
if (fsize < 0) {
|
if (fsize < 0) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printk ("setup_frame: Unknown frame format %#x\n",
|
printk ("setup_frame: Unknown frame format %#x\n",
|
||||||
regs->format);
|
regs->format);
|
||||||
#endif
|
#endif
|
||||||
goto give_sigsegv;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
frame = get_sigframe(ka, regs, sizeof(*frame));
|
frame = get_sigframe(&ksig->ka, regs, sizeof(*frame));
|
||||||
|
|
||||||
if (fsize)
|
if (fsize)
|
||||||
err |= copy_to_user (&frame->uc.uc_extra, regs + 1, fsize);
|
err |= copy_to_user (&frame->uc.uc_extra, regs + 1, fsize);
|
||||||
|
@ -968,7 +964,7 @@ static int setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
|
||||||
&frame->sig);
|
&frame->sig);
|
||||||
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);
|
||||||
|
|
||||||
/* Create the ucontext. */
|
/* Create the ucontext. */
|
||||||
err |= __put_user(0, &frame->uc.uc_flags);
|
err |= __put_user(0, &frame->uc.uc_flags);
|
||||||
|
@ -996,7 +992,7 @@ static int setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
|
||||||
#endif /* CONFIG_MMU */
|
#endif /* CONFIG_MMU */
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
goto give_sigsegv;
|
return -EFAULT;
|
||||||
|
|
||||||
push_cache ((unsigned long) &frame->retcode);
|
push_cache ((unsigned long) &frame->retcode);
|
||||||
|
|
||||||
|
@ -1005,7 +1001,7 @@ static int setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
|
||||||
* to destroy is successfully copied to sigframe.
|
* to destroy is successfully copied to sigframe.
|
||||||
*/
|
*/
|
||||||
wrusp ((unsigned long) frame);
|
wrusp ((unsigned long) frame);
|
||||||
regs->pc = (unsigned long) ka->sa.sa_handler;
|
regs->pc = (unsigned long) ksig->ka.sa.sa_handler;
|
||||||
adjustformat(regs);
|
adjustformat(regs);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1031,10 +1027,6 @@ static int setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
|
||||||
tregs->sr = regs->sr;
|
tregs->sr = regs->sr;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
give_sigsegv:
|
|
||||||
force_sigsegv(sig, current);
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
@ -1074,26 +1066,22 @@ handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler)
|
||||||
* OK, we're invoking a handler
|
* OK, we're invoking a handler
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info,
|
handle_signal(struct ksignal *ksig, struct pt_regs *regs)
|
||||||
struct pt_regs *regs)
|
|
||||||
{
|
{
|
||||||
sigset_t *oldset = sigmask_to_save();
|
sigset_t *oldset = sigmask_to_save();
|
||||||
int err;
|
int err;
|
||||||
/* are we from a system call? */
|
/* are we from a system call? */
|
||||||
if (regs->orig_d0 >= 0)
|
if (regs->orig_d0 >= 0)
|
||||||
/* If so, check system call restarting.. */
|
/* If so, check system call restarting.. */
|
||||||
handle_restart(regs, ka, 1);
|
handle_restart(regs, &ksig->ka, 1);
|
||||||
|
|
||||||
/* set up the stack frame */
|
/* set up the stack frame */
|
||||||
if (ka->sa.sa_flags & SA_SIGINFO)
|
if (ksig->ka.sa.sa_flags & SA_SIGINFO)
|
||||||
err = setup_rt_frame(sig, ka, info, oldset, regs);
|
err = setup_rt_frame(ksig, oldset, regs);
|
||||||
else
|
else
|
||||||
err = setup_frame(sig, ka, oldset, regs);
|
err = setup_frame(ksig, oldset, regs);
|
||||||
|
|
||||||
if (err)
|
signal_setup_done(err, ksig, 0);
|
||||||
return;
|
|
||||||
|
|
||||||
signal_delivered(sig, info, ka, regs, 0);
|
|
||||||
|
|
||||||
if (test_thread_flag(TIF_DELAYED_TRACE)) {
|
if (test_thread_flag(TIF_DELAYED_TRACE)) {
|
||||||
regs->sr &= ~0x8000;
|
regs->sr &= ~0x8000;
|
||||||
|
@ -1108,16 +1096,13 @@ handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info,
|
||||||
*/
|
*/
|
||||||
static void do_signal(struct pt_regs *regs)
|
static void do_signal(struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
siginfo_t info;
|
struct ksignal ksig;
|
||||||
struct k_sigaction ka;
|
|
||||||
int signr;
|
|
||||||
|
|
||||||
current->thread.esp0 = (unsigned long) regs;
|
current->thread.esp0 = (unsigned long) regs;
|
||||||
|
|
||||||
signr = get_signal_to_deliver(&info, &ka, regs, NULL);
|
if (get_signal(&ksig)) {
|
||||||
if (signr > 0) {
|
|
||||||
/* Whee! Actually deliver the signal. */
|
/* Whee! Actually deliver the signal. */
|
||||||
handle_signal(signr, &ka, &info, regs);
|
handle_signal(&ksig, regs);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue