aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/kernel')
-rw-r--r--arch/um/kernel/exec_kern.c1
-rw-r--r--arch/um/kernel/initrd_kern.c59
-rw-r--r--arch/um/kernel/initrd_user.c46
-rw-r--r--arch/um/kernel/main.c42
-rw-r--r--arch/um/kernel/process.c49
-rw-r--r--arch/um/kernel/process_kern.c36
-rw-r--r--arch/um/kernel/ptrace.c19
-rw-r--r--arch/um/kernel/skas/process_kern.c7
-rw-r--r--arch/um/kernel/sysrq.c21
-rw-r--r--arch/um/kernel/trap_kern.c1
-rw-r--r--arch/um/kernel/tt/process_kern.c8
-rw-r--r--arch/um/kernel/um_arch.c7
12 files changed, 64 insertions, 232 deletions
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 */
17static char *initrd __initdata = NULL;
18
19static 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
38static 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
17int 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..e59f58152678 100644
--- a/arch/um/kernel/main.c
+++ b/arch/um/kernel/main.c
@@ -24,8 +24,6 @@
24#include "mode.h" 24#include "mode.h"
25#include "choose-mode.h" 25#include "choose-mode.h"
26#include "uml-config.h" 26#include "uml-config.h"
27#include "irq_user.h"
28#include "time_user.h"
29#include "os.h" 27#include "os.h"
30 28
31/* Set in set_stklim, which is called from main and __wrap_malloc. 29/* Set in set_stklim, which is called from main and __wrap_malloc.
@@ -71,7 +69,7 @@ static __init void do_uml_initcalls(void)
71 69
72static void last_ditch_exit(int sig) 70static void last_ditch_exit(int sig)
73{ 71{
74 CHOOSE_MODE(kmalloc_ok = 0, (void) 0); 72 kmalloc_ok = 0;
75 signal(SIGINT, SIG_DFL); 73 signal(SIGINT, SIG_DFL);
76 signal(SIGTERM, SIG_DFL); 74 signal(SIGTERM, SIG_DFL);
77 signal(SIGHUP, SIG_DFL); 75 signal(SIGHUP, SIG_DFL);
@@ -87,7 +85,7 @@ int main(int argc, char **argv, char **envp)
87{ 85{
88 char **new_argv; 86 char **new_argv;
89 sigset_t mask; 87 sigset_t mask;
90 int ret, i; 88 int ret, i, err;
91 89
92 /* Enable all signals except SIGIO - in some environments, we can 90 /* Enable all signals except SIGIO - in some environments, we can
93 * enter with some signals blocked 91 * enter with some signals blocked
@@ -160,27 +158,29 @@ int main(int argc, char **argv, char **envp)
160 */ 158 */
161 change_sig(SIGPROF, 0); 159 change_sig(SIGPROF, 0);
162 160
163 /* Reboot */ 161 /* This signal stuff used to be in the reboot case. However,
164 if(ret){ 162 * sometimes a SIGVTALRM can come in when we're halting (reproducably
165 int err; 163 * when writing out gcov information, presumably because that takes
164 * some time) and cause a segfault.
165 */
166 166
167 printf("\n"); 167 /* stop timers and set SIG*ALRM to be ignored */
168 disable_timer();
168 169
169 /* stop timers and set SIG*ALRM to be ignored */ 170 /* disable SIGIO for the fds and set SIGIO to be ignored */
170 disable_timer(); 171 err = deactivate_all_fds();
172 if(err)
173 printf("deactivate_all_fds failed, errno = %d\n", -err);
171 174
172 /* disable SIGIO for the fds and set SIGIO to be ignored */ 175 /* Let any pending signals fire now. This ensures
173 err = deactivate_all_fds(); 176 * that they won't be delivered after the exec, when
174 if(err) 177 * they are definitely not expected.
175 printf("deactivate_all_fds failed, errno = %d\n", 178 */
176 -err); 179 unblock_signals();
177
178 /* Let any pending signals fire now. This ensures
179 * that they won't be delivered after the exec, when
180 * they are definitely not expected.
181 */
182 unblock_signals();
183 180
181 /* Reboot */
182 if(ret){
183 printf("\n");
184 execvp(new_argv[0], new_argv); 184 execvp(new_argv[0], new_argv);
185 perror("Failed to exec kernel"); 185 perror("Failed to exec kernel");
186 ret = 1; 186 ret = 1;
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index 51f8e5a8ac6a..1b5ef3e96c71 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -30,7 +30,6 @@
30#include "init.h" 30#include "init.h"
31#include "os.h" 31#include "os.h"
32#include "uml-config.h" 32#include "uml-config.h"
33#include "ptrace_user.h"
34#include "choose-mode.h" 33#include "choose-mode.h"
35#include "mode.h" 34#include "mode.h"
36#ifdef UML_CONFIG_MODE_SKAS 35#ifdef UML_CONFIG_MODE_SKAS
@@ -131,7 +130,7 @@ int start_fork_tramp(void *thread_arg, unsigned long temp_stack,
131 return(arg.pid); 130 return(arg.pid);
132} 131}
133 132
134static int ptrace_child(void *arg) 133static int ptrace_child(void)
135{ 134{
136 int ret; 135 int ret;
137 int pid = os_getpid(), ppid = getppid(); 136 int pid = os_getpid(), ppid = getppid();
@@ -160,20 +159,16 @@ static int ptrace_child(void *arg)
160 _exit(ret); 159 _exit(ret);
161} 160}
162 161
163static int start_ptraced_child(void **stack_out) 162static int start_ptraced_child(void)
164{ 163{
165 void *stack;
166 unsigned long sp;
167 int pid, n, status; 164 int pid, n, status;
168 165
169 stack = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC, 166 pid = fork();
170 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); 167 if(pid == 0)
171 if(stack == MAP_FAILED) 168 ptrace_child();
172 panic("check_ptrace : mmap failed, errno = %d", errno); 169
173 sp = (unsigned long) stack + PAGE_SIZE - sizeof(void *);
174 pid = clone(ptrace_child, (void *) sp, SIGCHLD, NULL);
175 if(pid < 0) 170 if(pid < 0)
176 panic("check_ptrace : clone failed, errno = %d", errno); 171 panic("check_ptrace : fork failed, errno = %d", errno);
177 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED)); 172 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED));
178 if(n < 0) 173 if(n < 0)
179 panic("check_ptrace : wait failed, errno = %d", errno); 174 panic("check_ptrace : wait failed, errno = %d", errno);
@@ -181,7 +176,6 @@ static int start_ptraced_child(void **stack_out)
181 panic("check_ptrace : expected SIGSTOP, got status = %d", 176 panic("check_ptrace : expected SIGSTOP, got status = %d",
182 status); 177 status);
183 178
184 *stack_out = stack;
185 return(pid); 179 return(pid);
186} 180}
187 181
@@ -189,12 +183,12 @@ static int start_ptraced_child(void **stack_out)
189 * just avoid using sysemu, not panic, but only if SYSEMU features are broken. 183 * just avoid using sysemu, not panic, but only if SYSEMU features are broken.
190 * So only for SYSEMU features we test mustpanic, while normal host features 184 * So only for SYSEMU features we test mustpanic, while normal host features
191 * must work anyway!*/ 185 * must work anyway!*/
192static int stop_ptraced_child(int pid, void *stack, int exitcode, int mustpanic) 186static int stop_ptraced_child(int pid, int exitcode, int mustexit)
193{ 187{
194 int status, n, ret = 0; 188 int status, n, ret = 0;
195 189
196 if(ptrace(PTRACE_CONT, pid, 0, 0) < 0) 190 if(ptrace(PTRACE_CONT, pid, 0, 0) < 0)
197 panic("check_ptrace : ptrace failed, errno = %d", errno); 191 panic("stop_ptraced_child : ptrace failed, errno = %d", errno);
198 CATCH_EINTR(n = waitpid(pid, &status, 0)); 192 CATCH_EINTR(n = waitpid(pid, &status, 0));
199 if(!WIFEXITED(status) || (WEXITSTATUS(status) != exitcode)) { 193 if(!WIFEXITED(status) || (WEXITSTATUS(status) != exitcode)) {
200 int exit_with = WEXITSTATUS(status); 194 int exit_with = WEXITSTATUS(status);
@@ -205,15 +199,13 @@ static int stop_ptraced_child(int pid, void *stack, int exitcode, int mustpanic)
205 printk("check_ptrace : child exited with exitcode %d, while " 199 printk("check_ptrace : child exited with exitcode %d, while "
206 "expecting %d; status 0x%x", exit_with, 200 "expecting %d; status 0x%x", exit_with,
207 exitcode, status); 201 exitcode, status);
208 if (mustpanic) 202 if (mustexit)
209 panic("\n"); 203 panic("\n");
210 else 204 else
211 printk("\n"); 205 printk("\n");
212 ret = -1; 206 ret = -1;
213 } 207 }
214 208
215 if(munmap(stack, PAGE_SIZE) < 0)
216 panic("check_ptrace : munmap failed, errno = %d", errno);
217 return ret; 209 return ret;
218} 210}
219 211
@@ -235,12 +227,11 @@ __uml_setup("nosysemu", nosysemu_cmd_param,
235 227
236static void __init check_sysemu(void) 228static void __init check_sysemu(void)
237{ 229{
238 void *stack;
239 int pid, syscall, n, status, count=0; 230 int pid, syscall, n, status, count=0;
240 231
241 printk("Checking syscall emulation patch for ptrace..."); 232 printk("Checking syscall emulation patch for ptrace...");
242 sysemu_supported = 0; 233 sysemu_supported = 0;
243 pid = start_ptraced_child(&stack); 234 pid = start_ptraced_child();
244 235
245 if(ptrace(PTRACE_SYSEMU, pid, 0, 0) < 0) 236 if(ptrace(PTRACE_SYSEMU, pid, 0, 0) < 0)
246 goto fail; 237 goto fail;
@@ -258,7 +249,7 @@ static void __init check_sysemu(void)
258 panic("check_sysemu : failed to modify system " 249 panic("check_sysemu : failed to modify system "
259 "call return, errno = %d", errno); 250 "call return, errno = %d", errno);
260 251
261 if (stop_ptraced_child(pid, stack, 0, 0) < 0) 252 if (stop_ptraced_child(pid, 0, 0) < 0)
262 goto fail_stopped; 253 goto fail_stopped;
263 254
264 sysemu_supported = 1; 255 sysemu_supported = 1;
@@ -266,7 +257,7 @@ static void __init check_sysemu(void)
266 set_using_sysemu(!force_sysemu_disabled); 257 set_using_sysemu(!force_sysemu_disabled);
267 258
268 printk("Checking advanced syscall emulation patch for ptrace..."); 259 printk("Checking advanced syscall emulation patch for ptrace...");
269 pid = start_ptraced_child(&stack); 260 pid = start_ptraced_child();
270 while(1){ 261 while(1){
271 count++; 262 count++;
272 if(ptrace(PTRACE_SYSEMU_SINGLESTEP, pid, 0, 0) < 0) 263 if(ptrace(PTRACE_SYSEMU_SINGLESTEP, pid, 0, 0) < 0)
@@ -291,7 +282,7 @@ static void __init check_sysemu(void)
291 break; 282 break;
292 } 283 }
293 } 284 }
294 if (stop_ptraced_child(pid, stack, 0, 0) < 0) 285 if (stop_ptraced_child(pid, 0, 0) < 0)
295 goto fail_stopped; 286 goto fail_stopped;
296 287
297 sysemu_supported = 2; 288 sysemu_supported = 2;
@@ -302,18 +293,17 @@ static void __init check_sysemu(void)
302 return; 293 return;
303 294
304fail: 295fail:
305 stop_ptraced_child(pid, stack, 1, 0); 296 stop_ptraced_child(pid, 1, 0);
306fail_stopped: 297fail_stopped:
307 printk("missing\n"); 298 printk("missing\n");
308} 299}
309 300
310void __init check_ptrace(void) 301void __init check_ptrace(void)
311{ 302{
312 void *stack;
313 int pid, syscall, n, status; 303 int pid, syscall, n, status;
314 304
315 printk("Checking that ptrace can change system call numbers..."); 305 printk("Checking that ptrace can change system call numbers...");
316 pid = start_ptraced_child(&stack); 306 pid = start_ptraced_child();
317 307
318 if (ptrace(PTRACE_OLDSETOPTIONS, pid, 0, (void *)PTRACE_O_TRACESYSGOOD) < 0) 308 if (ptrace(PTRACE_OLDSETOPTIONS, pid, 0, (void *)PTRACE_O_TRACESYSGOOD) < 0)
319 panic("check_ptrace: PTRACE_SETOPTIONS failed, errno = %d", errno); 309 panic("check_ptrace: PTRACE_SETOPTIONS failed, errno = %d", errno);
@@ -340,7 +330,7 @@ void __init check_ptrace(void)
340 break; 330 break;
341 } 331 }
342 } 332 }
343 stop_ptraced_child(pid, stack, 0, 1); 333 stop_ptraced_child(pid, 0, 1);
344 printk("OK\n"); 334 printk("OK\n");
345 check_sysemu(); 335 check_sysemu();
346} 336}
@@ -372,11 +362,10 @@ void forward_pending_sigio(int target)
372static inline int check_skas3_ptrace_support(void) 362static inline int check_skas3_ptrace_support(void)
373{ 363{
374 struct ptrace_faultinfo fi; 364 struct ptrace_faultinfo fi;
375 void *stack;
376 int pid, n, ret = 1; 365 int pid, n, ret = 1;
377 366
378 printf("Checking for the skas3 patch in the host..."); 367 printf("Checking for the skas3 patch in the host...");
379 pid = start_ptraced_child(&stack); 368 pid = start_ptraced_child();
380 369
381 n = ptrace(PTRACE_FAULTINFO, pid, 0, &fi); 370 n = ptrace(PTRACE_FAULTINFO, pid, 0, &fi);
382 if (n < 0) { 371 if (n < 0) {
@@ -391,7 +380,7 @@ static inline int check_skas3_ptrace_support(void)
391 } 380 }
392 381
393 init_registers(pid); 382 init_registers(pid);
394 stop_ptraced_child(pid, stack, 1, 1); 383 stop_ptraced_child(pid, 1, 1);
395 384
396 return(ret); 385 return(ret);
397} 386}
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 */
56struct cpu_task cpu_tasks[NR_CPUS] = { [0 ... NR_CPUS - 1] = { -1, NULL } }; 55struct cpu_task cpu_tasks[NR_CPUS] = { [0 ... NR_CPUS - 1] = { -1, NULL } };
57 56
58struct 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
70int external_pid(void *t) 57int 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
215unsigned long page_mask(void)
216{
217 return(PAGE_MASK);
218}
219
220void *um_virt_to_phys(struct task_struct *task, unsigned long addr, 201void *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
352void *get_init_task(void)
353{
354 return(&init_thread_union.thread_info.task);
355}
356
357int copy_to_user_proc(void __user *to, void *from, int size) 333int 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/skas/process_kern.c b/arch/um/kernel/skas/process_kern.c
index ab5d3271da0b..fc71ef295782 100644
--- a/arch/um/kernel/skas/process_kern.c
+++ b/arch/um/kernel/skas/process_kern.c
@@ -68,8 +68,11 @@ void new_thread_handler(int sig)
68 * 0 if it just exits 68 * 0 if it just exits
69 */ 69 */
70 n = run_kernel_thread(fn, arg, &current->thread.exec_buf); 70 n = run_kernel_thread(fn, arg, &current->thread.exec_buf);
71 if(n == 1) 71 if(n == 1){
72 /* Handle any immediate reschedules or signals */
73 interrupt_end();
72 userspace(&current->thread.regs.regs); 74 userspace(&current->thread.regs.regs);
75 }
73 else do_exit(0); 76 else do_exit(0);
74} 77}
75 78
@@ -96,6 +99,8 @@ void fork_handler(int sig)
96 schedule_tail(current->thread.prev_sched); 99 schedule_tail(current->thread.prev_sched);
97 current->thread.prev_sched = NULL; 100 current->thread.prev_sched = NULL;
98 101
102 /* Handle any immediate reschedules or signals */
103 interrupt_end();
99 userspace(&current->thread.regs.regs); 104 userspace(&current->thread.regs.regs);
100} 105}
101 106
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
15void show_trace(unsigned long * stack) 16/* Catch non-i386 SUBARCH's. */
17#if !defined(CONFIG_UML_X86) || defined(CONFIG_64BIT)
18void 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}
49EXPORT_SYMBOL(dump_stack); 51EXPORT_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..8736d098f0ee 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -26,7 +26,6 @@
26#include "asm/setup.h" 26#include "asm/setup.h"
27#include "ubd_user.h" 27#include "ubd_user.h"
28#include "asm/current.h" 28#include "asm/current.h"
29#include "asm/setup.h"
30#include "user_util.h" 29#include "user_util.h"
31#include "kern_util.h" 30#include "kern_util.h"
32#include "kern.h" 31#include "kern.h"
@@ -111,12 +110,6 @@ struct seq_operations cpuinfo_op = {
111 .show = show_cpuinfo, 110 .show = show_cpuinfo,
112}; 111};
113 112
114pte_t * __bad_pagetable(void)
115{
116 panic("Someone should implement __bad_pagetable");
117 return(NULL);
118}
119
120/* Set in linux_main */ 113/* Set in linux_main */
121unsigned long host_task_size; 114unsigned long host_task_size;
122unsigned long task_size; 115unsigned long task_size;