[IPV4]: Correct rp_filter help text.
[linux-2.6/verdex.git] / arch / um / os-Linux / skas / trap.c
blob3b600c2e63b85ed81ba89b6bd990f664dc97bb37
1 /*
2 * Copyright (C) 2002 - 2003 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
4 */
6 #include <signal.h>
7 #include <errno.h>
8 #include "kern_util.h"
9 #include "as-layout.h"
10 #include "task.h"
11 #include "sigcontext.h"
12 #include "skas.h"
13 #include "ptrace_user.h"
14 #include "sysdep/ptrace.h"
15 #include "sysdep/ptrace_user.h"
16 #include "os.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;
23 union uml_pt_regs *r;
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
32 if(sig == SIGSEGV) {
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
38 * registers are OK.
40 r = &ksig_regs[cpu()];
41 copy_sc(r, sc_ptr);
43 else r = TASK_REGS(get_current());
45 save_user = r->skas.is_user;
46 r->skas.is_user = 0;
47 if ( sig == SIGFPE || sig == SIGSEGV ||
48 sig == SIGBUS || sig == SIGILL ||
49 sig == SIGTRAP ) {
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)
60 unblock_signals();
62 handler(sig, r);
64 errno = save_errno;
65 r->skas.is_user = save_user;