aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2008-02-05 01:31:12 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-05 12:44:30 -0500
commit75ada8ffe08cef9b506a796ba6f9ce2071dcf0d7 (patch)
treeee7702a687fc3857f8c5190bca4f7c5f3c1497d2 /arch/um
parente06173bde0ec9830a296720f8cd7cb2f17b76fa4 (diff)
uml: move sig_handler_common_skas
This patch moves sig_handler_common_skas from arch/um/os-Linux/skas/trap.c to its only caller in arch/um/os-Linux/signal.c. trap.c is now empty, so it can be removed. This is code movement only - the significant cleanup needed here is done in the next patch. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um')
-rw-r--r--arch/um/include/os.h3
-rw-r--r--arch/um/os-Linux/signal.c62
-rw-r--r--arch/um/os-Linux/skas/Makefile6
-rw-r--r--arch/um/os-Linux/skas/trap.c73
4 files changed, 65 insertions, 79 deletions
diff --git a/arch/um/include/os.h b/arch/um/include/os.h
index bce2881aebd..b9779ac5e5d 100644
--- a/arch/um/include/os.h
+++ b/arch/um/include/os.h
@@ -292,9 +292,6 @@ extern int add_sigio_fd(int fd);
292extern int ignore_sigio_fd(int fd); 292extern int ignore_sigio_fd(int fd);
293extern void maybe_sigio_broken(int fd, int read); 293extern void maybe_sigio_broken(int fd, int read);
294 294
295/* skas/trap */
296extern void sig_handler_common_skas(int sig, void *sc_ptr);
297
298/* sys-x86_64/prctl.c */ 295/* sys-x86_64/prctl.c */
299extern int os_arch_prctl(int pid, int code, unsigned long *addr); 296extern int os_arch_prctl(int pid, int code, unsigned long *addr);
300 297
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c
index 62a66f38a91..cde9e766b5b 100644
--- a/arch/um/os-Linux/signal.c
+++ b/arch/um/os-Linux/signal.c
@@ -9,12 +9,74 @@
9#include <errno.h> 9#include <errno.h>
10#include <signal.h> 10#include <signal.h>
11#include <strings.h> 11#include <strings.h>
12#include "as-layout.h"
13#include "kern_constants.h"
12#include "kern_util.h" 14#include "kern_util.h"
13#include "os.h" 15#include "os.h"
14#include "sysdep/barrier.h" 16#include "sysdep/barrier.h"
15#include "sysdep/sigcontext.h" 17#include "sysdep/sigcontext.h"
18#include "task.h"
16#include "user.h" 19#include "user.h"
17 20
21void (*sig_info[NSIG])(int, struct uml_pt_regs *) = {
22 [SIGTRAP] = relay_signal,
23 [SIGFPE] = relay_signal,
24 [SIGILL] = relay_signal,
25 [SIGWINCH] = winch,
26 [SIGBUS] = bus_handler,
27 [SIGSEGV] = segv_handler,
28 [SIGIO] = sigio_handler,
29 [SIGVTALRM] = timer_handler };
30
31static struct uml_pt_regs ksig_regs[UM_NR_CPUS];
32
33void sig_handler_common_skas(int sig, void *sc_ptr)
34{
35 struct sigcontext *sc = sc_ptr;
36 struct uml_pt_regs *r;
37 void (*handler)(int, struct uml_pt_regs *);
38 int save_user, save_errno = errno;
39
40 /*
41 * This is done because to allow SIGSEGV to be delivered inside a SEGV
42 * handler. This can happen in copy_user, and if SEGV is disabled,
43 * the process will die.
44 * XXX Figure out why this is better than SA_NODEFER
45 */
46 if (sig == SIGSEGV) {
47 change_sig(SIGSEGV, 1);
48 /*
49 * For segfaults, we want the data from the
50 * sigcontext. In this case, we don't want to mangle
51 * the process registers, so use a static set of
52 * registers. For other signals, the process
53 * registers are OK.
54 */
55 r = &ksig_regs[cpu()];
56 copy_sc(r, sc_ptr);
57 } else
58 r = TASK_REGS(get_current());
59
60 save_user = r->is_user;
61 r->is_user = 0;
62 if ((sig == SIGFPE) || (sig == SIGSEGV) || (sig == SIGBUS) ||
63 (sig == SIGILL) || (sig == SIGTRAP))
64 GET_FAULTINFO_FROM_SC(r->faultinfo, sc);
65
66 change_sig(SIGUSR1, 1);
67
68 handler = sig_info[sig];
69
70 /* unblock SIGVTALRM, SIGIO if sig isn't IRQ signal */
71 if ((sig != SIGIO) && (sig != SIGWINCH) && (sig != SIGVTALRM))
72 unblock_signals();
73
74 handler(sig, r);
75
76 errno = save_errno;
77 r->is_user = save_user;
78}
79
18/* Copied from linux/compiler-gcc.h since we can't include it directly */ 80/* Copied from linux/compiler-gcc.h since we can't include it directly */
19#define barrier() __asm__ __volatile__("": : :"memory") 81#define barrier() __asm__ __volatile__("": : :"memory")
20 82
diff --git a/arch/um/os-Linux/skas/Makefile b/arch/um/os-Linux/skas/Makefile
index 5fd8d4dad66..d2ea3409e07 100644
--- a/arch/um/os-Linux/skas/Makefile
+++ b/arch/um/os-Linux/skas/Makefile
@@ -1,10 +1,10 @@
1# 1#
2# Copyright (C) 2002 - 2004 Jeff Dike (jdike@addtoit.com) 2# Copyright (C) 2002 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com)
3# Licensed under the GPL 3# Licensed under the GPL
4# 4#
5 5
6obj-y := mem.o process.o trap.o 6obj-y := mem.o process.o
7 7
8USER_OBJS := mem.o process.o trap.o 8USER_OBJS := $(obj-y)
9 9
10include arch/um/scripts/Makefile.rules 10include arch/um/scripts/Makefile.rules
diff --git a/arch/um/os-Linux/skas/trap.c b/arch/um/os-Linux/skas/trap.c
deleted file mode 100644
index a19a74f08fa..00000000000
--- a/arch/um/os-Linux/skas/trap.c
+++ /dev/null
@@ -1,73 +0,0 @@
1/*
2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#include <errno.h>
7#include <signal.h>
8#include "sysdep/ptrace.h"
9#include "kern_constants.h"
10#include "as-layout.h"
11#include "kern_util.h"
12#include "os.h"
13#include "sigcontext.h"
14#include "task.h"
15
16void (*sig_info[NSIG])(int, struct uml_pt_regs *) = {
17 [SIGTRAP] = relay_signal,
18 [SIGFPE] = relay_signal,
19 [SIGILL] = relay_signal,
20 [SIGWINCH] = winch,
21 [SIGBUS] = bus_handler,
22 [SIGSEGV] = segv_handler,
23 [SIGIO] = sigio_handler,
24 [SIGVTALRM] = timer_handler };
25
26static struct uml_pt_regs ksig_regs[UM_NR_CPUS];
27
28void sig_handler_common_skas(int sig, void *sc_ptr)
29{
30 struct sigcontext *sc = sc_ptr;
31 struct uml_pt_regs *r;
32 void (*handler)(int, struct uml_pt_regs *);
33 int save_user, save_errno = errno;
34
35 /*
36 * This is done because to allow SIGSEGV to be delivered inside a SEGV
37 * handler. This can happen in copy_user, and if SEGV is disabled,
38 * the process will die.
39 * XXX Figure out why this is better than SA_NODEFER
40 */
41 if (sig == SIGSEGV) {
42 change_sig(SIGSEGV, 1);
43 /*
44 * For segfaults, we want the data from the
45 * sigcontext. In this case, we don't want to mangle
46 * the process registers, so use a static set of
47 * registers. For other signals, the process
48 * registers are OK.
49 */
50 r = &ksig_regs[cpu()];
51 copy_sc(r, sc_ptr);
52 }
53 else r = TASK_REGS(get_current());
54
55 save_user = r->is_user;
56 r->is_user = 0;
57 if ((sig == SIGFPE) || (sig == SIGSEGV) || (sig == SIGBUS) ||
58 (sig == SIGILL) || (sig == SIGTRAP))
59 GET_FAULTINFO_FROM_SC(r->faultinfo, sc);
60
61 change_sig(SIGUSR1, 1);
62
63 handler = sig_info[sig];
64
65 /* unblock SIGVTALRM, SIGIO if sig isn't IRQ signal */
66 if ((sig != SIGIO) && (sig != SIGWINCH) && (sig != SIGVTALRM))
67 unblock_signals();
68
69 handler(sig, r);
70
71 errno = save_errno;
72 r->is_user = save_user;
73}