Commit 649671c9 authored by Richard Weinberger's avatar Richard Weinberger Committed by Richard Weinberger

unicore32: 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>
parent 307627ee
...@@ -238,10 +238,10 @@ static int setup_return(struct pt_regs *regs, struct k_sigaction *ka, ...@@ -238,10 +238,10 @@ static int setup_return(struct pt_regs *regs, struct k_sigaction *ka,
return 0; return 0;
} }
static int setup_frame(int usig, 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 = get_sigframe(ka, regs, sizeof(*frame)); struct sigframe __user *frame = get_sigframe(&ksig->ka, regs, sizeof(*frame));
int err = 0; int err = 0;
if (!frame) if (!frame)
...@@ -254,29 +254,29 @@ static int setup_frame(int usig, struct k_sigaction *ka, ...@@ -254,29 +254,29 @@ static int setup_frame(int usig, struct k_sigaction *ka,
err |= setup_sigframe(frame, regs, set); err |= setup_sigframe(frame, regs, set);
if (err == 0) if (err == 0)
err |= setup_return(regs, ka, frame->retcode, frame, usig); err |= setup_return(regs, &ksig->ka, frame->retcode, frame, usig);
return err; return err;
} }
static int setup_rt_frame(int usig, 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 =
get_sigframe(ka, regs, sizeof(*frame)); get_sigframe(&ksig->ka, regs, sizeof(*frame));
int err = 0; int err = 0;
if (!frame) if (!frame)
return 1; return 1;
err |= copy_siginfo_to_user(&frame->info, info); err |= copy_siginfo_to_user(&frame->info, &ksig->info);
err |= __put_user(0, &frame->sig.uc.uc_flags); err |= __put_user(0, &frame->sig.uc.uc_flags);
err |= __put_user(NULL, &frame->sig.uc.uc_link); err |= __put_user(NULL, &frame->sig.uc.uc_link);
err |= __save_altstack(&frame->sig.uc.uc_stack, regs->UCreg_sp); err |= __save_altstack(&frame->sig.uc.uc_stack, regs->UCreg_sp);
err |= setup_sigframe(&frame->sig, regs, set); err |= setup_sigframe(&frame->sig, regs, set);
if (err == 0) if (err == 0)
err |= setup_return(regs, ka, frame->sig.retcode, frame, usig); err |= setup_return(regs, &ksig->ka, frame->sig.retcode, frame, usig);
if (err == 0) { if (err == 0) {
/* /*
...@@ -299,13 +299,13 @@ static inline void setup_syscall_restart(struct pt_regs *regs) ...@@ -299,13 +299,13 @@ static inline void setup_syscall_restart(struct pt_regs *regs)
/* /*
* OK, we're invoking a handler * OK, we're invoking a handler
*/ */
static void handle_signal(unsigned long sig, struct k_sigaction *ka, static void handle_signal(struct ksignal *ksig, struct pt_regs *regs,
siginfo_t *info, struct pt_regs *regs, int syscall) int syscall)
{ {
struct thread_info *thread = current_thread_info(); struct thread_info *thread = current_thread_info();
struct task_struct *tsk = current; struct task_struct *tsk = current;
sigset_t *oldset = sigmask_to_save(); sigset_t *oldset = sigmask_to_save();
int usig = sig; int usig = ksig->sig;
int ret; int ret;
/* /*
...@@ -318,7 +318,7 @@ static void handle_signal(unsigned long sig, struct k_sigaction *ka, ...@@ -318,7 +318,7 @@ static void handle_signal(unsigned long sig, struct k_sigaction *ka,
regs->UCreg_00 = -EINTR; regs->UCreg_00 = -EINTR;
break; break;
case -ERESTARTSYS: case -ERESTARTSYS:
if (!(ka->sa.sa_flags & SA_RESTART)) { if (!(ksig->ka.sa.sa_flags & SA_RESTART)) {
regs->UCreg_00 = -EINTR; regs->UCreg_00 = -EINTR;
break; break;
} }
...@@ -338,22 +338,17 @@ static void handle_signal(unsigned long sig, struct k_sigaction *ka, ...@@ -338,22 +338,17 @@ static void handle_signal(unsigned long sig, struct k_sigaction *ka,
/* /*
* 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)
ret = setup_rt_frame(usig, ka, info, oldset, regs); ret = setup_rt_frame(ksig, oldset, regs);
else else
ret = setup_frame(usig, ka, oldset, regs); ret = setup_frame(ksig, oldset, regs);
/* /*
* Check that the resulting registers are actually sane. * Check that the resulting registers are actually sane.
*/ */
ret |= !valid_user_regs(regs); ret |= !valid_user_regs(regs);
if (ret != 0) { signal_setup_done(ret, ksig, 0);
force_sigsegv(sig, tsk);
return;
}
signal_delivered(sig, info, ka, regs, 0);
} }
/* /*
...@@ -367,9 +362,7 @@ static void handle_signal(unsigned long sig, struct k_sigaction *ka, ...@@ -367,9 +362,7 @@ static void handle_signal(unsigned long sig, struct k_sigaction *ka,
*/ */
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 * We want the common case to go fast, which
...@@ -380,9 +373,8 @@ static void do_signal(struct pt_regs *regs, int syscall) ...@@ -380,9 +373,8 @@ 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); if (get_signsl(&ksig)) {
if (signr > 0) { handle_signal(&ksig, regs, syscall);
handle_signal(signr, &ka, &info, regs, syscall);
return; return;
} }
......
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