diff options
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 | } |