diff options
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/Kconfig.debug | 4 | ||||
-rw-r--r-- | arch/um/drivers/random.c | 16 | ||||
-rw-r--r-- | arch/um/drivers/ssl.c | 1 | ||||
-rw-r--r-- | arch/um/drivers/stdio_console.c | 1 | ||||
-rw-r--r-- | arch/um/drivers/ubd_kern.c | 7 | ||||
-rw-r--r-- | arch/um/include/2_5compat.h | 24 | ||||
-rw-r--r-- | arch/um/include/sysrq.h | 3 | ||||
-rw-r--r-- | arch/um/kernel/exec_kern.c | 1 | ||||
-rw-r--r-- | arch/um/kernel/initrd_kern.c | 59 | ||||
-rw-r--r-- | arch/um/kernel/initrd_user.c | 46 | ||||
-rw-r--r-- | arch/um/kernel/main.c | 40 | ||||
-rw-r--r-- | arch/um/kernel/process_kern.c | 36 | ||||
-rw-r--r-- | arch/um/kernel/ptrace.c | 19 | ||||
-rw-r--r-- | arch/um/kernel/sysrq.c | 21 | ||||
-rw-r--r-- | arch/um/kernel/trap_kern.c | 1 | ||||
-rw-r--r-- | arch/um/kernel/tt/process_kern.c | 8 | ||||
-rw-r--r-- | arch/um/kernel/um_arch.c | 6 | ||||
-rw-r--r-- | arch/um/sys-i386/sysrq.c | 80 | ||||
-rw-r--r-- | arch/um/sys-ppc/sysrq.c | 14 | ||||
-rw-r--r-- | arch/um/sys-x86_64/syscalls.c | 16 | ||||
-rw-r--r-- | arch/um/sys-x86_64/sysrq.c | 11 |
21 files changed, 146 insertions, 268 deletions
diff --git a/arch/um/Kconfig.debug b/arch/um/Kconfig.debug index b89989de364d..bd41e4286d0d 100644 --- a/arch/um/Kconfig.debug +++ b/arch/um/Kconfig.debug | |||
@@ -2,10 +2,6 @@ menu "Kernel hacking" | |||
2 | 2 | ||
3 | source "lib/Kconfig.debug" | 3 | source "lib/Kconfig.debug" |
4 | 4 | ||
5 | config FRAME_POINTER | ||
6 | bool | ||
7 | default y if DEBUG_INFO | ||
8 | |||
9 | config PT_PROXY | 5 | config PT_PROXY |
10 | bool "Enable ptrace proxy" | 6 | bool "Enable ptrace proxy" |
11 | depends on XTERM_CHAN && DEBUG_INFO && MODE_TT | 7 | depends on XTERM_CHAN && DEBUG_INFO && MODE_TT |
diff --git a/arch/um/drivers/random.c b/arch/um/drivers/random.c index d43e9fab05a7..f9e22198e011 100644 --- a/arch/um/drivers/random.c +++ b/arch/um/drivers/random.c | |||
@@ -1,5 +1,10 @@ | |||
1 | /* Much of this ripped from hw_random.c */ | 1 | /* Copyright (C) 2005 Jeff Dike <jdike@addtoit.com> */ |
2 | 2 | /* Much of this ripped from drivers/char/hw_random.c, see there for other | |
3 | * copyright. | ||
4 | * | ||
5 | * This software may be used and distributed according to the terms | ||
6 | * of the GNU General Public License, incorporated herein by reference. | ||
7 | */ | ||
3 | #include <linux/module.h> | 8 | #include <linux/module.h> |
4 | #include <linux/fs.h> | 9 | #include <linux/fs.h> |
5 | #include <linux/miscdevice.h> | 10 | #include <linux/miscdevice.h> |
@@ -12,8 +17,6 @@ | |||
12 | */ | 17 | */ |
13 | #define RNG_VERSION "1.0.0" | 18 | #define RNG_VERSION "1.0.0" |
14 | #define RNG_MODULE_NAME "random" | 19 | #define RNG_MODULE_NAME "random" |
15 | #define RNG_DRIVER_NAME RNG_MODULE_NAME " virtual driver " RNG_VERSION | ||
16 | #define PFX RNG_MODULE_NAME ": " | ||
17 | 20 | ||
18 | #define RNG_MISCDEV_MINOR 183 /* official */ | 21 | #define RNG_MISCDEV_MINOR 183 /* official */ |
19 | 22 | ||
@@ -98,7 +101,7 @@ static int __init rng_init (void) | |||
98 | 101 | ||
99 | err = misc_register (&rng_miscdev); | 102 | err = misc_register (&rng_miscdev); |
100 | if (err) { | 103 | if (err) { |
101 | printk (KERN_ERR PFX "misc device register failed\n"); | 104 | printk (KERN_ERR RNG_MODULE_NAME ": misc device register failed\n"); |
102 | goto err_out_cleanup_hw; | 105 | goto err_out_cleanup_hw; |
103 | } | 106 | } |
104 | 107 | ||
@@ -120,3 +123,6 @@ static void __exit rng_cleanup (void) | |||
120 | 123 | ||
121 | module_init (rng_init); | 124 | module_init (rng_init); |
122 | module_exit (rng_cleanup); | 125 | module_exit (rng_cleanup); |
126 | |||
127 | MODULE_DESCRIPTION("UML Host Random Number Generator (RNG) driver"); | ||
128 | MODULE_LICENSE("GPL"); | ||
diff --git a/arch/um/drivers/ssl.c b/arch/um/drivers/ssl.c index a2bac429f3d4..b32a77010fbe 100644 --- a/arch/um/drivers/ssl.c +++ b/arch/um/drivers/ssl.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include "init.h" | 22 | #include "init.h" |
23 | #include "irq_user.h" | 23 | #include "irq_user.h" |
24 | #include "mconsole_kern.h" | 24 | #include "mconsole_kern.h" |
25 | #include "2_5compat.h" | ||
26 | 25 | ||
27 | static int ssl_version = 1; | 26 | static int ssl_version = 1; |
28 | 27 | ||
diff --git a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c index 361d0be342b3..afbe1e71ed83 100644 --- a/arch/um/drivers/stdio_console.c +++ b/arch/um/drivers/stdio_console.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include "irq_user.h" | 28 | #include "irq_user.h" |
29 | #include "mconsole_kern.h" | 29 | #include "mconsole_kern.h" |
30 | #include "init.h" | 30 | #include "init.h" |
31 | #include "2_5compat.h" | ||
32 | 31 | ||
33 | #define MAX_TTYS (16) | 32 | #define MAX_TTYS (16) |
34 | 33 | ||
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index 88f956c34fed..2a7f6892c55c 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c | |||
@@ -49,7 +49,6 @@ | |||
49 | #include "irq_user.h" | 49 | #include "irq_user.h" |
50 | #include "irq_kern.h" | 50 | #include "irq_kern.h" |
51 | #include "ubd_user.h" | 51 | #include "ubd_user.h" |
52 | #include "2_5compat.h" | ||
53 | #include "os.h" | 52 | #include "os.h" |
54 | #include "mem.h" | 53 | #include "mem.h" |
55 | #include "mem_kern.h" | 54 | #include "mem_kern.h" |
@@ -440,9 +439,9 @@ static int udb_setup(char *str) | |||
440 | __setup("udb", udb_setup); | 439 | __setup("udb", udb_setup); |
441 | __uml_help(udb_setup, | 440 | __uml_help(udb_setup, |
442 | "udb\n" | 441 | "udb\n" |
443 | " This option is here solely to catch ubd -> udb typos, which can be\n\n" | 442 | " This option is here solely to catch ubd -> udb typos, which can be\n" |
444 | " to impossible to catch visually unless you specifically look for\n\n" | 443 | " to impossible to catch visually unless you specifically look for\n" |
445 | " them. The only result of any option starting with 'udb' is an error\n\n" | 444 | " them. The only result of any option starting with 'udb' is an error\n" |
446 | " in the boot output.\n\n" | 445 | " in the boot output.\n\n" |
447 | ); | 446 | ); |
448 | 447 | ||
diff --git a/arch/um/include/2_5compat.h b/arch/um/include/2_5compat.h deleted file mode 100644 index abdb015a4d71..000000000000 --- a/arch/um/include/2_5compat.h +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2001 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __2_5_COMPAT_H__ | ||
7 | #define __2_5_COMPAT_H__ | ||
8 | |||
9 | #define INIT_HARDSECT(arr, maj, sizes) | ||
10 | |||
11 | #define SET_PRI(task) do ; while(0) | ||
12 | |||
13 | #endif | ||
14 | |||
15 | /* | ||
16 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
17 | * Emacs will notice this stuff at the end of the file and automatically | ||
18 | * adjust the settings for this buffer only. This must remain at the end | ||
19 | * of the file. | ||
20 | * --------------------------------------------------------------------------- | ||
21 | * Local variables: | ||
22 | * c-file-style: "linux" | ||
23 | * End: | ||
24 | */ | ||
diff --git a/arch/um/include/sysrq.h b/arch/um/include/sysrq.h index 2ce9423460b3..c8d332b56b98 100644 --- a/arch/um/include/sysrq.h +++ b/arch/um/include/sysrq.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef __UM_SYSRQ_H | 1 | #ifndef __UM_SYSRQ_H |
2 | #define __UM_SYSRQ_H | 2 | #define __UM_SYSRQ_H |
3 | 3 | ||
4 | extern void show_trace(unsigned long *stack); | 4 | struct task_struct; |
5 | extern void show_trace(struct task_struct* task, unsigned long *stack); | ||
5 | 6 | ||
6 | #endif | 7 | #endif |
diff --git a/arch/um/kernel/exec_kern.c b/arch/um/kernel/exec_kern.c index 49ddabe69be7..efd222ffe20e 100644 --- a/arch/um/kernel/exec_kern.c +++ b/arch/um/kernel/exec_kern.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include "kern.h" | 16 | #include "kern.h" |
17 | #include "irq_user.h" | 17 | #include "irq_user.h" |
18 | #include "tlb.h" | 18 | #include "tlb.h" |
19 | #include "2_5compat.h" | ||
20 | #include "os.h" | 19 | #include "os.h" |
21 | #include "time_user.h" | 20 | #include "time_user.h" |
22 | #include "choose-mode.h" | 21 | #include "choose-mode.h" |
diff --git a/arch/um/kernel/initrd_kern.c b/arch/um/kernel/initrd_kern.c deleted file mode 100644 index fc568af468b9..000000000000 --- a/arch/um/kernel/initrd_kern.c +++ /dev/null | |||
@@ -1,59 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #include "linux/init.h" | ||
7 | #include "linux/bootmem.h" | ||
8 | #include "linux/initrd.h" | ||
9 | #include "asm/types.h" | ||
10 | #include "user_util.h" | ||
11 | #include "kern_util.h" | ||
12 | #include "initrd.h" | ||
13 | #include "init.h" | ||
14 | #include "os.h" | ||
15 | |||
16 | /* Changed by uml_initrd_setup, which is a setup */ | ||
17 | static char *initrd __initdata = NULL; | ||
18 | |||
19 | static int __init read_initrd(void) | ||
20 | { | ||
21 | void *area; | ||
22 | long long size; | ||
23 | int err; | ||
24 | |||
25 | if(initrd == NULL) return 0; | ||
26 | err = os_file_size(initrd, &size); | ||
27 | if(err) return 0; | ||
28 | area = alloc_bootmem(size); | ||
29 | if(area == NULL) return 0; | ||
30 | if(load_initrd(initrd, area, size) == -1) return 0; | ||
31 | initrd_start = (unsigned long) area; | ||
32 | initrd_end = initrd_start + size; | ||
33 | return 0; | ||
34 | } | ||
35 | |||
36 | __uml_postsetup(read_initrd); | ||
37 | |||
38 | static int __init uml_initrd_setup(char *line, int *add) | ||
39 | { | ||
40 | initrd = line; | ||
41 | return 0; | ||
42 | } | ||
43 | |||
44 | __uml_setup("initrd=", uml_initrd_setup, | ||
45 | "initrd=<initrd image>\n" | ||
46 | " This is used to boot UML from an initrd image. The argument is the\n" | ||
47 | " name of the file containing the image.\n\n" | ||
48 | ); | ||
49 | |||
50 | /* | ||
51 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
52 | * Emacs will notice this stuff at the end of the file and automatically | ||
53 | * adjust the settings for this buffer only. This must remain at the end | ||
54 | * of the file. | ||
55 | * --------------------------------------------------------------------------- | ||
56 | * Local variables: | ||
57 | * c-file-style: "linux" | ||
58 | * End: | ||
59 | */ | ||
diff --git a/arch/um/kernel/initrd_user.c b/arch/um/kernel/initrd_user.c deleted file mode 100644 index cb90681e151c..000000000000 --- a/arch/um/kernel/initrd_user.c +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #include <unistd.h> | ||
7 | #include <sys/types.h> | ||
8 | #include <sys/stat.h> | ||
9 | #include <errno.h> | ||
10 | |||
11 | #include "user_util.h" | ||
12 | #include "kern_util.h" | ||
13 | #include "user.h" | ||
14 | #include "initrd.h" | ||
15 | #include "os.h" | ||
16 | |||
17 | int load_initrd(char *filename, void *buf, int size) | ||
18 | { | ||
19 | int fd, n; | ||
20 | |||
21 | fd = os_open_file(filename, of_read(OPENFLAGS()), 0); | ||
22 | if(fd < 0){ | ||
23 | printk("Opening '%s' failed - err = %d\n", filename, -fd); | ||
24 | return(-1); | ||
25 | } | ||
26 | n = os_read_file(fd, buf, size); | ||
27 | if(n != size){ | ||
28 | printk("Read of %d bytes from '%s' failed, err = %d\n", size, | ||
29 | filename, -n); | ||
30 | return(-1); | ||
31 | } | ||
32 | |||
33 | os_close_file(fd); | ||
34 | return(0); | ||
35 | } | ||
36 | |||
37 | /* | ||
38 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
39 | * Emacs will notice this stuff at the end of the file and automatically | ||
40 | * adjust the settings for this buffer only. This must remain at the end | ||
41 | * of the file. | ||
42 | * --------------------------------------------------------------------------- | ||
43 | * Local variables: | ||
44 | * c-file-style: "linux" | ||
45 | * End: | ||
46 | */ | ||
diff --git a/arch/um/kernel/main.c b/arch/um/kernel/main.c index a17c49703f9b..e42e6364ca13 100644 --- a/arch/um/kernel/main.c +++ b/arch/um/kernel/main.c | |||
@@ -71,7 +71,7 @@ static __init void do_uml_initcalls(void) | |||
71 | 71 | ||
72 | static void last_ditch_exit(int sig) | 72 | static void last_ditch_exit(int sig) |
73 | { | 73 | { |
74 | CHOOSE_MODE(kmalloc_ok = 0, (void) 0); | 74 | kmalloc_ok = 0; |
75 | signal(SIGINT, SIG_DFL); | 75 | signal(SIGINT, SIG_DFL); |
76 | signal(SIGTERM, SIG_DFL); | 76 | signal(SIGTERM, SIG_DFL); |
77 | signal(SIGHUP, SIG_DFL); | 77 | signal(SIGHUP, SIG_DFL); |
@@ -87,7 +87,7 @@ int main(int argc, char **argv, char **envp) | |||
87 | { | 87 | { |
88 | char **new_argv; | 88 | char **new_argv; |
89 | sigset_t mask; | 89 | sigset_t mask; |
90 | int ret, i; | 90 | int ret, i, err; |
91 | 91 | ||
92 | /* Enable all signals except SIGIO - in some environments, we can | 92 | /* Enable all signals except SIGIO - in some environments, we can |
93 | * enter with some signals blocked | 93 | * enter with some signals blocked |
@@ -160,27 +160,29 @@ int main(int argc, char **argv, char **envp) | |||
160 | */ | 160 | */ |
161 | change_sig(SIGPROF, 0); | 161 | change_sig(SIGPROF, 0); |
162 | 162 | ||
163 | /* Reboot */ | 163 | /* This signal stuff used to be in the reboot case. However, |
164 | if(ret){ | 164 | * sometimes a SIGVTALRM can come in when we're halting (reproducably |
165 | int err; | 165 | * when writing out gcov information, presumably because that takes |
166 | 166 | * some time) and cause a segfault. | |
167 | printf("\n"); | 167 | */ |
168 | 168 | ||
169 | /* stop timers and set SIG*ALRM to be ignored */ | 169 | /* stop timers and set SIG*ALRM to be ignored */ |
170 | disable_timer(); | 170 | disable_timer(); |
171 | 171 | ||
172 | /* disable SIGIO for the fds and set SIGIO to be ignored */ | 172 | /* disable SIGIO for the fds and set SIGIO to be ignored */ |
173 | err = deactivate_all_fds(); | 173 | err = deactivate_all_fds(); |
174 | if(err) | 174 | if(err) |
175 | printf("deactivate_all_fds failed, errno = %d\n", | 175 | printf("deactivate_all_fds failed, errno = %d\n", -err); |
176 | -err); | ||
177 | 176 | ||
178 | /* Let any pending signals fire now. This ensures | 177 | /* Let any pending signals fire now. This ensures |
179 | * that they won't be delivered after the exec, when | 178 | * that they won't be delivered after the exec, when |
180 | * they are definitely not expected. | 179 | * they are definitely not expected. |
181 | */ | 180 | */ |
182 | unblock_signals(); | 181 | unblock_signals(); |
183 | 182 | ||
183 | /* Reboot */ | ||
184 | if(ret){ | ||
185 | printf("\n"); | ||
184 | execvp(new_argv[0], new_argv); | 186 | execvp(new_argv[0], new_argv); |
185 | perror("Failed to exec kernel"); | 187 | perror("Failed to exec kernel"); |
186 | ret = 1; | 188 | ret = 1; |
diff --git a/arch/um/kernel/process_kern.c b/arch/um/kernel/process_kern.c index c1adf7ba3fd1..804c6bbdf67c 100644 --- a/arch/um/kernel/process_kern.c +++ b/arch/um/kernel/process_kern.c | |||
@@ -43,7 +43,6 @@ | |||
43 | #include "tlb.h" | 43 | #include "tlb.h" |
44 | #include "frame_kern.h" | 44 | #include "frame_kern.h" |
45 | #include "sigcontext.h" | 45 | #include "sigcontext.h" |
46 | #include "2_5compat.h" | ||
47 | #include "os.h" | 46 | #include "os.h" |
48 | #include "mode.h" | 47 | #include "mode.h" |
49 | #include "mode_kern.h" | 48 | #include "mode_kern.h" |
@@ -55,18 +54,6 @@ | |||
55 | */ | 54 | */ |
56 | struct cpu_task cpu_tasks[NR_CPUS] = { [0 ... NR_CPUS - 1] = { -1, NULL } }; | 55 | struct cpu_task cpu_tasks[NR_CPUS] = { [0 ... NR_CPUS - 1] = { -1, NULL } }; |
57 | 56 | ||
58 | struct task_struct *get_task(int pid, int require) | ||
59 | { | ||
60 | struct task_struct *ret; | ||
61 | |||
62 | read_lock(&tasklist_lock); | ||
63 | ret = find_task_by_pid(pid); | ||
64 | read_unlock(&tasklist_lock); | ||
65 | |||
66 | if(require && (ret == NULL)) panic("get_task couldn't find a task\n"); | ||
67 | return(ret); | ||
68 | } | ||
69 | |||
70 | int external_pid(void *t) | 57 | int external_pid(void *t) |
71 | { | 58 | { |
72 | struct task_struct *task = t ? t : current; | 59 | struct task_struct *task = t ? t : current; |
@@ -189,7 +176,6 @@ void default_idle(void) | |||
189 | 176 | ||
190 | while(1){ | 177 | while(1){ |
191 | /* endless idle loop with no priority at all */ | 178 | /* endless idle loop with no priority at all */ |
192 | SET_PRI(current); | ||
193 | 179 | ||
194 | /* | 180 | /* |
195 | * although we are an idle CPU, we do not want to | 181 | * although we are an idle CPU, we do not want to |
@@ -212,11 +198,6 @@ int page_size(void) | |||
212 | return(PAGE_SIZE); | 198 | return(PAGE_SIZE); |
213 | } | 199 | } |
214 | 200 | ||
215 | unsigned long page_mask(void) | ||
216 | { | ||
217 | return(PAGE_MASK); | ||
218 | } | ||
219 | |||
220 | void *um_virt_to_phys(struct task_struct *task, unsigned long addr, | 201 | void *um_virt_to_phys(struct task_struct *task, unsigned long addr, |
221 | pte_t *pte_out) | 202 | pte_t *pte_out) |
222 | { | 203 | { |
@@ -349,11 +330,6 @@ char *uml_strdup(char *string) | |||
349 | return(new); | 330 | return(new); |
350 | } | 331 | } |
351 | 332 | ||
352 | void *get_init_task(void) | ||
353 | { | ||
354 | return(&init_thread_union.thread_info.task); | ||
355 | } | ||
356 | |||
357 | int copy_to_user_proc(void __user *to, void *from, int size) | 333 | int copy_to_user_proc(void __user *to, void *from, int size) |
358 | { | 334 | { |
359 | return(copy_to_user(to, from, size)); | 335 | return(copy_to_user(to, from, size)); |
@@ -480,15 +456,3 @@ unsigned long arch_align_stack(unsigned long sp) | |||
480 | return sp & ~0xf; | 456 | return sp & ~0xf; |
481 | } | 457 | } |
482 | #endif | 458 | #endif |
483 | |||
484 | |||
485 | /* | ||
486 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
487 | * Emacs will notice this stuff at the end of the file and automatically | ||
488 | * adjust the settings for this buffer only. This must remain at the end | ||
489 | * of the file. | ||
490 | * --------------------------------------------------------------------------- | ||
491 | * Local variables: | ||
492 | * c-file-style: "linux" | ||
493 | * End: | ||
494 | */ | ||
diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c index 2925e15324de..71af4d503899 100644 --- a/arch/um/kernel/ptrace.c +++ b/arch/um/kernel/ptrace.c | |||
@@ -322,11 +322,9 @@ void syscall_trace(union uml_pt_regs *regs, int entryexit) | |||
322 | UPT_SYSCALL_ARG2(regs), | 322 | UPT_SYSCALL_ARG2(regs), |
323 | UPT_SYSCALL_ARG3(regs), | 323 | UPT_SYSCALL_ARG3(regs), |
324 | UPT_SYSCALL_ARG4(regs)); | 324 | UPT_SYSCALL_ARG4(regs)); |
325 | else { | 325 | else audit_syscall_exit(current, |
326 | int res = UPT_SYSCALL_RET(regs); | 326 | AUDITSC_RESULT(UPT_SYSCALL_RET(regs)), |
327 | audit_syscall_exit(current, AUDITSC_RESULT(res), | 327 | UPT_SYSCALL_RET(regs)); |
328 | res); | ||
329 | } | ||
330 | } | 328 | } |
331 | 329 | ||
332 | /* Fake a debug trap */ | 330 | /* Fake a debug trap */ |
@@ -356,14 +354,3 @@ void syscall_trace(union uml_pt_regs *regs, int entryexit) | |||
356 | current->exit_code = 0; | 354 | current->exit_code = 0; |
357 | } | 355 | } |
358 | } | 356 | } |
359 | |||
360 | /* | ||
361 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
362 | * Emacs will notice this stuff at the end of the file and automatically | ||
363 | * adjust the settings for this buffer only. This must remain at the end | ||
364 | * of the file. | ||
365 | * --------------------------------------------------------------------------- | ||
366 | * Local variables: | ||
367 | * c-file-style: "linux" | ||
368 | * End: | ||
369 | */ | ||
diff --git a/arch/um/kernel/sysrq.c b/arch/um/kernel/sysrq.c index e630438f9e73..f80850091e79 100644 --- a/arch/um/kernel/sysrq.c +++ b/arch/um/kernel/sysrq.c | |||
@@ -3,6 +3,7 @@ | |||
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include "linux/config.h" | ||
6 | #include "linux/sched.h" | 7 | #include "linux/sched.h" |
7 | #include "linux/kernel.h" | 8 | #include "linux/kernel.h" |
8 | #include "linux/module.h" | 9 | #include "linux/module.h" |
@@ -12,14 +13,14 @@ | |||
12 | #include "sysrq.h" | 13 | #include "sysrq.h" |
13 | #include "user_util.h" | 14 | #include "user_util.h" |
14 | 15 | ||
15 | void show_trace(unsigned long * stack) | 16 | /* Catch non-i386 SUBARCH's. */ |
17 | #if !defined(CONFIG_UML_X86) || defined(CONFIG_64BIT) | ||
18 | void show_trace(struct task_struct *task, unsigned long * stack) | ||
16 | { | 19 | { |
17 | /* XXX: Copy the CONFIG_FRAME_POINTER stack-walking backtrace from | ||
18 | * arch/i386/kernel/traps.c, and then move this to sys-i386/sysrq.c.*/ | ||
19 | unsigned long addr; | 20 | unsigned long addr; |
20 | 21 | ||
21 | if (!stack) { | 22 | if (!stack) { |
22 | stack = (unsigned long*) &stack; | 23 | stack = (unsigned long*) &stack; |
23 | WARN_ON(1); | 24 | WARN_ON(1); |
24 | } | 25 | } |
25 | 26 | ||
@@ -35,6 +36,7 @@ void show_trace(unsigned long * stack) | |||
35 | } | 36 | } |
36 | printk("\n"); | 37 | printk("\n"); |
37 | } | 38 | } |
39 | #endif | ||
38 | 40 | ||
39 | /* | 41 | /* |
40 | * stack dumps generator - this is used by arch-independent code. | 42 | * stack dumps generator - this is used by arch-independent code. |
@@ -44,7 +46,7 @@ void dump_stack(void) | |||
44 | { | 46 | { |
45 | unsigned long stack; | 47 | unsigned long stack; |
46 | 48 | ||
47 | show_trace(&stack); | 49 | show_trace(current, &stack); |
48 | } | 50 | } |
49 | EXPORT_SYMBOL(dump_stack); | 51 | EXPORT_SYMBOL(dump_stack); |
50 | 52 | ||
@@ -59,7 +61,11 @@ void show_stack(struct task_struct *task, unsigned long *esp) | |||
59 | int i; | 61 | int i; |
60 | 62 | ||
61 | if (esp == NULL) { | 63 | if (esp == NULL) { |
62 | if (task != current) { | 64 | if (task != current && task != NULL) { |
65 | /* XXX: Isn't this bogus? I.e. isn't this the | ||
66 | * *userspace* stack of this task? If not so, use this | ||
67 | * even when task == current (as in i386). | ||
68 | */ | ||
63 | esp = (unsigned long *) KSTK_ESP(task); | 69 | esp = (unsigned long *) KSTK_ESP(task); |
64 | /* Which one? No actual difference - just coding style.*/ | 70 | /* Which one? No actual difference - just coding style.*/ |
65 | //esp = (unsigned long *) PT_REGS_IP(&task->thread.regs); | 71 | //esp = (unsigned long *) PT_REGS_IP(&task->thread.regs); |
@@ -77,5 +83,6 @@ void show_stack(struct task_struct *task, unsigned long *esp) | |||
77 | printk("%08lx ", *stack++); | 83 | printk("%08lx ", *stack++); |
78 | } | 84 | } |
79 | 85 | ||
80 | show_trace(esp); | 86 | printk("Call Trace: \n"); |
87 | show_trace(current, esp); | ||
81 | } | 88 | } |
diff --git a/arch/um/kernel/trap_kern.c b/arch/um/kernel/trap_kern.c index 1de22d8a313a..c20aef120598 100644 --- a/arch/um/kernel/trap_kern.c +++ b/arch/um/kernel/trap_kern.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include "kern.h" | 23 | #include "kern.h" |
24 | #include "chan_kern.h" | 24 | #include "chan_kern.h" |
25 | #include "mconsole_kern.h" | 25 | #include "mconsole_kern.h" |
26 | #include "2_5compat.h" | ||
27 | #include "mem.h" | 26 | #include "mem.h" |
28 | #include "mem_kern.h" | 27 | #include "mem_kern.h" |
29 | 28 | ||
diff --git a/arch/um/kernel/tt/process_kern.c b/arch/um/kernel/tt/process_kern.c index df810ca8fc12..776310fd5b8b 100644 --- a/arch/um/kernel/tt/process_kern.c +++ b/arch/um/kernel/tt/process_kern.c | |||
@@ -32,10 +32,6 @@ void *switch_to_tt(void *prev, void *next, void *last) | |||
32 | unsigned long flags; | 32 | unsigned long flags; |
33 | int err, vtalrm, alrm, prof, cpu; | 33 | int err, vtalrm, alrm, prof, cpu; |
34 | char c; | 34 | char c; |
35 | /* jailing and SMP are incompatible, so this doesn't need to be | ||
36 | * made per-cpu | ||
37 | */ | ||
38 | static int reading; | ||
39 | 35 | ||
40 | from = prev; | 36 | from = prev; |
41 | to = next; | 37 | to = next; |
@@ -59,13 +55,11 @@ void *switch_to_tt(void *prev, void *next, void *last) | |||
59 | c = 0; | 55 | c = 0; |
60 | set_current(to); | 56 | set_current(to); |
61 | 57 | ||
62 | reading = 0; | ||
63 | err = os_write_file(to->thread.mode.tt.switch_pipe[1], &c, sizeof(c)); | 58 | err = os_write_file(to->thread.mode.tt.switch_pipe[1], &c, sizeof(c)); |
64 | if(err != sizeof(c)) | 59 | if(err != sizeof(c)) |
65 | panic("write of switch_pipe failed, err = %d", -err); | 60 | panic("write of switch_pipe failed, err = %d", -err); |
66 | 61 | ||
67 | reading = 1; | 62 | if(from->thread.mode.tt.switch_pipe[0] == -1) |
68 | if(from->thread.mode.tt.switch_pipe[0] == -1) | ||
69 | os_kill_process(os_getpid(), 0); | 63 | os_kill_process(os_getpid(), 0); |
70 | 64 | ||
71 | err = os_read_file(from->thread.mode.tt.switch_pipe[0], &c, sizeof(c)); | 65 | err = os_read_file(from->thread.mode.tt.switch_pipe[0], &c, sizeof(c)); |
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index 4d10ec372a67..418427107b29 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c | |||
@@ -111,12 +111,6 @@ struct seq_operations cpuinfo_op = { | |||
111 | .show = show_cpuinfo, | 111 | .show = show_cpuinfo, |
112 | }; | 112 | }; |
113 | 113 | ||
114 | pte_t * __bad_pagetable(void) | ||
115 | { | ||
116 | panic("Someone should implement __bad_pagetable"); | ||
117 | return(NULL); | ||
118 | } | ||
119 | |||
120 | /* Set in linux_main */ | 114 | /* Set in linux_main */ |
121 | unsigned long host_task_size; | 115 | unsigned long host_task_size; |
122 | unsigned long task_size; | 116 | unsigned long task_size; |
diff --git a/arch/um/sys-i386/sysrq.c b/arch/um/sys-i386/sysrq.c index 281fc7b8ca00..e3706d15c4f5 100644 --- a/arch/um/sys-i386/sysrq.c +++ b/arch/um/sys-i386/sysrq.c | |||
@@ -3,12 +3,15 @@ | |||
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include "linux/config.h" | ||
6 | #include "linux/kernel.h" | 7 | #include "linux/kernel.h" |
7 | #include "linux/smp.h" | 8 | #include "linux/smp.h" |
8 | #include "linux/sched.h" | 9 | #include "linux/sched.h" |
10 | #include "linux/kallsyms.h" | ||
9 | #include "asm/ptrace.h" | 11 | #include "asm/ptrace.h" |
10 | #include "sysrq.h" | 12 | #include "sysrq.h" |
11 | 13 | ||
14 | /* This is declared by <linux/sched.h> */ | ||
12 | void show_regs(struct pt_regs *regs) | 15 | void show_regs(struct pt_regs *regs) |
13 | { | 16 | { |
14 | printk("\n"); | 17 | printk("\n"); |
@@ -31,5 +34,80 @@ void show_regs(struct pt_regs *regs) | |||
31 | 0xffff & PT_REGS_DS(regs), | 34 | 0xffff & PT_REGS_DS(regs), |
32 | 0xffff & PT_REGS_ES(regs)); | 35 | 0xffff & PT_REGS_ES(regs)); |
33 | 36 | ||
34 | show_trace((unsigned long *) ®s); | 37 | show_trace(NULL, (unsigned long *) ®s); |
35 | } | 38 | } |
39 | |||
40 | /* Copied from i386. */ | ||
41 | static inline int valid_stack_ptr(struct thread_info *tinfo, void *p) | ||
42 | { | ||
43 | return p > (void *)tinfo && | ||
44 | p < (void *)tinfo + THREAD_SIZE - 3; | ||
45 | } | ||
46 | |||
47 | /* Adapted from i386 (we also print the address we read from). */ | ||
48 | static inline unsigned long print_context_stack(struct thread_info *tinfo, | ||
49 | unsigned long *stack, unsigned long ebp) | ||
50 | { | ||
51 | unsigned long addr; | ||
52 | |||
53 | #ifdef CONFIG_FRAME_POINTER | ||
54 | while (valid_stack_ptr(tinfo, (void *)ebp)) { | ||
55 | addr = *(unsigned long *)(ebp + 4); | ||
56 | printk("%08lx: [<%08lx>]", ebp + 4, addr); | ||
57 | print_symbol(" %s", addr); | ||
58 | printk("\n"); | ||
59 | ebp = *(unsigned long *)ebp; | ||
60 | } | ||
61 | #else | ||
62 | while (valid_stack_ptr(tinfo, stack)) { | ||
63 | addr = *stack; | ||
64 | if (__kernel_text_address(addr)) { | ||
65 | printk("%08lx: [<%08lx>]", (unsigned long) stack, addr); | ||
66 | print_symbol(" %s", addr); | ||
67 | printk("\n"); | ||
68 | } | ||
69 | stack++; | ||
70 | } | ||
71 | #endif | ||
72 | return ebp; | ||
73 | } | ||
74 | |||
75 | void show_trace(struct task_struct* task, unsigned long * stack) | ||
76 | { | ||
77 | unsigned long ebp; | ||
78 | struct thread_info *context; | ||
79 | |||
80 | /* Turn this into BUG_ON if possible. */ | ||
81 | if (!stack) { | ||
82 | stack = (unsigned long*) &stack; | ||
83 | printk("show_trace: got NULL stack, implicit assumption task == current"); | ||
84 | WARN_ON(1); | ||
85 | } | ||
86 | |||
87 | if (!task) | ||
88 | task = current; | ||
89 | |||
90 | if (task != current) { | ||
91 | //ebp = (unsigned long) KSTK_EBP(task); | ||
92 | /* Which one? No actual difference - just coding style.*/ | ||
93 | ebp = (unsigned long) PT_REGS_EBP(&task->thread.regs); | ||
94 | } else { | ||
95 | asm ("movl %%ebp, %0" : "=r" (ebp) : ); | ||
96 | } | ||
97 | |||
98 | context = (struct thread_info *) | ||
99 | ((unsigned long)stack & (~(THREAD_SIZE - 1))); | ||
100 | print_context_stack(context, stack, ebp); | ||
101 | |||
102 | /*while (((long) stack & (THREAD_SIZE-1)) != 0) { | ||
103 | addr = *stack; | ||
104 | if (__kernel_text_address(addr)) { | ||
105 | printk("%08lx: [<%08lx>]", (unsigned long) stack, addr); | ||
106 | print_symbol(" %s", addr); | ||
107 | printk("\n"); | ||
108 | } | ||
109 | stack++; | ||
110 | }*/ | ||
111 | printk("\n"); | ||
112 | } | ||
113 | |||
diff --git a/arch/um/sys-ppc/sysrq.c b/arch/um/sys-ppc/sysrq.c index 82d6e9335bb6..2f816f1a0ff4 100644 --- a/arch/um/sys-ppc/sysrq.c +++ b/arch/um/sys-ppc/sysrq.c | |||
@@ -27,17 +27,5 @@ void show_regs(struct pt_regs_subarch *regs) | |||
27 | 0xffff & regs->xds, 0xffff & regs->xes); | 27 | 0xffff & regs->xds, 0xffff & regs->xes); |
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | show_trace(®s->gpr[1]); | 30 | show_trace(current, ®s->gpr[1]); |
31 | } | 31 | } |
32 | |||
33 | |||
34 | /* | ||
35 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
36 | * Emacs will notice this stuff at the end of the file and automatically | ||
37 | * adjust the settings for this buffer only. This must remain at the end | ||
38 | * of the file. | ||
39 | * --------------------------------------------------------------------------- | ||
40 | * Local variables: | ||
41 | * c-file-style: "linux" | ||
42 | * End: | ||
43 | */ | ||
diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/um/sys-x86_64/syscalls.c index d4a59657fb99..6f44f40204ed 100644 --- a/arch/um/sys-x86_64/syscalls.c +++ b/arch/um/sys-x86_64/syscalls.c | |||
@@ -133,23 +133,27 @@ static long arch_prctl_tt(int code, unsigned long addr) | |||
133 | 133 | ||
134 | #ifdef CONFIG_MODE_SKAS | 134 | #ifdef CONFIG_MODE_SKAS |
135 | 135 | ||
136 | /* XXX: Must also call arch_prctl in the host, beside saving the segment bases! */ | ||
136 | static long arch_prctl_skas(int code, unsigned long addr) | 137 | static long arch_prctl_skas(int code, unsigned long addr) |
137 | { | 138 | { |
138 | long ret = 0; | 139 | long ret = 0; |
139 | 140 | ||
140 | switch(code){ | 141 | switch(code){ |
141 | case ARCH_SET_GS: | ||
142 | current->thread.regs.regs.skas.regs[GS_BASE / sizeof(unsigned long)] = addr; | ||
143 | break; | ||
144 | case ARCH_SET_FS: | 142 | case ARCH_SET_FS: |
145 | current->thread.regs.regs.skas.regs[FS_BASE / sizeof(unsigned long)] = addr; | 143 | current->thread.regs.regs.skas.regs[FS_BASE / sizeof(unsigned long)] = addr; |
146 | break; | 144 | break; |
145 | case ARCH_SET_GS: | ||
146 | current->thread.regs.regs.skas.regs[GS_BASE / sizeof(unsigned long)] = addr; | ||
147 | break; | ||
147 | case ARCH_GET_FS: | 148 | case ARCH_GET_FS: |
148 | ret = put_user(current->thread.regs.regs.skas.regs[GS / sizeof(unsigned long)], &addr); | 149 | ret = put_user(current->thread.regs.regs.skas. |
150 | regs[FS_BASE / sizeof(unsigned long)], | ||
151 | (unsigned long __user *)addr); | ||
149 | break; | 152 | break; |
150 | case ARCH_GET_GS: | 153 | case ARCH_GET_GS: |
151 | ret = put_user(current->thread.regs.regs.skas.regs[FS / sizeof(unsigned \ | 154 | ret = put_user(current->thread.regs.regs.skas. |
152 | long)], &addr); | 155 | regs[GS_BASE / sizeof(unsigned long)], |
156 | (unsigned long __user *)addr); | ||
153 | break; | 157 | break; |
154 | default: | 158 | default: |
155 | ret = -EINVAL; | 159 | ret = -EINVAL; |
diff --git a/arch/um/sys-x86_64/sysrq.c b/arch/um/sys-x86_64/sysrq.c index ddf74691a610..d0a25af19a5b 100644 --- a/arch/um/sys-x86_64/sysrq.c +++ b/arch/um/sys-x86_64/sysrq.c | |||
@@ -36,14 +36,5 @@ void __show_regs(struct pt_regs * regs) | |||
36 | void show_regs(struct pt_regs *regs) | 36 | void show_regs(struct pt_regs *regs) |
37 | { | 37 | { |
38 | __show_regs(regs); | 38 | __show_regs(regs); |
39 | show_trace((unsigned long *) ®s); | 39 | show_trace(current, (unsigned long *) ®s); |
40 | } | 40 | } |
41 | |||
42 | /* Emacs will notice this stuff at the end of the file and automatically | ||
43 | * adjust the settings for this buffer only. This must remain at the end | ||
44 | * of the file. | ||
45 | * --------------------------------------------------------------------------- | ||
46 | * Local variables: | ||
47 | * c-file-style: "linux" | ||
48 | * End: | ||
49 | */ | ||