static void (*handlers[_NSIG])(int sig, struct sigcontext *sc);
 
-void handle_signal(int sig, struct sigcontext *sc)
+static void handle_signal(int sig, struct sigcontext *sc)
 {
        unsigned long pending = 1UL << sig;
 
        } while (pending);
 }
 
-extern void hard_handler(int sig);
+static void hard_handler(int sig, siginfo_t *info, void *p)
+{
+       struct ucontext *uc = p;
+       handle_signal(sig, (struct sigcontext *) &uc->uc_mcontext);
+}
 
 void set_handler(int sig, void (*handler)(int), int flags, ...)
 {
        int mask;
 
        handlers[sig] = (void (*)(int, struct sigcontext *)) handler;
-       action.sa_handler = hard_handler;
+       action.sa_sigaction = hard_handler;
 
        sigemptyset(&action.sa_mask);
 
        if (sig == SIGSEGV)
                flags |= SA_NODEFER;
 
-       action.sa_flags = flags;
+       action.sa_flags = flags | SA_SIGINFO;
        action.sa_restorer = NULL;
        if (sigaction(sig, &action, NULL) < 0)
                panic("sigaction failed - errno = %d\n", errno);
 
+++ /dev/null
-/*
- * Copyright (C) 2006 Jeff Dike (jdike@{addtoit,linux.intel}.com)
- * Licensed under the GPL
- */
-
-#include <signal.h>
-
-extern void handle_signal(int sig, struct sigcontext *sc);
-
-void hard_handler(int sig)
-{
-       handle_signal(sig, (struct sigcontext *) (&sig + 1));
-}
 
+++ /dev/null
-/*
- * Copyright (C) 2006 Jeff Dike (jdike@{addtoit,linux.intel}.com)
- * Licensed under the GPL
- */
-
-#include <signal.h>
-
-extern void handle_signal(int sig, struct sigcontext *sc);
-
-void hard_handler(int sig)
-{
-       struct ucontext *uc;
-       asm("movq %%rdx, %0" : "=r" (uc));
-
-       handle_signal(sig, (struct sigcontext *) &uc->uc_mcontext);
-}