Commit bbb3572b authored by Anton Blanchard's avatar Anton Blanchard

ppc64 signal cleanup: remove old debug and sync with ppc32 signal code

parent 702d27c7
/*
* linux/arch/ppc64/kernel/signal.c
*
*
*
* PowerPC version
* Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
*
......@@ -108,11 +106,6 @@ long sys_sigsuspend(old_sigset_t mask, int p2, int p3, int p4, int p6, int p7,
{
sigset_t saveset;
PPCDBG(PPCDBG_SYS64X, "sys_sigsuspend - running - pid=%ld current=%lx comm=%s \n",
current->pid, current, current->comm);
mask &= _BLOCKABLE;
spin_lock_irq(&current->sigmask_lock);
saveset = current->blocked;
......@@ -142,10 +135,6 @@ long sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, int p3, int p4, int
{
sigset_t saveset, newset;
PPCDBG(PPCDBG_SYS64X, "sys_rt_sigsuspend - running - pid=%ld current=%lx comm=%s \n",
current->pid, current, current->comm);
/* XXX: Don't preclude handling different sized sigset_t's. */
if (sigsetsize != sizeof(sigset_t))
return -EINVAL;
......@@ -171,13 +160,9 @@ long sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, int p3, int p4, int
asmlinkage long sys_sigaltstack(const stack_t *uss, stack_t *uoss)
long sys_sigaltstack(const stack_t *uss, stack_t *uoss)
{
struct pt_regs *regs = (struct pt_regs *) &uss;
PPCDBG(PPCDBG_SYS64X, "sys_sigaltstack - running - pid=%ld current=%lx comm=%s \n",
current->pid, current, current->comm);
return do_sigaltstack(uss, uoss, regs->gpr[1]);
}
......@@ -187,11 +172,6 @@ long sys_sigaction(int sig, const struct old_sigaction *act,
struct k_sigaction new_ka, old_ka;
int ret;
PPCDBG(PPCDBG_SYS64X, "sys_sigaction - running - pid=%ld current=%lx comm=%s \n",
current->pid, current, current->comm);
if (act) {
old_sigset_t mask;
if (verify_area(VERIFY_READ, act, sizeof(*act)) ||
......@@ -203,7 +183,7 @@ long sys_sigaction(int sig, const struct old_sigaction *act,
siginitset(&new_ka.sa.sa_mask, mask);
}
ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
ret = do_sigaction(sig, (act? &new_ka: NULL), (oact? &old_ka: NULL));
if (!ret && oact) {
if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) ||
......@@ -214,9 +194,6 @@ long sys_sigaction(int sig, const struct old_sigaction *act,
__put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
}
return ret;
}
......@@ -224,7 +201,7 @@ long sys_sigaction(int sig, const struct old_sigaction *act,
* When we have signals to deliver, we set up on the
* user stack, going down from the original stack pointer:
* a sigregs struct
* one or more sigcontext structs
* one or more sigcontext structs with
* a gap of __SIGNAL_FRAMESIZE bytes
*
* Each of these things must be a multiple of 16 bytes in size.
......@@ -394,7 +371,6 @@ setup_rt_frame(struct pt_regs *regs, struct sigregs *frame,
regs->gpr[6] = (unsigned long) rt_sf;
regs->link = (unsigned long) frame->tramp;
return;
badframe:
......@@ -525,14 +501,9 @@ setup_frame(struct pt_regs *regs, struct sigregs *frame,
regs->gpr[4] = (unsigned long) sc;
regs->link = (unsigned long) frame->tramp;
PPCDBG(PPCDBG_SIGNAL, "setup_frame - returning - regs->gpr[1]=%lx, regs->gpr[4]=%lx, regs->link=%lx \n",
regs->gpr[1], regs->gpr[4], regs->link);
return;
badframe:
PPCDBG(PPCDBG_SIGNAL, "setup_frame - badframe in setup_frame, regs=%p frame=%p newsp=%lx\n", regs, frame, newsp); PPCDBG_ENTER_DEBUGGER();
#if DEBUG_SIG
printk("badframe in setup_frame, regs=%p frame=%p newsp=%lx\n",
regs, frame, newsp);
......@@ -556,8 +527,8 @@ handle_signal(unsigned long sig, struct k_sigaction *ka,
((int)regs->result == -ERESTARTSYS &&
!(ka->sa.sa_flags & SA_RESTART))))
regs->result = -EINTR;
/* Set up Signal Frame */
if (ka->sa.sa_flags & SA_SIGINFO) {
/* Put a Real Time Context onto stack */
*newspp -= sizeof(*rt_sf);
......@@ -583,7 +554,6 @@ handle_signal(unsigned long sig, struct k_sigaction *ka,
|| __put_user((struct pt_regs *)frame, &rt_sf->uc.uc_mcontext.regs)
|| __put_user(sig, &rt_sf->uc.uc_mcontext.signal))
goto badframe;
} else {
/* Put another sigcontext on the stack */
*newspp -= sizeof(*sc);
......@@ -649,11 +619,9 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
for (;;) {
unsigned long signr;
PPCDBG(PPCDBG_SIGNAL, "do_signal - (pre) dequeueing signal - pid=%ld current=%lx comm=%s \n", current->pid, current, current->comm);
spin_lock_irq(&current->sigmask_lock);
signr = dequeue_signal(&current->blocked, &info);
spin_unlock_irq(&current->sigmask_lock);
PPCDBG(PPCDBG_SIGNAL, "do_signal - (aft) dequeueing signal - signal=%lx - pid=%ld current=%lx comm=%s \n", signr, current->pid, current, current->comm);
if (!signr)
break;
......@@ -691,12 +659,7 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
}
ka = &current->sig->action[signr-1];
PPCDBG(PPCDBG_SIGNAL, "do_signal - ka=%p, action handler=%lx \n", ka, ka->sa.sa_handler);
if (ka->sa.sa_handler == SIG_IGN) {
PPCDBG(PPCDBG_SIGNAL, "do_signal - into SIG_IGN logic \n");
if (signr != SIGCHLD)
continue;
/* Check for SIGCHLD: it's special. */
......@@ -707,7 +670,6 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
if (ka->sa.sa_handler == SIG_DFL) {
int exit_code = signr;
PPCDBG(PPCDBG_SIGNAL, "do_signal - into SIG_DFL logic \n");
/* Init gets no signals it doesn't want. */
if (current->pid == 1)
......@@ -751,10 +713,7 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
newsp = frame = newsp - sizeof(struct sigregs);
/* Whee! Actually deliver the signal. */
PPCDBG(PPCDBG_SIGNAL, "do_signal - GOING TO RUN SIGNAL HANDLER - pid=%ld current=%lx comm=%s \n", current->pid, current, current->comm);
handle_signal(signr, ka, &info, oldset, regs, &newsp, frame);
PPCDBG(PPCDBG_SIGNAL, "do_signal - after running signal handler - pid=%ld current=%lx comm=%s \n", current->pid, current, current->comm);
break;
}
......@@ -762,24 +721,17 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
((int)regs->result == -ERESTARTNOHAND ||
(int)regs->result == -ERESTARTSYS ||
(int)regs->result == -ERESTARTNOINTR)) {
PPCDBG(PPCDBG_SIGNAL, "do_signal - going to back up & retry system call \n");
regs->gpr[3] = regs->orig_gpr3;
regs->nip -= 4; /* Back up & retry system call */
regs->result = 0;
}
if (newsp == frame)
{
PPCDBG(PPCDBG_SIGNAL, "do_signal - returning w/ no signal delivered \n");
return 0; /* no signals delivered */
}
if (ka->sa.sa_flags & SA_SIGINFO)
setup_rt_frame(regs, (struct sigregs *) frame, newsp);
else
setup_frame(regs, (struct sigregs *) frame, newsp);
PPCDBG(PPCDBG_SIGNAL, "do_signal - returning a signal was delivered \n");
return 1;
}
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