diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile index 9ce6c57747a8e67632474ff1d1a7515abc298578..193cc2b7448d7e6c08b47f1828870a61a96d414b 100644 --- a/arch/um/kernel/Makefile +++ b/arch/um/kernel/Makefile @@ -10,7 +10,7 @@ obj-y = config.o exec_kern.o exitcode.o \ init_task.o irq.o irq_user.o ksyms.o mem.o physmem.o \ process_kern.o ptrace.o reboot.o resource.o sigio_user.o sigio_kern.o \ signal_kern.o smp.o syscall_kern.o sysrq.o time.o \ - time_kern.o tlb.o trap_kern.o trap_user.o uaccess.o um_arch.o umid.o \ + time_kern.o tlb.o trap_kern.o uaccess.o um_arch.o umid.o \ user_util.o obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o diff --git a/arch/um/kernel/trap_kern.c b/arch/um/kernel/trap_kern.c index b79f805bdc00bde11dc81a3f87b0b69b845ef893..d56046c2aba2fec7799ae39df1ef8b53fdcba9f9 100644 --- a/arch/um/kernel/trap_kern.c +++ b/arch/um/kernel/trap_kern.c @@ -26,6 +26,9 @@ #include "mconsole_kern.h" #include "mem.h" #include "mem_kern.h" +#include "sysdep/sigcontext.h" +#include "sysdep/ptrace.h" +#include "os.h" #ifdef CONFIG_MODE_SKAS #include "skas.h" #endif @@ -126,6 +129,17 @@ int handle_page_fault(unsigned long address, unsigned long ip, goto out; } +void segv_handler(int sig, union uml_pt_regs *regs) +{ + struct faultinfo * fi = UPT_FAULTINFO(regs); + + if(UPT_IS_USER(regs) && !SEGV_IS_FIXABLE(fi)){ + bad_segv(*fi, UPT_IP(regs)); + return; + } + segv(*fi, UPT_IP(regs), UPT_IS_USER(regs), regs); +} + struct kern_handlers handlinfo_kern = { .relay_signal = relay_signal, .winch = winch, diff --git a/arch/um/kernel/trap_user.c b/arch/um/kernel/trap_user.c deleted file mode 100644 index 5590b5739db9f8aa29a77530c70180b6e3bd29e4..0000000000000000000000000000000000000000 --- a/arch/um/kernel/trap_user.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) - * Licensed under the GPL - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "init.h" -#include "sysdep/ptrace.h" -#include "sigcontext.h" -#include "sysdep/sigcontext.h" -#include "irq_user.h" -#include "time_user.h" -#include "task.h" -#include "mode.h" -#include "choose-mode.h" -#include "kern_util.h" -#include "user_util.h" -#include "os.h" - -void segv_handler(int sig, union uml_pt_regs *regs) -{ - struct faultinfo * fi = UPT_FAULTINFO(regs); - - if(UPT_IS_USER(regs) && !SEGV_IS_FIXABLE(fi)){ - bad_segv(*fi, UPT_IP(regs)); - return; - } - segv(*fi, UPT_IP(regs), UPT_IS_USER(regs), regs); -} - -void usr2_handler(int sig, union uml_pt_regs *regs) -{ - CHOOSE_MODE(syscall_handler_tt(sig, regs), (void) 0); -} - -void (*sig_info[NSIG])(int, union uml_pt_regs *); - -void os_fill_handlinfo(struct kern_handlers h) -{ - sig_info[SIGTRAP] = h.relay_signal; - sig_info[SIGFPE] = h.relay_signal; - sig_info[SIGILL] = h.relay_signal; - sig_info[SIGWINCH] = h.winch; - sig_info[SIGBUS] = h.bus_handler; - sig_info[SIGSEGV] = h.page_fault; - sig_info[SIGIO] = h.sigio_handler; - sig_info[SIGVTALRM] = h.timer_handler; - sig_info[SIGALRM] = h.timer_handler; - sig_info[SIGUSR2] = usr2_handler; -} diff --git a/arch/um/os-Linux/trap.c b/arch/um/os-Linux/trap.c index 6e7841c23d265d71f609f9b2ca36b67e1a9b8de9..321e1c8e227d6248463c3986a1aaf1b933dcb0c0 100644 --- a/arch/um/os-Linux/trap.c +++ b/arch/um/os-Linux/trap.c @@ -3,11 +3,34 @@ * Licensed under the GPL */ -#include +#include #include +#include #include "kern_util.h" #include "user_util.h" #include "os.h" +#include "mode.h" + +void usr2_handler(int sig, union uml_pt_regs *regs) +{ + CHOOSE_MODE(syscall_handler_tt(sig, regs), (void) 0); +} + +void (*sig_info[NSIG])(int, union uml_pt_regs *); + +void os_fill_handlinfo(struct kern_handlers h) +{ + sig_info[SIGTRAP] = h.relay_signal; + sig_info[SIGFPE] = h.relay_signal; + sig_info[SIGILL] = h.relay_signal; + sig_info[SIGWINCH] = h.winch; + sig_info[SIGBUS] = h.bus_handler; + sig_info[SIGSEGV] = h.page_fault; + sig_info[SIGIO] = h.sigio_handler; + sig_info[SIGVTALRM] = h.timer_handler; + sig_info[SIGALRM] = h.timer_handler; + sig_info[SIGUSR2] = usr2_handler; +} void do_longjmp(void *b, int val) {