aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/um/kernel/Makefile2
-rw-r--r--arch/um/kernel/trap_kern.c14
-rw-r--r--arch/um/kernel/trap_user.c58
-rw-r--r--arch/um/os-Linux/trap.c25
4 files changed, 39 insertions, 60 deletions
diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile
index 9ce6c57747a8..193cc2b7448d 100644
--- a/arch/um/kernel/Makefile
+++ b/arch/um/kernel/Makefile
@@ -10,7 +10,7 @@ obj-y = config.o exec_kern.o exitcode.o \
10 init_task.o irq.o irq_user.o ksyms.o mem.o physmem.o \ 10 init_task.o irq.o irq_user.o ksyms.o mem.o physmem.o \
11 process_kern.o ptrace.o reboot.o resource.o sigio_user.o sigio_kern.o \ 11 process_kern.o ptrace.o reboot.o resource.o sigio_user.o sigio_kern.o \
12 signal_kern.o smp.o syscall_kern.o sysrq.o time.o \ 12 signal_kern.o smp.o syscall_kern.o sysrq.o time.o \
13 time_kern.o tlb.o trap_kern.o trap_user.o uaccess.o um_arch.o umid.o \ 13 time_kern.o tlb.o trap_kern.o uaccess.o um_arch.o umid.o \
14 user_util.o 14 user_util.o
15 15
16obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o 16obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o
diff --git a/arch/um/kernel/trap_kern.c b/arch/um/kernel/trap_kern.c
index b79f805bdc00..d56046c2aba2 100644
--- a/arch/um/kernel/trap_kern.c
+++ b/arch/um/kernel/trap_kern.c
@@ -26,6 +26,9 @@
26#include "mconsole_kern.h" 26#include "mconsole_kern.h"
27#include "mem.h" 27#include "mem.h"
28#include "mem_kern.h" 28#include "mem_kern.h"
29#include "sysdep/sigcontext.h"
30#include "sysdep/ptrace.h"
31#include "os.h"
29#ifdef CONFIG_MODE_SKAS 32#ifdef CONFIG_MODE_SKAS
30#include "skas.h" 33#include "skas.h"
31#endif 34#endif
@@ -126,6 +129,17 @@ out_of_memory:
126 goto out; 129 goto out;
127} 130}
128 131
132void segv_handler(int sig, union uml_pt_regs *regs)
133{
134 struct faultinfo * fi = UPT_FAULTINFO(regs);
135
136 if(UPT_IS_USER(regs) && !SEGV_IS_FIXABLE(fi)){
137 bad_segv(*fi, UPT_IP(regs));
138 return;
139 }
140 segv(*fi, UPT_IP(regs), UPT_IS_USER(regs), regs);
141}
142
129struct kern_handlers handlinfo_kern = { 143struct kern_handlers handlinfo_kern = {
130 .relay_signal = relay_signal, 144 .relay_signal = relay_signal,
131 .winch = winch, 145 .winch = winch,
diff --git a/arch/um/kernel/trap_user.c b/arch/um/kernel/trap_user.c
deleted file mode 100644
index 5590b5739db9..000000000000
--- a/arch/um/kernel/trap_user.c
+++ /dev/null
@@ -1,58 +0,0 @@
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 "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
28void segv_handler(int sig, union uml_pt_regs *regs)
29{
30 struct faultinfo * fi = UPT_FAULTINFO(regs);
31
32 if(UPT_IS_USER(regs) && !SEGV_IS_FIXABLE(fi)){
33 bad_segv(*fi, UPT_IP(regs));
34 return;
35 }
36 segv(*fi, UPT_IP(regs), UPT_IS_USER(regs), regs);
37}
38
39void usr2_handler(int sig, union uml_pt_regs *regs)
40{
41 CHOOSE_MODE(syscall_handler_tt(sig, regs), (void) 0);
42}
43
44void (*sig_info[NSIG])(int, union uml_pt_regs *);
45
46void os_fill_handlinfo(struct kern_handlers h)
47{
48 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;
58}
diff --git a/arch/um/os-Linux/trap.c b/arch/um/os-Linux/trap.c
index 6e7841c23d26..321e1c8e227d 100644
--- a/arch/um/os-Linux/trap.c
+++ b/arch/um/os-Linux/trap.c
@@ -3,11 +3,34 @@
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <setjmp.h> 6#include <stdlib.h>
7#include <signal.h> 7#include <signal.h>
8#include <setjmp.h>
8#include "kern_util.h" 9#include "kern_util.h"
9#include "user_util.h" 10#include "user_util.h"
10#include "os.h" 11#include "os.h"
12#include "mode.h"
13
14void usr2_handler(int sig, union uml_pt_regs *regs)
15{
16 CHOOSE_MODE(syscall_handler_tt(sig, regs), (void) 0);
17}
18
19void (*sig_info[NSIG])(int, union uml_pt_regs *);
20
21void os_fill_handlinfo(struct kern_handlers h)
22{
23 sig_info[SIGTRAP] = h.relay_signal;
24 sig_info[SIGFPE] = h.relay_signal;
25 sig_info[SIGILL] = h.relay_signal;
26 sig_info[SIGWINCH] = h.winch;
27 sig_info[SIGBUS] = h.bus_handler;
28 sig_info[SIGSEGV] = h.page_fault;
29 sig_info[SIGIO] = h.sigio_handler;
30 sig_info[SIGVTALRM] = h.timer_handler;
31 sig_info[SIGALRM] = h.timer_handler;
32 sig_info[SIGUSR2] = usr2_handler;
33}
11 34
12void do_longjmp(void *b, int val) 35void do_longjmp(void *b, int val)
13{ 36{