Commit 7eb12255 authored by Al Viro's avatar Al Viro Committed by Richard Weinberger

um: merge hard_handler() instances, switch to use of SA_SIGINFO

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent 5d40de0f
...@@ -127,7 +127,7 @@ void set_sigstack(void *sig_stack, int size) ...@@ -127,7 +127,7 @@ void set_sigstack(void *sig_stack, int size)
static void (*handlers[_NSIG])(int sig, struct sigcontext *sc); 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; unsigned long pending = 1UL << sig;
...@@ -168,7 +168,11 @@ void handle_signal(int sig, struct sigcontext *sc) ...@@ -168,7 +168,11 @@ void handle_signal(int sig, struct sigcontext *sc)
} while (pending); } 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, ...) void set_handler(int sig, void (*handler)(int), int flags, ...)
{ {
...@@ -178,7 +182,7 @@ void set_handler(int sig, void (*handler)(int), int flags, ...) ...@@ -178,7 +182,7 @@ void set_handler(int sig, void (*handler)(int), int flags, ...)
int mask; int mask;
handlers[sig] = (void (*)(int, struct sigcontext *)) handler; handlers[sig] = (void (*)(int, struct sigcontext *)) handler;
action.sa_handler = hard_handler; action.sa_sigaction = hard_handler;
sigemptyset(&action.sa_mask); sigemptyset(&action.sa_mask);
...@@ -190,7 +194,7 @@ void set_handler(int sig, void (*handler)(int), int flags, ...) ...@@ -190,7 +194,7 @@ void set_handler(int sig, void (*handler)(int), int flags, ...)
if (sig == SIGSEGV) if (sig == SIGSEGV)
flags |= SA_NODEFER; flags |= SA_NODEFER;
action.sa_flags = flags; action.sa_flags = flags | SA_SIGINFO;
action.sa_restorer = NULL; action.sa_restorer = NULL;
if (sigaction(sig, &action, NULL) < 0) if (sigaction(sig, &action, NULL) < 0)
panic("sigaction failed - errno = %d\n", errno); panic("sigaction failed - errno = %d\n", errno);
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# Licensed under the GPL # Licensed under the GPL
# #
obj-y = registers.o signal.o task_size.o tls.o obj-y = registers.o task_size.o tls.o
USER_OBJS := $(obj-y) USER_OBJS := $(obj-y)
......
/*
* 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));
}
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# Licensed under the GPL # Licensed under the GPL
# #
obj-y = registers.o prctl.o signal.o task_size.o obj-y = registers.o prctl.o task_size.o
USER_OBJS := $(obj-y) USER_OBJS := $(obj-y)
......
/*
* 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);
}
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