diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/um/kernel/skas/trap_user.c |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'arch/um/kernel/skas/trap_user.c')
-rw-r--r-- | arch/um/kernel/skas/trap_user.c | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/arch/um/kernel/skas/trap_user.c b/arch/um/kernel/skas/trap_user.c new file mode 100644 index 000000000000..8e9b46d4702e --- /dev/null +++ b/arch/um/kernel/skas/trap_user.c | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 - 2003 Jeff Dike (jdike@addtoit.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
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" | ||
14 | |||
15 | void sig_handler_common_skas(int sig, void *sc_ptr) | ||
16 | { | ||
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; | ||
22 | |||
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 | ||
27 | */ | ||
28 | if(sig == SIGSEGV) | ||
29 | change_sig(SIGSEGV, 1); | ||
30 | |||
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); | ||
37 | |||
38 | change_sig(SIGUSR1, 1); | ||
39 | info = &sig_info[sig]; | ||
40 | if(!info->is_irq) unblock_signals(); | ||
41 | |||
42 | (*info->handler)(sig, (union uml_pt_regs *) r); | ||
43 | |||
44 | errno = save_errno; | ||
45 | r->is_user = save_user; | ||
46 | } | ||
47 | |||
48 | void user_signal(int sig, union uml_pt_regs *regs) | ||
49 | { | ||
50 | struct signal_info *info; | ||
51 | |||
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); | ||
58 | |||
59 | unblock_signals(); | ||
60 | } | ||
61 | |||
62 | /* | ||
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: | ||
71 | */ | ||