microblaze: 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
0d97500d39
commit
9c53c7ec14
|
@ -156,11 +156,11 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
|
||||||
return (void __user *)((sp - frame_size) & -8UL);
|
return (void __user *)((sp - frame_size) & -8UL);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 err = 0;
|
int err = 0, sig = ksig->sig;
|
||||||
int signal;
|
int signal;
|
||||||
unsigned long address = 0;
|
unsigned long address = 0;
|
||||||
#ifdef CONFIG_MMU
|
#ifdef CONFIG_MMU
|
||||||
|
@ -168,10 +168,10 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
|
||||||
pte_t *ptep;
|
pte_t *ptep;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
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 give_sigsegv;
|
return -EFAULT;
|
||||||
|
|
||||||
signal = current_thread_info()->exec_domain
|
signal = current_thread_info()->exec_domain
|
||||||
&& current_thread_info()->exec_domain->signal_invmap
|
&& current_thread_info()->exec_domain->signal_invmap
|
||||||
|
@ -179,8 +179,8 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
|
||||||
? current_thread_info()->exec_domain->signal_invmap[sig]
|
? current_thread_info()->exec_domain->signal_invmap[sig]
|
||||||
: sig;
|
: sig;
|
||||||
|
|
||||||
if (info)
|
if (ksig->ka.sa.sa_flags & SA_SIGINFO)
|
||||||
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);
|
||||||
|
@ -227,7 +227,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
|
||||||
flush_dcache_range(address, address + 8);
|
flush_dcache_range(address, address + 8);
|
||||||
#endif
|
#endif
|
||||||
if (err)
|
if (err)
|
||||||
goto give_sigsegv;
|
return -EFAULT;
|
||||||
|
|
||||||
/* Set up registers for signal handler */
|
/* Set up registers for signal handler */
|
||||||
regs->r1 = (unsigned long) frame;
|
regs->r1 = (unsigned long) frame;
|
||||||
|
@ -237,7 +237,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
|
||||||
regs->r6 = (unsigned long) &frame->info; /* arg 1: siginfo */
|
regs->r6 = (unsigned long) &frame->info; /* arg 1: siginfo */
|
||||||
regs->r7 = (unsigned long) &frame->uc; /* arg2: ucontext */
|
regs->r7 = (unsigned long) &frame->uc; /* arg2: ucontext */
|
||||||
/* Offset to handle microblaze rtid r14, 0 */
|
/* Offset to handle microblaze rtid r14, 0 */
|
||||||
regs->pc = (unsigned long)ka->sa.sa_handler;
|
regs->pc = (unsigned long)ksig->ka.sa.sa_handler;
|
||||||
|
|
||||||
set_fs(USER_DS);
|
set_fs(USER_DS);
|
||||||
|
|
||||||
|
@ -247,10 +247,6 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
give_sigsegv:
|
|
||||||
force_sigsegv(sig, current);
|
|
||||||
return -EFAULT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle restarting system calls */
|
/* Handle restarting system calls */
|
||||||
|
@ -283,23 +279,15 @@ do_restart:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_signal(unsigned long sig, struct k_sigaction *ka,
|
handle_signal(struct ksignal *ksig, struct pt_regs *regs)
|
||||||
siginfo_t *info, struct pt_regs *regs)
|
|
||||||
{
|
{
|
||||||
sigset_t *oldset = sigmask_to_save();
|
sigset_t *oldset = sigmask_to_save();
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Set up the stack frame */
|
/* Set up the stack frame */
|
||||||
if (ka->sa.sa_flags & SA_SIGINFO)
|
ret = setup_rt_frame(ksig, oldset, regs);
|
||||||
ret = setup_rt_frame(sig, ka, info, oldset, regs);
|
|
||||||
else
|
|
||||||
ret = setup_rt_frame(sig, ka, NULL, oldset, regs);
|
|
||||||
|
|
||||||
if (ret)
|
signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLESTEP));
|
||||||
return;
|
|
||||||
|
|
||||||
signal_delivered(sig, info, ka, regs,
|
|
||||||
test_thread_flag(TIF_SINGLESTEP));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -313,21 +301,19 @@ handle_signal(unsigned long sig, struct k_sigaction *ka,
|
||||||
*/
|
*/
|
||||||
static void do_signal(struct pt_regs *regs, int in_syscall)
|
static void do_signal(struct pt_regs *regs, int in_syscall)
|
||||||
{
|
{
|
||||||
siginfo_t info;
|
struct ksignal ksig;
|
||||||
int signr;
|
|
||||||
struct k_sigaction ka;
|
|
||||||
#ifdef DEBUG_SIG
|
#ifdef DEBUG_SIG
|
||||||
pr_info("do signal: %p %d\n", regs, in_syscall);
|
pr_info("do signal: %p %d\n", regs, in_syscall);
|
||||||
pr_info("do signal2: %lx %lx %ld [%lx]\n", regs->pc, regs->r1,
|
pr_info("do signal2: %lx %lx %ld [%lx]\n", regs->pc, regs->r1,
|
||||||
regs->r12, current_thread_info()->flags);
|
regs->r12, current_thread_info()->flags);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
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. */
|
||||||
if (in_syscall)
|
if (in_syscall)
|
||||||
handle_restart(regs, &ka, 1);
|
handle_restart(regs, &ksig.ka, 1);
|
||||||
handle_signal(signr, &ka, &info, regs);
|
handle_signal(&ksig, regs);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue