2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
11 #include <sys/ptrace.h>
14 #include <asm/unistd.h>
15 #include <asm/ptrace.h>
17 #include "sysdep/ptrace.h"
18 #include "sigcontext.h"
19 #include "sysdep/sigcontext.h"
21 #include "signal_user.h"
22 #include "time_user.h"
25 #include "choose-mode.h"
26 #include "kern_util.h"
27 #include "user_util.h"
30 void kill_child_dead(int pid)
36 CATCH_EINTR(n = waitpid(pid, NULL, 0));
44 /* Unlocked - don't care if this is a bit off */
48 unsigned long address;
53 } segfault_record[1024];
55 void segv_handler(int sig, union uml_pt_regs *regs)
59 if(UPT_IS_USER(regs) && !UPT_SEGV_IS_FIXABLE(regs)){
60 bad_segv(UPT_FAULT_ADDR(regs), UPT_IP(regs),
61 UPT_FAULT_WRITE(regs));
64 max = sizeof(segfault_record)/sizeof(segfault_record[0]);
65 index = next_trap_index(max);
68 segfault_record[index].address = UPT_FAULT_ADDR(regs);
69 segfault_record[index].pid = os_getpid();
70 segfault_record[index].is_write = UPT_FAULT_WRITE(regs);
71 segfault_record[index].sp = UPT_SP(regs);
72 segfault_record[index].is_user = UPT_IS_USER(regs);
73 segv(UPT_FAULT_ADDR(regs), UPT_IP(regs), UPT_FAULT_WRITE(regs),
74 UPT_IS_USER(regs), regs);
77 void usr2_handler(int sig, union uml_pt_regs *regs)
79 CHOOSE_MODE(syscall_handler_tt(sig, regs), (void) 0);
82 struct signal_info sig_info[] = {
83 [ SIGTRAP ] { .handler = relay_signal,
85 [ SIGFPE ] { .handler = relay_signal,
87 [ SIGILL ] { .handler = relay_signal,
89 [ SIGWINCH ] { .handler = winch,
91 [ SIGBUS ] { .handler = bus_handler,
93 [ SIGSEGV] { .handler = segv_handler,
95 [ SIGIO ] { .handler = sigio_handler,
97 [ SIGVTALRM ] { .handler = timer_handler,
99 [ SIGALRM ] { .handler = timer_handler,
101 [ SIGUSR2 ] { .handler = usr2_handler,
105 void do_longjmp(void *b, int val)
109 siglongjmp(*buf, val);
113 * Overrides for Emacs so that we follow Linus's tabbing style.
114 * Emacs will notice this stuff at the end of the file and automatically
115 * adjust the settings for this buffer only. This must remain at the end
117 * ---------------------------------------------------------------------------
119 * c-file-style: "linux"