V4L/DVB (6926): tda18271: consolidate table lookup functions
[linux-2.6/verdex.git] / arch / um / os-Linux / skas / trap.c
blob3b1b9244f468d4a4d54808b61d5e655e54c1bcb3
1 /*
2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
6 #if 0
7 #include "kern_util.h"
8 #include "skas.h"
9 #include "ptrace_user.h"
10 #include "sysdep/ptrace_user.h"
11 #endif
13 #include <errno.h>
14 #include <signal.h>
15 #include "sysdep/ptrace.h"
16 #include "kern_constants.h"
17 #include "as-layout.h"
18 #include "os.h"
19 #include "sigcontext.h"
20 #include "task.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
37 if (sig == SIGSEGV) {
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
44 * registers are OK.
46 r = &ksig_regs[cpu()];
47 copy_sc(r, sc_ptr);
49 else r = TASK_REGS(get_current());
51 save_user = r->is_user;
52 r->is_user = 0;
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))
63 unblock_signals();
65 handler(sig, r);
67 errno = save_errno;
68 r->is_user = save_user;