diff options
Diffstat (limited to 'arch/um/kernel')
-rw-r--r-- | arch/um/kernel/Makefile | 4 | ||||
-rw-r--r-- | arch/um/kernel/irq_user.c | 1 | ||||
-rw-r--r-- | arch/um/kernel/process_kern.c | 1 | ||||
-rw-r--r-- | arch/um/kernel/reboot.c | 2 | ||||
-rw-r--r-- | arch/um/kernel/signal_kern.c | 1 | ||||
-rw-r--r-- | arch/um/kernel/signal_user.c | 157 | ||||
-rw-r--r-- | arch/um/kernel/skas/Makefile | 2 | ||||
-rw-r--r-- | arch/um/kernel/skas/include/skas.h | 1 | ||||
-rw-r--r-- | arch/um/kernel/skas/process.c | 11 | ||||
-rw-r--r-- | arch/um/kernel/skas/process_kern.c | 1 | ||||
-rw-r--r-- | arch/um/kernel/skas/trap_user.c | 78 | ||||
-rw-r--r-- | arch/um/kernel/time.c | 2 | ||||
-rw-r--r-- | arch/um/kernel/trap_kern.c | 25 | ||||
-rw-r--r-- | arch/um/kernel/trap_user.c | 98 | ||||
-rw-r--r-- | arch/um/kernel/tt/exec_kern.c | 1 | ||||
-rw-r--r-- | arch/um/kernel/tt/process_kern.c | 1 | ||||
-rw-r--r-- | arch/um/kernel/tt/tracer.c | 1 | ||||
-rw-r--r-- | arch/um/kernel/tt/trap_user.c | 16 | ||||
-rw-r--r-- | arch/um/kernel/um_arch.c | 7 |
19 files changed, 46 insertions, 364 deletions
diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile index 6f7700593a6f..193cc2b7448d 100644 --- a/arch/um/kernel/Makefile +++ b/arch/um/kernel/Makefile | |||
@@ -9,8 +9,8 @@ clean-files := | |||
9 | obj-y = config.o exec_kern.o exitcode.o \ | 9 | 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 signal_user.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 | ||
16 | obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o | 16 | obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o |
diff --git a/arch/um/kernel/irq_user.c b/arch/um/kernel/irq_user.c index 50a2aa35cda9..0e32f5f4a887 100644 --- a/arch/um/kernel/irq_user.c +++ b/arch/um/kernel/irq_user.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include "kern_util.h" | 15 | #include "kern_util.h" |
16 | #include "user.h" | 16 | #include "user.h" |
17 | #include "process.h" | 17 | #include "process.h" |
18 | #include "signal_user.h" | ||
19 | #include "sigio.h" | 18 | #include "sigio.h" |
20 | #include "irq_user.h" | 19 | #include "irq_user.h" |
21 | #include "os.h" | 20 | #include "os.h" |
diff --git a/arch/um/kernel/process_kern.c b/arch/um/kernel/process_kern.c index 651abf255bc5..d2d3f256778c 100644 --- a/arch/um/kernel/process_kern.c +++ b/arch/um/kernel/process_kern.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include "kern_util.h" | 36 | #include "kern_util.h" |
37 | #include "kern.h" | 37 | #include "kern.h" |
38 | #include "signal_kern.h" | 38 | #include "signal_kern.h" |
39 | #include "signal_user.h" | ||
40 | #include "init.h" | 39 | #include "init.h" |
41 | #include "irq_user.h" | 40 | #include "irq_user.h" |
42 | #include "mem_user.h" | 41 | #include "mem_user.h" |
diff --git a/arch/um/kernel/reboot.c b/arch/um/kernel/reboot.c index a637e885c583..6f1a3a288117 100644 --- a/arch/um/kernel/reboot.c +++ b/arch/um/kernel/reboot.c | |||
@@ -12,6 +12,8 @@ | |||
12 | #include "mode.h" | 12 | #include "mode.h" |
13 | #include "choose-mode.h" | 13 | #include "choose-mode.h" |
14 | 14 | ||
15 | void (*pm_power_off)(void); | ||
16 | |||
15 | #ifdef CONFIG_SMP | 17 | #ifdef CONFIG_SMP |
16 | static void kill_idlers(int me) | 18 | static void kill_idlers(int me) |
17 | { | 19 | { |
diff --git a/arch/um/kernel/signal_kern.c b/arch/um/kernel/signal_kern.c index 03618bd13d55..7b0e0e81c161 100644 --- a/arch/um/kernel/signal_kern.c +++ b/arch/um/kernel/signal_kern.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include "asm/ucontext.h" | 22 | #include "asm/ucontext.h" |
23 | #include "kern_util.h" | 23 | #include "kern_util.h" |
24 | #include "signal_kern.h" | 24 | #include "signal_kern.h" |
25 | #include "signal_user.h" | ||
26 | #include "kern.h" | 25 | #include "kern.h" |
27 | #include "frame_kern.h" | 26 | #include "frame_kern.h" |
28 | #include "sigcontext.h" | 27 | #include "sigcontext.h" |
diff --git a/arch/um/kernel/signal_user.c b/arch/um/kernel/signal_user.c deleted file mode 100644 index 62f457835fb1..000000000000 --- a/arch/um/kernel/signal_user.c +++ /dev/null | |||
@@ -1,157 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #include <stdio.h> | ||
7 | #include <unistd.h> | ||
8 | #include <stdlib.h> | ||
9 | #include <signal.h> | ||
10 | #include <errno.h> | ||
11 | #include <stdarg.h> | ||
12 | #include <string.h> | ||
13 | #include <sys/mman.h> | ||
14 | #include "user_util.h" | ||
15 | #include "kern_util.h" | ||
16 | #include "user.h" | ||
17 | #include "signal_user.h" | ||
18 | #include "signal_kern.h" | ||
19 | #include "sysdep/sigcontext.h" | ||
20 | #include "sigcontext.h" | ||
21 | |||
22 | void set_sigstack(void *sig_stack, int size) | ||
23 | { | ||
24 | stack_t stack = ((stack_t) { .ss_flags = 0, | ||
25 | .ss_sp = (__ptr_t) sig_stack, | ||
26 | .ss_size = size - sizeof(void *) }); | ||
27 | |||
28 | if(sigaltstack(&stack, NULL) != 0) | ||
29 | panic("enabling signal stack failed, errno = %d\n", errno); | ||
30 | } | ||
31 | |||
32 | void set_handler(int sig, void (*handler)(int), int flags, ...) | ||
33 | { | ||
34 | struct sigaction action; | ||
35 | va_list ap; | ||
36 | int mask; | ||
37 | |||
38 | va_start(ap, flags); | ||
39 | action.sa_handler = handler; | ||
40 | sigemptyset(&action.sa_mask); | ||
41 | while((mask = va_arg(ap, int)) != -1){ | ||
42 | sigaddset(&action.sa_mask, mask); | ||
43 | } | ||
44 | va_end(ap); | ||
45 | action.sa_flags = flags; | ||
46 | action.sa_restorer = NULL; | ||
47 | if(sigaction(sig, &action, NULL) < 0) | ||
48 | panic("sigaction failed"); | ||
49 | } | ||
50 | |||
51 | int change_sig(int signal, int on) | ||
52 | { | ||
53 | sigset_t sigset, old; | ||
54 | |||
55 | sigemptyset(&sigset); | ||
56 | sigaddset(&sigset, signal); | ||
57 | sigprocmask(on ? SIG_UNBLOCK : SIG_BLOCK, &sigset, &old); | ||
58 | return(!sigismember(&old, signal)); | ||
59 | } | ||
60 | |||
61 | /* Both here and in set/get_signal we don't touch SIGPROF, because we must not | ||
62 | * disable profiling; it's safe because the profiling code does not interact | ||
63 | * with the kernel code at all.*/ | ||
64 | |||
65 | static void change_signals(int type) | ||
66 | { | ||
67 | sigset_t mask; | ||
68 | |||
69 | sigemptyset(&mask); | ||
70 | sigaddset(&mask, SIGVTALRM); | ||
71 | sigaddset(&mask, SIGALRM); | ||
72 | sigaddset(&mask, SIGIO); | ||
73 | if(sigprocmask(type, &mask, NULL) < 0) | ||
74 | panic("Failed to change signal mask - errno = %d", errno); | ||
75 | } | ||
76 | |||
77 | void block_signals(void) | ||
78 | { | ||
79 | change_signals(SIG_BLOCK); | ||
80 | } | ||
81 | |||
82 | void unblock_signals(void) | ||
83 | { | ||
84 | change_signals(SIG_UNBLOCK); | ||
85 | } | ||
86 | |||
87 | /* These are the asynchronous signals. SIGVTALRM and SIGARLM are handled | ||
88 | * together under SIGVTALRM_BIT. SIGPROF is excluded because we want to | ||
89 | * be able to profile all of UML, not just the non-critical sections. If | ||
90 | * profiling is not thread-safe, then that is not my problem. We can disable | ||
91 | * profiling when SMP is enabled in that case. | ||
92 | */ | ||
93 | #define SIGIO_BIT 0 | ||
94 | #define SIGVTALRM_BIT 1 | ||
95 | |||
96 | static int enable_mask(sigset_t *mask) | ||
97 | { | ||
98 | int sigs; | ||
99 | |||
100 | sigs = sigismember(mask, SIGIO) ? 0 : 1 << SIGIO_BIT; | ||
101 | sigs |= sigismember(mask, SIGVTALRM) ? 0 : 1 << SIGVTALRM_BIT; | ||
102 | sigs |= sigismember(mask, SIGALRM) ? 0 : 1 << SIGVTALRM_BIT; | ||
103 | return(sigs); | ||
104 | } | ||
105 | |||
106 | int get_signals(void) | ||
107 | { | ||
108 | sigset_t mask; | ||
109 | |||
110 | if(sigprocmask(SIG_SETMASK, NULL, &mask) < 0) | ||
111 | panic("Failed to get signal mask"); | ||
112 | return(enable_mask(&mask)); | ||
113 | } | ||
114 | |||
115 | int set_signals(int enable) | ||
116 | { | ||
117 | sigset_t mask; | ||
118 | int ret; | ||
119 | |||
120 | sigemptyset(&mask); | ||
121 | if(enable & (1 << SIGIO_BIT)) | ||
122 | sigaddset(&mask, SIGIO); | ||
123 | if(enable & (1 << SIGVTALRM_BIT)){ | ||
124 | sigaddset(&mask, SIGVTALRM); | ||
125 | sigaddset(&mask, SIGALRM); | ||
126 | } | ||
127 | |||
128 | /* This is safe - sigprocmask is guaranteed to copy locally the | ||
129 | * value of new_set, do his work and then, at the end, write to | ||
130 | * old_set. | ||
131 | */ | ||
132 | if(sigprocmask(SIG_UNBLOCK, &mask, &mask) < 0) | ||
133 | panic("Failed to enable signals"); | ||
134 | ret = enable_mask(&mask); | ||
135 | sigemptyset(&mask); | ||
136 | if((enable & (1 << SIGIO_BIT)) == 0) | ||
137 | sigaddset(&mask, SIGIO); | ||
138 | if((enable & (1 << SIGVTALRM_BIT)) == 0){ | ||
139 | sigaddset(&mask, SIGVTALRM); | ||
140 | sigaddset(&mask, SIGALRM); | ||
141 | } | ||
142 | if(sigprocmask(SIG_BLOCK, &mask, NULL) < 0) | ||
143 | panic("Failed to block signals"); | ||
144 | |||
145 | return(ret); | ||
146 | } | ||
147 | |||
148 | /* | ||
149 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
150 | * Emacs will notice this stuff at the end of the file and automatically | ||
151 | * adjust the settings for this buffer only. This must remain at the end | ||
152 | * of the file. | ||
153 | * --------------------------------------------------------------------------- | ||
154 | * Local variables: | ||
155 | * c-file-style: "linux" | ||
156 | * End: | ||
157 | */ | ||
diff --git a/arch/um/kernel/skas/Makefile b/arch/um/kernel/skas/Makefile index 8de471b59c1c..7a9fc16d71d4 100644 --- a/arch/um/kernel/skas/Makefile +++ b/arch/um/kernel/skas/Makefile | |||
@@ -4,7 +4,7 @@ | |||
4 | # | 4 | # |
5 | 5 | ||
6 | obj-y := clone.o exec_kern.o mem.o mem_user.o mmu.o process.o process_kern.o \ | 6 | obj-y := clone.o exec_kern.o mem.o mem_user.o mmu.o process.o process_kern.o \ |
7 | syscall.o tlb.o trap_user.o uaccess.o | 7 | syscall.o tlb.o uaccess.o |
8 | 8 | ||
9 | USER_OBJS := process.o clone.o | 9 | USER_OBJS := process.o clone.o |
10 | 10 | ||
diff --git a/arch/um/kernel/skas/include/skas.h b/arch/um/kernel/skas/include/skas.h index daa2f85b684c..01d489de3986 100644 --- a/arch/um/kernel/skas/include/skas.h +++ b/arch/um/kernel/skas/include/skas.h | |||
@@ -22,7 +22,6 @@ extern int start_idle_thread(void *stack, void *switch_buf_ptr, | |||
22 | extern int user_thread(unsigned long stack, int flags); | 22 | extern int user_thread(unsigned long stack, int flags); |
23 | extern void userspace(union uml_pt_regs *regs); | 23 | extern void userspace(union uml_pt_regs *regs); |
24 | extern void new_thread_proc(void *stack, void (*handler)(int sig)); | 24 | extern void new_thread_proc(void *stack, void (*handler)(int sig)); |
25 | extern void remove_sigstack(void); | ||
26 | extern void new_thread_handler(int sig); | 25 | extern void new_thread_handler(int sig); |
27 | extern void handle_syscall(union uml_pt_regs *regs); | 26 | extern void handle_syscall(union uml_pt_regs *regs); |
28 | extern int map(struct mm_id * mm_idp, unsigned long virt, | 27 | extern int map(struct mm_id * mm_idp, unsigned long virt, |
diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c index 599d679bd4fc..9264d4021dfe 100644 --- a/arch/um/kernel/skas/process.c +++ b/arch/um/kernel/skas/process.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include "proc_mm.h" | 31 | #include "proc_mm.h" |
32 | #include "skas_ptrace.h" | 32 | #include "skas_ptrace.h" |
33 | #include "chan_user.h" | 33 | #include "chan_user.h" |
34 | #include "signal_user.h" | ||
35 | #include "registers.h" | 34 | #include "registers.h" |
36 | #include "mem.h" | 35 | #include "mem.h" |
37 | #include "uml-config.h" | 36 | #include "uml-config.h" |
@@ -514,16 +513,6 @@ int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr) | |||
514 | siglongjmp(**switch_buf, 1); | 513 | siglongjmp(**switch_buf, 1); |
515 | } | 514 | } |
516 | 515 | ||
517 | void remove_sigstack(void) | ||
518 | { | ||
519 | stack_t stack = ((stack_t) { .ss_flags = SS_DISABLE, | ||
520 | .ss_sp = NULL, | ||
521 | .ss_size = 0 }); | ||
522 | |||
523 | if(sigaltstack(&stack, NULL) != 0) | ||
524 | panic("disabling signal stack failed, errno = %d\n", errno); | ||
525 | } | ||
526 | |||
527 | void initial_thread_cb_skas(void (*proc)(void *), void *arg) | 516 | void initial_thread_cb_skas(void (*proc)(void *), void *arg) |
528 | { | 517 | { |
529 | sigjmp_buf here; | 518 | sigjmp_buf here; |
diff --git a/arch/um/kernel/skas/process_kern.c b/arch/um/kernel/skas/process_kern.c index 9c990253966c..09790ccb161c 100644 --- a/arch/um/kernel/skas/process_kern.c +++ b/arch/um/kernel/skas/process_kern.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #include "asm/atomic.h" | 14 | #include "asm/atomic.h" |
15 | #include "kern_util.h" | 15 | #include "kern_util.h" |
16 | #include "time_user.h" | 16 | #include "time_user.h" |
17 | #include "signal_user.h" | ||
18 | #include "skas.h" | 17 | #include "skas.h" |
19 | #include "os.h" | 18 | #include "os.h" |
20 | #include "user_util.h" | 19 | #include "user_util.h" |
diff --git a/arch/um/kernel/skas/trap_user.c b/arch/um/kernel/skas/trap_user.c deleted file mode 100644 index 9950a6716fe5..000000000000 --- a/arch/um/kernel/skas/trap_user.c +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 - 2003 Jeff Dike (jdike@addtoit.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #include <signal.h> | ||
7 | #include <errno.h> | ||
8 | #include "signal_user.h" | ||
9 | #include "user_util.h" | ||
10 | #include "kern_util.h" | ||
11 | #include "task.h" | ||
12 | #include "sigcontext.h" | ||
13 | #include "skas.h" | ||
14 | #include "ptrace_user.h" | ||
15 | #include "sysdep/ptrace.h" | ||
16 | #include "sysdep/ptrace_user.h" | ||
17 | |||
18 | void sig_handler_common_skas(int sig, void *sc_ptr) | ||
19 | { | ||
20 | struct sigcontext *sc = sc_ptr; | ||
21 | struct skas_regs *r; | ||
22 | struct signal_info *info; | ||
23 | int save_errno = errno; | ||
24 | int save_user; | ||
25 | |||
26 | /* This is done because to allow SIGSEGV to be delivered inside a SEGV | ||
27 | * handler. This can happen in copy_user, and if SEGV is disabled, | ||
28 | * the process will die. | ||
29 | * XXX Figure out why this is better than SA_NODEFER | ||
30 | */ | ||
31 | if(sig == SIGSEGV) | ||
32 | change_sig(SIGSEGV, 1); | ||
33 | |||
34 | r = &TASK_REGS(get_current())->skas; | ||
35 | save_user = r->is_user; | ||
36 | r->is_user = 0; | ||
37 | if ( sig == SIGFPE || sig == SIGSEGV || | ||
38 | sig == SIGBUS || sig == SIGILL || | ||
39 | sig == SIGTRAP ) { | ||
40 | GET_FAULTINFO_FROM_SC(r->faultinfo, sc); | ||
41 | } | ||
42 | |||
43 | change_sig(SIGUSR1, 1); | ||
44 | info = &sig_info[sig]; | ||
45 | if(!info->is_irq) unblock_signals(); | ||
46 | |||
47 | (*info->handler)(sig, (union uml_pt_regs *) r); | ||
48 | |||
49 | errno = save_errno; | ||
50 | r->is_user = save_user; | ||
51 | } | ||
52 | |||
53 | extern int ptrace_faultinfo; | ||
54 | |||
55 | void user_signal(int sig, union uml_pt_regs *regs, int pid) | ||
56 | { | ||
57 | struct signal_info *info; | ||
58 | int segv = ((sig == SIGFPE) || (sig == SIGSEGV) || (sig == SIGBUS) || | ||
59 | (sig == SIGILL) || (sig == SIGTRAP)); | ||
60 | |||
61 | if (segv) | ||
62 | get_skas_faultinfo(pid, ®s->skas.faultinfo); | ||
63 | info = &sig_info[sig]; | ||
64 | (*info->handler)(sig, regs); | ||
65 | |||
66 | unblock_signals(); | ||
67 | } | ||
68 | |||
69 | /* | ||
70 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
71 | * Emacs will notice this stuff at the end of the file and automatically | ||
72 | * adjust the settings for this buffer only. This must remain at the end | ||
73 | * of the file. | ||
74 | * --------------------------------------------------------------------------- | ||
75 | * Local variables: | ||
76 | * c-file-style: "linux" | ||
77 | * End: | ||
78 | */ | ||
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c index c40b611e3d93..11f518a7e156 100644 --- a/arch/um/kernel/time.c +++ b/arch/um/kernel/time.c | |||
@@ -14,9 +14,9 @@ | |||
14 | #include "kern_util.h" | 14 | #include "kern_util.h" |
15 | #include "user.h" | 15 | #include "user.h" |
16 | #include "process.h" | 16 | #include "process.h" |
17 | #include "signal_user.h" | ||
18 | #include "time_user.h" | 17 | #include "time_user.h" |
19 | #include "kern_constants.h" | 18 | #include "kern_constants.h" |
19 | #include "os.h" | ||
20 | 20 | ||
21 | /* XXX This really needs to be declared and initialized in a kernel file since | 21 | /* XXX This really needs to be declared and initialized in a kernel file since |
22 | * it's in <linux/time.h> | 22 | * it's in <linux/time.h> |
diff --git a/arch/um/kernel/trap_kern.c b/arch/um/kernel/trap_kern.c index 0d4c10a73607..d56046c2aba2 100644 --- a/arch/um/kernel/trap_kern.c +++ b/arch/um/kernel/trap_kern.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com) | 2 | * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com) |
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
@@ -26,9 +26,13 @@ | |||
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 |
35 | #include "os.h" | ||
32 | 36 | ||
33 | /* Note this is constrained to return 0, -EFAULT, -EACCESS, -ENOMEM by segv(). */ | 37 | /* Note this is constrained to return 0, -EFAULT, -EACCESS, -ENOMEM by segv(). */ |
34 | int handle_page_fault(unsigned long address, unsigned long ip, | 38 | int handle_page_fault(unsigned long address, unsigned long ip, |
@@ -125,6 +129,25 @@ out_of_memory: | |||
125 | goto out; | 129 | goto out; |
126 | } | 130 | } |
127 | 131 | ||
132 | void 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 | |||
143 | struct kern_handlers handlinfo_kern = { | ||
144 | .relay_signal = relay_signal, | ||
145 | .winch = winch, | ||
146 | .bus_handler = relay_signal, | ||
147 | .page_fault = segv_handler, | ||
148 | .sigio_handler = sigio_handler, | ||
149 | .timer_handler = timer_handler | ||
150 | }; | ||
128 | /* | 151 | /* |
129 | * We give a *copy* of the faultinfo in the regs to segv. | 152 | * We give a *copy* of the faultinfo in the regs to segv. |
130 | * This must be done, since nesting SEGVs could overwrite | 153 | * This must be done, since nesting SEGVs could overwrite |
diff --git a/arch/um/kernel/trap_user.c b/arch/um/kernel/trap_user.c deleted file mode 100644 index e9ccd6b8d3c7..000000000000 --- a/arch/um/kernel/trap_user.c +++ /dev/null | |||
@@ -1,98 +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 "signal_user.h" | ||
21 | #include "time_user.h" | ||
22 | #include "task.h" | ||
23 | #include "mode.h" | ||
24 | #include "choose-mode.h" | ||
25 | #include "kern_util.h" | ||
26 | #include "user_util.h" | ||
27 | #include "os.h" | ||
28 | |||
29 | void kill_child_dead(int pid) | ||
30 | { | ||
31 | kill(pid, SIGKILL); | ||
32 | kill(pid, SIGCONT); | ||
33 | do { | ||
34 | int n; | ||
35 | CATCH_EINTR(n = waitpid(pid, NULL, 0)); | ||
36 | if (n > 0) | ||
37 | kill(pid, SIGCONT); | ||
38 | else | ||
39 | break; | ||
40 | } while(1); | ||
41 | } | ||
42 | |||
43 | void segv_handler(int sig, union uml_pt_regs *regs) | ||
44 | { | ||
45 | struct faultinfo * fi = UPT_FAULTINFO(regs); | ||
46 | |||
47 | if(UPT_IS_USER(regs) && !SEGV_IS_FIXABLE(fi)){ | ||
48 | bad_segv(*fi, UPT_IP(regs)); | ||
49 | return; | ||
50 | } | ||
51 | segv(*fi, UPT_IP(regs), UPT_IS_USER(regs), regs); | ||
52 | } | ||
53 | |||
54 | void usr2_handler(int sig, union uml_pt_regs *regs) | ||
55 | { | ||
56 | CHOOSE_MODE(syscall_handler_tt(sig, regs), (void) 0); | ||
57 | } | ||
58 | |||
59 | struct signal_info sig_info[] = { | ||
60 | [ SIGTRAP ] { .handler = relay_signal, | ||
61 | .is_irq = 0 }, | ||
62 | [ SIGFPE ] { .handler = relay_signal, | ||
63 | .is_irq = 0 }, | ||
64 | [ SIGILL ] { .handler = relay_signal, | ||
65 | .is_irq = 0 }, | ||
66 | [ SIGWINCH ] { .handler = winch, | ||
67 | .is_irq = 1 }, | ||
68 | [ SIGBUS ] { .handler = bus_handler, | ||
69 | .is_irq = 0 }, | ||
70 | [ SIGSEGV] { .handler = segv_handler, | ||
71 | .is_irq = 0 }, | ||
72 | [ SIGIO ] { .handler = sigio_handler, | ||
73 | .is_irq = 1 }, | ||
74 | [ SIGVTALRM ] { .handler = timer_handler, | ||
75 | .is_irq = 1 }, | ||
76 | [ SIGALRM ] { .handler = timer_handler, | ||
77 | .is_irq = 1 }, | ||
78 | [ SIGUSR2 ] { .handler = usr2_handler, | ||
79 | .is_irq = 0 }, | ||
80 | }; | ||
81 | |||
82 | void do_longjmp(void *b, int val) | ||
83 | { | ||
84 | sigjmp_buf *buf = b; | ||
85 | |||
86 | siglongjmp(*buf, val); | ||
87 | } | ||
88 | |||
89 | /* | ||
90 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
91 | * Emacs will notice this stuff at the end of the file and automatically | ||
92 | * adjust the settings for this buffer only. This must remain at the end | ||
93 | * of the file. | ||
94 | * --------------------------------------------------------------------------- | ||
95 | * Local variables: | ||
96 | * c-file-style: "linux" | ||
97 | * End: | ||
98 | */ | ||
diff --git a/arch/um/kernel/tt/exec_kern.c b/arch/um/kernel/tt/exec_kern.c index 065b504a653b..136e54c47d37 100644 --- a/arch/um/kernel/tt/exec_kern.c +++ b/arch/um/kernel/tt/exec_kern.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #include "kern_util.h" | 14 | #include "kern_util.h" |
15 | #include "irq_user.h" | 15 | #include "irq_user.h" |
16 | #include "time_user.h" | 16 | #include "time_user.h" |
17 | #include "signal_user.h" | ||
18 | #include "mem_user.h" | 17 | #include "mem_user.h" |
19 | #include "os.h" | 18 | #include "os.h" |
20 | #include "tlb.h" | 19 | #include "tlb.h" |
diff --git a/arch/um/kernel/tt/process_kern.c b/arch/um/kernel/tt/process_kern.c index cfaa373a6e77..14d4622a5fb8 100644 --- a/arch/um/kernel/tt/process_kern.c +++ b/arch/um/kernel/tt/process_kern.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include "asm/ptrace.h" | 13 | #include "asm/ptrace.h" |
14 | #include "asm/tlbflush.h" | 14 | #include "asm/tlbflush.h" |
15 | #include "irq_user.h" | 15 | #include "irq_user.h" |
16 | #include "signal_user.h" | ||
17 | #include "kern_util.h" | 16 | #include "kern_util.h" |
18 | #include "user_util.h" | 17 | #include "user_util.h" |
19 | #include "os.h" | 18 | #include "os.h" |
diff --git a/arch/um/kernel/tt/tracer.c b/arch/um/kernel/tt/tracer.c index d11e7399d7a1..71daae24e48a 100644 --- a/arch/um/kernel/tt/tracer.c +++ b/arch/um/kernel/tt/tracer.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include "sigcontext.h" | 19 | #include "sigcontext.h" |
20 | #include "sysdep/sigcontext.h" | 20 | #include "sysdep/sigcontext.h" |
21 | #include "os.h" | 21 | #include "os.h" |
22 | #include "signal_user.h" | ||
23 | #include "user_util.h" | 22 | #include "user_util.h" |
24 | #include "mem_user.h" | 23 | #include "mem_user.h" |
25 | #include "process.h" | 24 | #include "process.h" |
diff --git a/arch/um/kernel/tt/trap_user.c b/arch/um/kernel/tt/trap_user.c index fc108615beaf..a414c529fbcd 100644 --- a/arch/um/kernel/tt/trap_user.c +++ b/arch/um/kernel/tt/trap_user.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | 2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) |
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
@@ -8,18 +8,18 @@ | |||
8 | #include <signal.h> | 8 | #include <signal.h> |
9 | #include "sysdep/ptrace.h" | 9 | #include "sysdep/ptrace.h" |
10 | #include "sysdep/sigcontext.h" | 10 | #include "sysdep/sigcontext.h" |
11 | #include "signal_user.h" | ||
12 | #include "user_util.h" | 11 | #include "user_util.h" |
13 | #include "kern_util.h" | 12 | #include "kern_util.h" |
14 | #include "task.h" | 13 | #include "task.h" |
15 | #include "tt.h" | 14 | #include "tt.h" |
15 | #include "os.h" | ||
16 | 16 | ||
17 | void sig_handler_common_tt(int sig, void *sc_ptr) | 17 | void sig_handler_common_tt(int sig, void *sc_ptr) |
18 | { | 18 | { |
19 | struct sigcontext *sc = sc_ptr; | 19 | struct sigcontext *sc = sc_ptr; |
20 | struct tt_regs save_regs, *r; | 20 | struct tt_regs save_regs, *r; |
21 | struct signal_info *info; | ||
22 | int save_errno = errno, is_user; | 21 | int save_errno = errno, is_user; |
22 | void (*handler)(int, union uml_pt_regs *); | ||
23 | 23 | ||
24 | /* This is done because to allow SIGSEGV to be delivered inside a SEGV | 24 | /* This is done because to allow SIGSEGV to be delivered inside a SEGV |
25 | * handler. This can happen in copy_user, and if SEGV is disabled, | 25 | * handler. This can happen in copy_user, and if SEGV is disabled, |
@@ -40,10 +40,14 @@ void sig_handler_common_tt(int sig, void *sc_ptr) | |||
40 | if(sig != SIGUSR2) | 40 | if(sig != SIGUSR2) |
41 | r->syscall = -1; | 41 | r->syscall = -1; |
42 | 42 | ||
43 | info = &sig_info[sig]; | 43 | handler = sig_info[sig]; |
44 | if(!info->is_irq) unblock_signals(); | 44 | |
45 | /* unblock SIGALRM, SIGVTALRM, SIGIO if sig isn't IRQ signal */ | ||
46 | if (sig != SIGIO && sig != SIGWINCH && | ||
47 | sig != SIGVTALRM && sig != SIGALRM) | ||
48 | unblock_signals(); | ||
45 | 49 | ||
46 | (*info->handler)(sig, (union uml_pt_regs *) r); | 50 | handler(sig, (union uml_pt_regs *) r); |
47 | 51 | ||
48 | if(is_user){ | 52 | if(is_user){ |
49 | interrupt_end(); | 53 | interrupt_end(); |
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index 26626b2b9172..73747ac19774 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2000, 2002 Jeff Dike (jdike@karaya.com) | 2 | * Copyright (C) 2000, 2002 Jeff Dike (jdike@karaya.com) |
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
@@ -363,6 +363,11 @@ int linux_main(int argc, char **argv) | |||
363 | uml_start = CHOOSE_MODE_PROC(set_task_sizes_tt, set_task_sizes_skas, 0, | 363 | uml_start = CHOOSE_MODE_PROC(set_task_sizes_tt, set_task_sizes_skas, 0, |
364 | &host_task_size, &task_size); | 364 | &host_task_size, &task_size); |
365 | 365 | ||
366 | /* | ||
367 | * Setting up handlers to 'sig_info' struct | ||
368 | */ | ||
369 | os_fill_handlinfo(handlinfo_kern); | ||
370 | |||
366 | brk_start = (unsigned long) sbrk(0); | 371 | brk_start = (unsigned long) sbrk(0); |
367 | CHOOSE_MODE_PROC(before_mem_tt, before_mem_skas, brk_start); | 372 | CHOOSE_MODE_PROC(before_mem_tt, before_mem_skas, brk_start); |
368 | /* Increase physical memory size for exec-shield users | 373 | /* Increase physical memory size for exec-shield users |