blob: 5590b5739db9f8aa29a77530c70180b6e3bd29e4 [file] [log] [blame]
Gennady Sharapovea2ba7d2006-01-08 01:01:31 -08001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * 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"
Linus Torvalds1da177e2005-04-16 15:20:36 -070020#include "time_user.h"
21#include "task.h"
22#include "mode.h"
23#include "choose-mode.h"
24#include "kern_util.h"
25#include "user_util.h"
26#include "os.h"
27
Linus Torvalds1da177e2005-04-16 15:20:36 -070028void segv_handler(int sig, union uml_pt_regs *regs)
29{
Bodo Stroesserc5784552005-05-05 16:15:31 -070030 struct faultinfo * fi = UPT_FAULTINFO(regs);
Linus Torvalds1da177e2005-04-16 15:20:36 -070031
Bodo Stroesserc5784552005-05-05 16:15:31 -070032 if(UPT_IS_USER(regs) && !SEGV_IS_FIXABLE(fi)){
33 bad_segv(*fi, UPT_IP(regs));
Linus Torvalds1da177e2005-04-16 15:20:36 -070034 return;
35 }
Bodo Stroesserc5784552005-05-05 16:15:31 -070036 segv(*fi, UPT_IP(regs), UPT_IS_USER(regs), regs);
Linus Torvalds1da177e2005-04-16 15:20:36 -070037}
38
39void usr2_handler(int sig, union uml_pt_regs *regs)
40{
41 CHOOSE_MODE(syscall_handler_tt(sig, regs), (void) 0);
42}
43
Gennady Sharapovea2ba7d2006-01-08 01:01:31 -080044void (*sig_info[NSIG])(int, union uml_pt_regs *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070045
Gennady Sharapovea2ba7d2006-01-08 01:01:31 -080046void os_fill_handlinfo(struct kern_handlers h)
Linus Torvalds1da177e2005-04-16 15:20:36 -070047{
Gennady Sharapovea2ba7d2006-01-08 01:01:31 -080048 sig_info[SIGTRAP] = h.relay_signal;
49 sig_info[SIGFPE] = h.relay_signal;
50 sig_info[SIGILL] = h.relay_signal;
51 sig_info[SIGWINCH] = h.winch;
52 sig_info[SIGBUS] = h.bus_handler;
53 sig_info[SIGSEGV] = h.page_fault;
54 sig_info[SIGIO] = h.sigio_handler;
55 sig_info[SIGVTALRM] = h.timer_handler;
56 sig_info[SIGALRM] = h.timer_handler;
57 sig_info[SIGUSR2] = usr2_handler;
Linus Torvalds1da177e2005-04-16 15:20:36 -070058}