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

parisc: 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 avatarHelge Deller <deller@gmx.de>
parent 8b166553
...@@ -227,8 +227,8 @@ setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, int in_sysc ...@@ -227,8 +227,8 @@ setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, int in_sysc
} }
static long static long
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, int in_syscall) int in_syscall)
{ {
struct rt_sigframe __user *frame; struct rt_sigframe __user *frame;
unsigned long rp, usp; unsigned long rp, usp;
...@@ -241,10 +241,10 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -241,10 +241,10 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
usp = (regs->gr[30] & ~(0x01UL)); usp = (regs->gr[30] & ~(0x01UL));
/*FIXME: frame_size parameter is unused, remove it. */ /*FIXME: frame_size parameter is unused, remove it. */
frame = get_sigframe(ka, usp, sizeof(*frame)); frame = get_sigframe(&ksig->ka, usp, sizeof(*frame));
DBG(1,"SETUP_RT_FRAME: START\n"); DBG(1,"SETUP_RT_FRAME: START\n");
DBG(1,"setup_rt_frame: frame %p info %p\n", frame, info); DBG(1,"setup_rt_frame: frame %p info %p\n", frame, ksig->info);
#ifdef CONFIG_64BIT #ifdef CONFIG_64BIT
...@@ -253,7 +253,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -253,7 +253,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
if (is_compat_task()) { if (is_compat_task()) {
DBG(1,"setup_rt_frame: frame->info = 0x%p\n", &compat_frame->info); DBG(1,"setup_rt_frame: frame->info = 0x%p\n", &compat_frame->info);
err |= copy_siginfo_to_user32(&compat_frame->info, info); err |= copy_siginfo_to_user32(&compat_frame->info, &ksig->info);
err |= __compat_save_altstack( &compat_frame->uc.uc_stack, regs->gr[30]); err |= __compat_save_altstack( &compat_frame->uc.uc_stack, regs->gr[30]);
DBG(1,"setup_rt_frame: frame->uc = 0x%p\n", &compat_frame->uc); DBG(1,"setup_rt_frame: frame->uc = 0x%p\n", &compat_frame->uc);
DBG(1,"setup_rt_frame: frame->uc.uc_mcontext = 0x%p\n", &compat_frame->uc.uc_mcontext); DBG(1,"setup_rt_frame: frame->uc.uc_mcontext = 0x%p\n", &compat_frame->uc.uc_mcontext);
...@@ -265,7 +265,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -265,7 +265,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
#endif #endif
{ {
DBG(1,"setup_rt_frame: frame->info = 0x%p\n", &frame->info); DBG(1,"setup_rt_frame: frame->info = 0x%p\n", &frame->info);
err |= copy_siginfo_to_user(&frame->info, info); err |= copy_siginfo_to_user(&frame->info, &ksig->info);
err |= __save_altstack(&frame->uc.uc_stack, regs->gr[30]); err |= __save_altstack(&frame->uc.uc_stack, regs->gr[30]);
DBG(1,"setup_rt_frame: frame->uc = 0x%p\n", &frame->uc); DBG(1,"setup_rt_frame: frame->uc = 0x%p\n", &frame->uc);
DBG(1,"setup_rt_frame: frame->uc.uc_mcontext = 0x%p\n", &frame->uc.uc_mcontext); DBG(1,"setup_rt_frame: frame->uc.uc_mcontext = 0x%p\n", &frame->uc.uc_mcontext);
...@@ -275,7 +275,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -275,7 +275,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
} }
if (err) if (err)
goto give_sigsegv; return -EFAULT;
/* Set up to return from userspace. If provided, use a stub /* Set up to return from userspace. If provided, use a stub
already in userspace. The first words of tramp are used to already in userspace. The first words of tramp are used to
...@@ -312,9 +312,9 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -312,9 +312,9 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
rp = (unsigned long) &frame->tramp[SIGRESTARTBLOCK_TRAMP]; rp = (unsigned long) &frame->tramp[SIGRESTARTBLOCK_TRAMP];
if (err) if (err)
goto give_sigsegv; return -EFAULT;
haddr = A(ka->sa.sa_handler); haddr = A(ksig->ka.sa.sa_handler);
/* The sa_handler may be a pointer to a function descriptor */ /* The sa_handler may be a pointer to a function descriptor */
#ifdef CONFIG_64BIT #ifdef CONFIG_64BIT
if (is_compat_task()) { if (is_compat_task()) {
...@@ -326,7 +326,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -326,7 +326,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
err = __copy_from_user(&fdesc, ufdesc, sizeof(fdesc)); err = __copy_from_user(&fdesc, ufdesc, sizeof(fdesc));
if (err) if (err)
goto give_sigsegv; return -EFAULT;
haddr = fdesc.addr; haddr = fdesc.addr;
regs->gr[19] = fdesc.gp; regs->gr[19] = fdesc.gp;
...@@ -339,7 +339,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -339,7 +339,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
err = __copy_from_user(&fdesc, ufdesc, sizeof(fdesc)); err = __copy_from_user(&fdesc, ufdesc, sizeof(fdesc));
if (err) if (err)
goto give_sigsegv; return -EFAULT;
haddr = fdesc.addr; haddr = fdesc.addr;
regs->gr[19] = fdesc.gp; regs->gr[19] = fdesc.gp;
...@@ -386,7 +386,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -386,7 +386,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
} }
regs->gr[2] = rp; /* userland return pointer */ regs->gr[2] = rp; /* userland return pointer */
regs->gr[26] = sig; /* signal number */ regs->gr[26] = ksig->sig; /* signal number */
#ifdef CONFIG_64BIT #ifdef CONFIG_64BIT
if (is_compat_task()) { if (is_compat_task()) {
...@@ -410,11 +410,6 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -410,11 +410,6 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
current->comm, current->pid, frame, regs->gr[30], current->comm, current->pid, frame, regs->gr[30],
regs->iaoq[0], regs->iaoq[1], rp); regs->iaoq[0], regs->iaoq[1], rp);
return 1;
give_sigsegv:
DBG(1,"setup_rt_frame: sending SIGSEGV\n");
force_sigsegv(sig, current);
return 0; return 0;
} }
...@@ -423,20 +418,19 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -423,20 +418,19 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
*/ */
static void static void
handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, handle_signal(struct ksignal *ksig, struct pt_regs *regs, int in_syscall)
struct pt_regs *regs, int in_syscall)
{ {
int ret;
sigset_t *oldset = sigmask_to_save(); sigset_t *oldset = sigmask_to_save();
DBG(1,"handle_signal: sig=%ld, ka=%p, info=%p, oldset=%p, regs=%p\n", DBG(1,"handle_signal: sig=%ld, ka=%p, info=%p, oldset=%p, regs=%p\n",
sig, ka, info, oldset, regs); ksig->sig, ksig->ka, ksig->info, oldset, regs);
/* Set up the stack frame */ /* Set up the stack frame */
if (!setup_rt_frame(sig, ka, info, oldset, regs, in_syscall)) ret = setup_rt_frame(ksig, oldset, regs, in_syscall);
return;
signal_delivered(sig, info, ka, regs, signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLESTEP) ||
test_thread_flag(TIF_SINGLESTEP) || test_thread_flag(TIF_BLOCKSTEP));
test_thread_flag(TIF_BLOCKSTEP));
DBG(1,KERN_DEBUG "do_signal: Exit (success), regs->gr[28] = %ld\n", DBG(1,KERN_DEBUG "do_signal: Exit (success), regs->gr[28] = %ld\n",
regs->gr[28]); regs->gr[28]);
...@@ -544,22 +538,18 @@ insert_restart_trampoline(struct pt_regs *regs) ...@@ -544,22 +538,18 @@ insert_restart_trampoline(struct pt_regs *regs)
asmlinkage void asmlinkage void
do_signal(struct pt_regs *regs, long in_syscall) do_signal(struct pt_regs *regs, long in_syscall)
{ {
siginfo_t info; struct ksignal ksig;
struct k_sigaction ka;
int signr;
DBG(1,"\ndo_signal: regs=0x%p, sr7 %#lx, in_syscall=%d\n", DBG(1,"\ndo_signal: regs=0x%p, sr7 %#lx, in_syscall=%d\n",
regs, regs->sr[7], in_syscall); regs, regs->sr[7], in_syscall);
signr = get_signal_to_deliver(&info, &ka, regs, NULL); if (get_signal(&ksig)) {
DBG(3,"do_signal: signr = %d, regs->gr[28] = %ld\n", signr, regs->gr[28]); DBG(3,"do_signal: signr = %d, regs->gr[28] = %ld\n", signr, regs->gr[28]);
if (signr > 0) {
/* Restart a system call if necessary. */ /* Restart a system call if necessary. */
if (in_syscall) if (in_syscall)
syscall_restart(regs, &ka); syscall_restart(regs, &ksig.ka);
handle_signal(signr, &info, &ka, regs, in_syscall); handle_signal(&ksig, regs, in_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