2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
9 #include "ptrace_user.h"
10 #include "sysdep/ptrace_user.h"
15 #include "sysdep/ptrace.h"
16 #include "kern_constants.h"
17 #include "as-layout.h"
19 #include "sigcontext.h"
22 static struct uml_pt_regs ksig_regs
[UM_NR_CPUS
];
24 void sig_handler_common_skas(int sig
, void *sc_ptr
)
26 struct sigcontext
*sc
= sc_ptr
;
27 struct uml_pt_regs
*r
;
28 void (*handler
)(int, struct uml_pt_regs
*);
29 int save_user
, save_errno
= errno
;
32 * This is done because to allow SIGSEGV to be delivered inside a SEGV
33 * handler. This can happen in copy_user, and if SEGV is disabled,
34 * the process will die.
35 * XXX Figure out why this is better than SA_NODEFER
38 change_sig(SIGSEGV
, 1);
40 * For segfaults, we want the data from the
41 * sigcontext. In this case, we don't want to mangle
42 * the process registers, so use a static set of
43 * registers. For other signals, the process
46 r
= &ksig_regs
[cpu()];
49 else r
= TASK_REGS(get_current());
51 save_user
= r
->is_user
;
53 if ((sig
== SIGFPE
) || (sig
== SIGSEGV
) || (sig
== SIGBUS
) ||
54 (sig
== SIGILL
) || (sig
== SIGTRAP
))
55 GET_FAULTINFO_FROM_SC(r
->faultinfo
, sc
);
57 change_sig(SIGUSR1
, 1);
59 handler
= sig_info
[sig
];
61 /* unblock SIGVTALRM, SIGIO if sig isn't IRQ signal */
62 if ((sig
!= SIGIO
) && (sig
!= SIGWINCH
) && (sig
!= SIGVTALRM
))
68 r
->is_user
= save_user
;