]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) | |
3 | * Licensed under the GPL | |
4 | */ | |
5 | ||
6 | #include <stdlib.h> | |
7 | #include <errno.h> | |
8 | #include <setjmp.h> | |
9 | #include <signal.h> | |
10 | #include <sys/time.h> | |
11 | #include <sys/wait.h> | |
12 | #include <asm/page.h> | |
13 | #include <asm/unistd.h> | |
14 | #include <asm/ptrace.h> | |
15 | #include "init.h" | |
16 | #include "sysdep/ptrace.h" | |
17 | #include "sigcontext.h" | |
18 | #include "sysdep/sigcontext.h" | |
19 | #include "irq_user.h" | |
20 | #include "signal_user.h" | |
21 | #include "time_user.h" | |
22 | #include "task.h" | |
23 | #include "mode.h" | |
24 | #include "choose-mode.h" | |
25 | #include "kern_util.h" | |
26 | #include "user_util.h" | |
27 | #include "os.h" | |
28 | ||
29 | void kill_child_dead(int pid) | |
30 | { | |
31 | kill(pid, SIGKILL); | |
32 | kill(pid, SIGCONT); | |
33 | do { | |
34 | int n; | |
35 | CATCH_EINTR(n = waitpid(pid, NULL, 0)); | |
36 | if (n > 0) | |
37 | kill(pid, SIGCONT); | |
38 | else | |
39 | break; | |
40 | } while(1); | |
41 | } | |
42 | ||
1da177e4 LT |
43 | void segv_handler(int sig, union uml_pt_regs *regs) |
44 | { | |
c578455a | 45 | struct faultinfo * fi = UPT_FAULTINFO(regs); |
1da177e4 | 46 | |
c578455a BS |
47 | if(UPT_IS_USER(regs) && !SEGV_IS_FIXABLE(fi)){ |
48 | bad_segv(*fi, UPT_IP(regs)); | |
1da177e4 LT |
49 | return; |
50 | } | |
c578455a | 51 | segv(*fi, UPT_IP(regs), UPT_IS_USER(regs), regs); |
1da177e4 LT |
52 | } |
53 | ||
54 | void usr2_handler(int sig, union uml_pt_regs *regs) | |
55 | { | |
56 | CHOOSE_MODE(syscall_handler_tt(sig, regs), (void) 0); | |
57 | } | |
58 | ||
59 | struct signal_info sig_info[] = { | |
60 | [ SIGTRAP ] { .handler = relay_signal, | |
61 | .is_irq = 0 }, | |
62 | [ SIGFPE ] { .handler = relay_signal, | |
63 | .is_irq = 0 }, | |
64 | [ SIGILL ] { .handler = relay_signal, | |
65 | .is_irq = 0 }, | |
66 | [ SIGWINCH ] { .handler = winch, | |
67 | .is_irq = 1 }, | |
68 | [ SIGBUS ] { .handler = bus_handler, | |
69 | .is_irq = 0 }, | |
70 | [ SIGSEGV] { .handler = segv_handler, | |
71 | .is_irq = 0 }, | |
72 | [ SIGIO ] { .handler = sigio_handler, | |
73 | .is_irq = 1 }, | |
74 | [ SIGVTALRM ] { .handler = timer_handler, | |
75 | .is_irq = 1 }, | |
76 | [ SIGALRM ] { .handler = timer_handler, | |
77 | .is_irq = 1 }, | |
78 | [ SIGUSR2 ] { .handler = usr2_handler, | |
79 | .is_irq = 0 }, | |
80 | }; | |
81 | ||
82 | void do_longjmp(void *b, int val) | |
83 | { | |
84 | sigjmp_buf *buf = b; | |
85 | ||
86 | siglongjmp(*buf, val); | |
87 | } | |
88 | ||
89 | /* | |
90 | * Overrides for Emacs so that we follow Linus's tabbing style. | |
91 | * Emacs will notice this stuff at the end of the file and automatically | |
92 | * adjust the settings for this buffer only. This must remain at the end | |
93 | * of the file. | |
94 | * --------------------------------------------------------------------------- | |
95 | * Local variables: | |
96 | * c-file-style: "linux" | |
97 | * End: | |
98 | */ |