2 * Copyright (C) 2002 - 2003 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
11 #include "sigcontext.h"
13 #include "ptrace_user.h"
14 #include "sysdep/ptrace.h"
15 #include "sysdep/ptrace_user.h"
18 static union uml_pt_regs ksig_regs[UM_NR_CPUS];
20 void sig_handler_common_skas(int sig, void *sc_ptr)
22 struct sigcontext *sc = sc_ptr;
24 void (*handler)(int, union uml_pt_regs *);
25 int save_user, save_errno = errno;
27 /* This is done because to allow SIGSEGV to be delivered inside a SEGV
28 * handler. This can happen in copy_user, and if SEGV is disabled,
29 * the process will die.
30 * XXX Figure out why this is better than SA_NODEFER
33 change_sig(SIGSEGV, 1);
34 /* For segfaults, we want the data from the
35 * sigcontext. In this case, we don't want to mangle
36 * the process registers, so use a static set of
37 * registers. For other signals, the process
40 r = &ksig_regs[cpu()];
43 else r = TASK_REGS(get_current());
45 save_user = r->skas.is_user;
47 if ( sig == SIGFPE || sig == SIGSEGV ||
48 sig == SIGBUS || sig == SIGILL ||
50 GET_FAULTINFO_FROM_SC(r->skas.faultinfo, sc);
53 change_sig(SIGUSR1, 1);
55 handler = sig_info[sig];
57 /* unblock SIGALRM, SIGVTALRM, SIGIO if sig isn't IRQ signal */
58 if (sig != SIGIO && sig != SIGWINCH &&
59 sig != SIGVTALRM && sig != SIGALRM)
65 r->skas.is_user = save_user;