2 * Copyright (C) 2002 - 2003 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
10 #include "as-layout.h"
12 #include "sigcontext.h"
14 #include "ptrace_user.h"
15 #include "sysdep/ptrace.h"
16 #include "sysdep/ptrace_user.h"
19 void sig_handler_common_skas(int sig, void *sc_ptr)
21 struct sigcontext *sc = sc_ptr;
23 void (*handler)(int, union uml_pt_regs *);
24 int 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);
35 r = &TASK_REGS(get_current())->skas;
36 save_user = r->is_user;
38 if ( sig == SIGFPE || sig == SIGSEGV ||
39 sig == SIGBUS || sig == SIGILL ||
41 GET_FAULTINFO_FROM_SC(r->faultinfo, sc);
44 change_sig(SIGUSR1, 1);
46 handler = sig_info[sig];
48 /* unblock SIGALRM, SIGVTALRM, SIGIO if sig isn't IRQ signal */
49 if (sig != SIGIO && sig != SIGWINCH &&
50 sig != SIGVTALRM && sig != SIGALRM)
53 handler(sig, (union uml_pt_regs *) r);
56 r->is_user = save_user;
59 extern int ptrace_faultinfo;
61 void user_signal(int sig, union uml_pt_regs *regs, int pid)
63 void (*handler)(int, union uml_pt_regs *);
64 int segv = ((sig == SIGFPE) || (sig == SIGSEGV) || (sig == SIGBUS) ||
65 (sig == SIGILL) || (sig == SIGTRAP));
68 get_skas_faultinfo(pid, ®s->skas.faultinfo);
70 handler = sig_info[sig];
71 handler(sig, (union uml_pt_regs *) regs);