2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
13 #include <asm/unistd.h>
14 #include <asm/ptrace.h>
16 #include "sysdep/ptrace.h"
17 #include "sigcontext.h"
18 #include "sysdep/sigcontext.h"
20 #include "signal_user.h"
21 #include "time_user.h"
24 #include "choose-mode.h"
25 #include "kern_util.h"
26 #include "user_util.h"
29 void kill_child_dead(int pid
)
35 CATCH_EINTR(n
= waitpid(pid
, NULL
, 0));
43 /* Unlocked - don't care if this is a bit off */
47 unsigned long address
;
52 } segfault_record
[1024];
54 void segv_handler(int sig
, union uml_pt_regs
*regs
)
57 struct faultinfo
* fi
= UPT_FAULTINFO(regs
);
59 if(UPT_IS_USER(regs
) && !SEGV_IS_FIXABLE(fi
)){
60 bad_segv(*fi
, UPT_IP(regs
));
63 max
= sizeof(segfault_record
)/sizeof(segfault_record
[0]);
64 index
= next_trap_index(max
);
67 segfault_record
[index
].address
= FAULT_ADDRESS(*fi
);
68 segfault_record
[index
].pid
= os_getpid();
69 segfault_record
[index
].is_write
= FAULT_WRITE(*fi
);
70 segfault_record
[index
].sp
= UPT_SP(regs
);
71 segfault_record
[index
].is_user
= UPT_IS_USER(regs
);
72 segv(*fi
, UPT_IP(regs
), UPT_IS_USER(regs
), regs
);
75 void usr2_handler(int sig
, union uml_pt_regs
*regs
)
77 CHOOSE_MODE(syscall_handler_tt(sig
, regs
), (void) 0);
80 struct signal_info sig_info
[] = {
81 [ SIGTRAP
] { .handler
= relay_signal
,
83 [ SIGFPE
] { .handler
= relay_signal
,
85 [ SIGILL
] { .handler
= relay_signal
,
87 [ SIGWINCH
] { .handler
= winch
,
89 [ SIGBUS
] { .handler
= bus_handler
,
91 [ SIGSEGV
] { .handler
= segv_handler
,
93 [ SIGIO
] { .handler
= sigio_handler
,
95 [ SIGVTALRM
] { .handler
= timer_handler
,
97 [ SIGALRM
] { .handler
= timer_handler
,
99 [ SIGUSR2
] { .handler
= usr2_handler
,
103 void do_longjmp(void *b
, int val
)
107 siglongjmp(*buf
, val
);
111 * Overrides for Emacs so that we follow Linus's tabbing style.
112 * Emacs will notice this stuff at the end of the file and automatically
113 * adjust the settings for this buffer only. This must remain at the end
115 * ---------------------------------------------------------------------------
117 * c-file-style: "linux"