diff options
Diffstat (limited to 'arch/um/kernel/reboot.c')
-rw-r--r-- | arch/um/kernel/reboot.c | 57 |
1 files changed, 25 insertions, 32 deletions
diff --git a/arch/um/kernel/reboot.c b/arch/um/kernel/reboot.c index 7e4305a1fd3c..04cebcf0679f 100644 --- a/arch/um/kernel/reboot.c +++ b/arch/um/kernel/reboot.c | |||
@@ -1,60 +1,53 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2000, 2002 Jeff Dike (jdike@karaya.com) | 2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include "linux/module.h" | ||
7 | #include "linux/sched.h" | 6 | #include "linux/sched.h" |
8 | #include "asm/smp.h" | ||
9 | #include "kern_util.h" | ||
10 | #include "kern.h" | ||
11 | #include "os.h" | 7 | #include "os.h" |
12 | #include "mode.h" | 8 | #include "skas.h" |
13 | #include "choose-mode.h" | ||
14 | 9 | ||
15 | void (*pm_power_off)(void); | 10 | void (*pm_power_off)(void); |
16 | 11 | ||
17 | #ifdef CONFIG_SMP | ||
18 | static void kill_idlers(int me) | ||
19 | { | ||
20 | #ifdef CONFIG_MODE_TT | ||
21 | struct task_struct *p; | ||
22 | int i; | ||
23 | |||
24 | for(i = 0; i < ARRAY_SIZE(idle_threads); i++){ | ||
25 | p = idle_threads[i]; | ||
26 | if((p != NULL) && (p->thread.mode.tt.extern_pid != me)) | ||
27 | os_kill_process(p->thread.mode.tt.extern_pid, 0); | ||
28 | } | ||
29 | #endif | ||
30 | } | ||
31 | #endif | ||
32 | |||
33 | static void kill_off_processes(void) | 12 | static void kill_off_processes(void) |
34 | { | 13 | { |
35 | CHOOSE_MODE(kill_off_processes_tt(), kill_off_processes_skas()); | 14 | if(proc_mm) |
36 | #ifdef CONFIG_SMP | 15 | /* |
37 | kill_idlers(os_getpid()); | 16 | * FIXME: need to loop over userspace_pids |
38 | #endif | 17 | */ |
18 | os_kill_ptraced_process(userspace_pid[0], 1); | ||
19 | else { | ||
20 | struct task_struct *p; | ||
21 | int pid, me; | ||
22 | |||
23 | me = os_getpid(); | ||
24 | for_each_process(p){ | ||
25 | if(p->mm == NULL) | ||
26 | continue; | ||
27 | |||
28 | pid = p->mm->context.id.u.pid; | ||
29 | os_kill_ptraced_process(pid, 1); | ||
30 | } | ||
31 | } | ||
39 | } | 32 | } |
40 | 33 | ||
41 | void uml_cleanup(void) | 34 | void uml_cleanup(void) |
42 | { | 35 | { |
43 | kmalloc_ok = 0; | 36 | kmalloc_ok = 0; |
44 | do_uml_exitcalls(); | 37 | do_uml_exitcalls(); |
45 | kill_off_processes(); | 38 | kill_off_processes(); |
46 | } | 39 | } |
47 | 40 | ||
48 | void machine_restart(char * __unused) | 41 | void machine_restart(char * __unused) |
49 | { | 42 | { |
50 | uml_cleanup(); | 43 | uml_cleanup(); |
51 | CHOOSE_MODE(reboot_tt(), reboot_skas()); | 44 | reboot_skas(); |
52 | } | 45 | } |
53 | 46 | ||
54 | void machine_power_off(void) | 47 | void machine_power_off(void) |
55 | { | 48 | { |
56 | uml_cleanup(); | 49 | uml_cleanup(); |
57 | CHOOSE_MODE(halt_tt(), halt_skas()); | 50 | halt_skas(); |
58 | } | 51 | } |
59 | 52 | ||
60 | void machine_halt(void) | 53 | void machine_halt(void) |