]> err.no Git - linux-2.6/blobdiff - arch/x86/kernel/signal_64.c
Merge git://git.infradead.org/~dedekind/ubi-2.6
[linux-2.6] / arch / x86 / kernel / signal_64.c
index b7d7a6d5c26b8690fdd63fb103edbf6e4ac37bf5..827179c5b32a054ee9733b215fda94fbec8f8c48 100644 (file)
@@ -26,8 +26,7 @@
 #include <asm/proto.h>
 #include <asm/ia32_unistd.h>
 #include <asm/mce.h>
-
-/* #define DEBUG_SIG 1 */
+#include "sigframe.h"
 
 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
 
@@ -58,16 +57,9 @@ sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
 /*
  * Do a signal return; undo the signal stack.
  */
-
-struct rt_sigframe
-{
-       char __user *pretcode;
-       struct ucontext uc;
-       struct siginfo info;
-};
-
 static int
-restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, unsigned long *prax)
+restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
+                  unsigned long *pax)
 {
        unsigned int err = 0;
 
@@ -120,7 +112,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, unsigned
                }
        }
 
-       err |= __get_user(*prax, &sc->ax);
+       err |= __get_user(*pax, &sc->ax);
        return err;
 
 badframe:
@@ -133,13 +125,11 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
        sigset_t set;
        unsigned long ax;
 
-       frame = (struct rt_sigframe __user *)(regs->sp - 8);
-       if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) {
+       frame = (struct rt_sigframe __user *)(regs->sp - sizeof(long));
+       if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
                goto badframe;
-       } 
-       if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) { 
+       if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
                goto badframe;
-       } 
 
        sigdelsetmask(&set, ~_BLOCKABLE);
        spin_lock_irq(&current->sighand->siglock);
@@ -150,10 +140,6 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
        if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &ax))
                goto badframe;
 
-#ifdef DEBUG_SIG
-       printk("%d sigreturn ip:%lx sp:%lx frame:%p ax:%lx\n",current->pid,regs->ip,regs->sp,frame,ax);
-#endif
-
        if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->sp) == -EFAULT)
                goto badframe;
 
@@ -282,10 +268,6 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
        if (err)
                goto give_sigsegv;
 
-#ifdef DEBUG_SIG
-       printk("%d old ip %lx old sp %lx old ax %lx\n", current->pid,regs->ip,regs->sp,regs->ax);
-#endif
-
        /* Set up registers for signal handler */
        regs->di = sig;
        /* In case the signal handler was declared without prototypes */ 
@@ -310,10 +292,6 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
        regs->flags &= ~(X86_EFLAGS_TF | X86_EFLAGS_DF);
        if (test_thread_flag(TIF_SINGLESTEP))
                ptrace_notify(SIGTRAP);
-#ifdef DEBUG_SIG
-       printk("SIG deliver (%s:%d): sp=%p pc=%lx ra=%p\n",
-               current->comm, current->pid, frame, regs->ip, frame->pretcode);
-#endif
 
        return 0;
 
@@ -361,12 +339,6 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
 {
        int ret;
 
-#ifdef DEBUG_SIG
-       printk("handle_signal pid:%d sig:%lu ip:%lx sp:%lx regs=%p\n",
-               current->pid, sig,
-               regs->ip, regs->sp, regs);
-#endif
-
        /* Are we from a system call? */
        if (current_syscall(regs) >= 0) {
                /* If so, check system call restarting.. */
@@ -499,11 +471,6 @@ static void do_signal(struct pt_regs *regs)
 void do_notify_resume(struct pt_regs *regs, void *unused,
                      __u32 thread_info_flags)
 {
-#ifdef DEBUG_SIG
-       printk("do_notify_resume flags:%x ip:%lx sp:%lx caller:%p pending:%x\n",
-              thread_info_flags, regs->ip, regs->sp, __builtin_return_address(0),signal_pending(current));
-#endif
-              
        /* Pending single-step? */
        if (thread_info_flags & _TIF_SINGLESTEP) {
                regs->flags |= X86_EFLAGS_TF;