diff options
author | Jeff Dike <jdike@addtoit.com> | 2008-02-05 01:30:40 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-05 12:44:25 -0500 |
commit | 9226b8384776798986640ce07764d17ba66aa54f (patch) | |
tree | cffd1f6e14124729da114192aee83fe88e9f21e5 /arch/um/sys-i386/bugs.c | |
parent | 06d9bd3ad6da2422f838fd11d5d5348fa579bdb2 (diff) |
uml: further bugs.c tidying
bugs.c, for both i386 and x86_64, can undergo further cleaning -
The i386 arch_check_bugs only does one thing, so we might as
well inline the cmov checking.
The i386 includes can be trimmed down a bit.
arch_init_thread wasn't used, so it is deleted.
The panics in arch_handle_signal are turned into printks
because the process is about to get segfaulted anyway, so something is
dying no matter what happens here. Also, the return value was always
the same, so it contained no information, so it can be void instead.
The name is changed to arch_examine_signal because it doesn't handle
anything.
The caller of arch_handle_signal, relay_signal, does things in
a different order. The kernel-mode signal check is now first, which
puts everything else together, making things a bit clearer conceptually.
[akpm@linux-foundation.org: coding-style fixes]
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/sys-i386/bugs.c')
-rw-r--r-- | arch/um/sys-i386/bugs.c | 46 |
1 files changed, 20 insertions, 26 deletions
diff --git a/arch/um/sys-i386/bugs.c b/arch/um/sys-i386/bugs.c index fc991184850c..b0cb05228a97 100644 --- a/arch/um/sys-i386/bugs.c +++ b/arch/um/sys-i386/bugs.c | |||
@@ -3,14 +3,12 @@ | |||
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <errno.h> | ||
7 | #include <signal.h> | 6 | #include <signal.h> |
8 | #include <string.h> | ||
9 | #include "kern_constants.h" | 7 | #include "kern_constants.h" |
10 | #include "os.h" | 8 | #include "longjmp.h" |
11 | #include "task.h" | 9 | #include "task.h" |
12 | #include "user.h" | 10 | #include "user.h" |
13 | #include "sysdep/archsetjmp.h" | 11 | #include "sysdep/ptrace.h" |
14 | 12 | ||
15 | /* Set during early boot */ | 13 | /* Set during early boot */ |
16 | int host_has_cmov = 1; | 14 | int host_has_cmov = 1; |
@@ -22,7 +20,7 @@ static void cmov_sigill_test_handler(int sig) | |||
22 | longjmp(cmov_test_return, 1); | 20 | longjmp(cmov_test_return, 1); |
23 | } | 21 | } |
24 | 22 | ||
25 | static void test_for_host_cmov(void) | 23 | void arch_check_bugs(void) |
26 | { | 24 | { |
27 | struct sigaction old, new; | 25 | struct sigaction old, new; |
28 | 26 | ||
@@ -44,16 +42,7 @@ static void test_for_host_cmov(void) | |||
44 | sigaction(SIGILL, &old, &new); | 42 | sigaction(SIGILL, &old, &new); |
45 | } | 43 | } |
46 | 44 | ||
47 | void arch_init_thread(void) | 45 | void arch_examine_signal(int sig, struct uml_pt_regs *regs) |
48 | { | ||
49 | } | ||
50 | |||
51 | void arch_check_bugs(void) | ||
52 | { | ||
53 | test_for_host_cmov(); | ||
54 | } | ||
55 | |||
56 | int arch_handle_signal(int sig, struct uml_pt_regs *regs) | ||
57 | { | 46 | { |
58 | unsigned char tmp[2]; | 47 | unsigned char tmp[2]; |
59 | 48 | ||
@@ -62,20 +51,25 @@ int arch_handle_signal(int sig, struct uml_pt_regs *regs) | |||
62 | * SIGILL in init. | 51 | * SIGILL in init. |
63 | */ | 52 | */ |
64 | if ((sig != SIGILL) || (TASK_PID(get_current()) != 1)) | 53 | if ((sig != SIGILL) || (TASK_PID(get_current()) != 1)) |
65 | return 0; | 54 | return; |
55 | |||
56 | if (copy_from_user_proc(tmp, (void *) UPT_IP(regs), 2)) { | ||
57 | printk(UM_KERN_ERR "SIGILL in init, could not read " | ||
58 | "instructions!\n"); | ||
59 | return; | ||
60 | } | ||
66 | 61 | ||
67 | if (copy_from_user_proc(tmp, (void *) UPT_IP(regs), 2)) | ||
68 | panic("SIGILL in init, could not read instructions!\n"); | ||
69 | if ((tmp[0] != 0x0f) || ((tmp[1] & 0xf0) != 0x40)) | 62 | if ((tmp[0] != 0x0f) || ((tmp[1] & 0xf0) != 0x40)) |
70 | return 0; | 63 | return; |
71 | 64 | ||
72 | if (host_has_cmov == 0) | 65 | if (host_has_cmov == 0) |
73 | panic("SIGILL caused by cmov, which this processor doesn't " | 66 | printk(UM_KERN_ERR "SIGILL caused by cmov, which this " |
74 | "implement, boot a filesystem compiled for older " | 67 | "processor doesn't implement. Boot a filesystem " |
75 | "processors"); | 68 | "compiled for older processors"); |
76 | else if (host_has_cmov == 1) | 69 | else if (host_has_cmov == 1) |
77 | panic("SIGILL caused by cmov, which this processor claims to " | 70 | printk(UM_KERN_ERR "SIGILL caused by cmov, which this " |
78 | "implement"); | 71 | "processor claims to implement"); |
79 | else panic("Bad value for host_has_cmov (%d)", host_has_cmov); | 72 | else |
80 | return 0; | 73 | printk(UM_KERN_ERR "Bad value for host_has_cmov (%d)", |
74 | host_has_cmov); | ||
81 | } | 75 | } |