Linux-2.6.12-rc2
[linux-2.6/kvm.git] / arch / um / kernel / skas / trap_user.c
blob8e9b46d4702ecec7bf46b92a5092fcd7c4cca2be
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 "sysdep/ptrace.h"
9 #include "signal_user.h"
10 #include "user_util.h"
11 #include "kern_util.h"
12 #include "task.h"
13 #include "sigcontext.h"
15 void sig_handler_common_skas(int sig, void *sc_ptr)
17 struct sigcontext *sc = sc_ptr;
18 struct skas_regs *r;
19 struct signal_info *info;
20 int save_errno = errno;
21 int save_user;
23 /* This is done because to allow SIGSEGV to be delivered inside a SEGV
24 * handler. This can happen in copy_user, and if SEGV is disabled,
25 * the process will die.
26 * XXX Figure out why this is better than SA_NODEFER
28 if(sig == SIGSEGV)
29 change_sig(SIGSEGV, 1);
31 r = &TASK_REGS(get_current())->skas;
32 save_user = r->is_user;
33 r->is_user = 0;
34 r->fault_addr = SC_FAULT_ADDR(sc);
35 r->fault_type = SC_FAULT_TYPE(sc);
36 r->trap_type = SC_TRAP_TYPE(sc);
38 change_sig(SIGUSR1, 1);
39 info = &sig_info[sig];
40 if(!info->is_irq) unblock_signals();
42 (*info->handler)(sig, (union uml_pt_regs *) r);
44 errno = save_errno;
45 r->is_user = save_user;
48 void user_signal(int sig, union uml_pt_regs *regs)
50 struct signal_info *info;
52 regs->skas.is_user = 1;
53 regs->skas.fault_addr = 0;
54 regs->skas.fault_type = 0;
55 regs->skas.trap_type = 0;
56 info = &sig_info[sig];
57 (*info->handler)(sig, regs);
59 unblock_signals();
63 * Overrides for Emacs so that we follow Linus's tabbing style.
64 * Emacs will notice this stuff at the end of the file and automatically
65 * adjust the settings for this buffer only. This must remain at the end
66 * of the file.
67 * ---------------------------------------------------------------------------
68 * Local variables:
69 * c-file-style: "linux"
70 * End: