diff options
Diffstat (limited to 'arch/sh/kernel/process_32.c')
-rw-r--r-- | arch/sh/kernel/process_32.c | 81 |
1 files changed, 7 insertions, 74 deletions
diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c index b965f0282c7d..ddafbbbab2ab 100644 --- a/arch/sh/kernel/process_32.c +++ b/arch/sh/kernel/process_32.c | |||
@@ -32,65 +32,8 @@ | |||
32 | #include <asm/fpu.h> | 32 | #include <asm/fpu.h> |
33 | #include <asm/syscalls.h> | 33 | #include <asm/syscalls.h> |
34 | 34 | ||
35 | static int hlt_counter; | ||
36 | int ubc_usercnt = 0; | 35 | int ubc_usercnt = 0; |
37 | 36 | ||
38 | void (*pm_idle)(void); | ||
39 | void (*pm_power_off)(void); | ||
40 | EXPORT_SYMBOL(pm_power_off); | ||
41 | |||
42 | static int __init nohlt_setup(char *__unused) | ||
43 | { | ||
44 | hlt_counter = 1; | ||
45 | return 1; | ||
46 | } | ||
47 | __setup("nohlt", nohlt_setup); | ||
48 | |||
49 | static int __init hlt_setup(char *__unused) | ||
50 | { | ||
51 | hlt_counter = 0; | ||
52 | return 1; | ||
53 | } | ||
54 | __setup("hlt", hlt_setup); | ||
55 | |||
56 | static void default_idle(void) | ||
57 | { | ||
58 | if (!hlt_counter) { | ||
59 | clear_thread_flag(TIF_POLLING_NRFLAG); | ||
60 | smp_mb__after_clear_bit(); | ||
61 | set_bl_bit(); | ||
62 | while (!need_resched()) | ||
63 | cpu_sleep(); | ||
64 | clear_bl_bit(); | ||
65 | set_thread_flag(TIF_POLLING_NRFLAG); | ||
66 | } else | ||
67 | while (!need_resched()) | ||
68 | cpu_relax(); | ||
69 | } | ||
70 | |||
71 | void cpu_idle(void) | ||
72 | { | ||
73 | set_thread_flag(TIF_POLLING_NRFLAG); | ||
74 | |||
75 | /* endless idle loop with no priority at all */ | ||
76 | while (1) { | ||
77 | void (*idle)(void) = pm_idle; | ||
78 | |||
79 | if (!idle) | ||
80 | idle = default_idle; | ||
81 | |||
82 | tick_nohz_stop_sched_tick(1); | ||
83 | while (!need_resched()) | ||
84 | idle(); | ||
85 | tick_nohz_restart_sched_tick(); | ||
86 | |||
87 | preempt_enable_no_resched(); | ||
88 | schedule(); | ||
89 | preempt_disable(); | ||
90 | check_pgt_cache(); | ||
91 | } | ||
92 | } | ||
93 | |||
94 | void machine_restart(char * __unused) | 37 | void machine_restart(char * __unused) |
95 | { | 38 | { |
96 | /* SR.BL=1 and invoke address error to let CPU reset (manual reset) */ | 39 | /* SR.BL=1 and invoke address error to let CPU reset (manual reset) */ |
@@ -115,8 +58,8 @@ void machine_power_off(void) | |||
115 | void show_regs(struct pt_regs * regs) | 58 | void show_regs(struct pt_regs * regs) |
116 | { | 59 | { |
117 | printk("\n"); | 60 | printk("\n"); |
118 | printk("Pid : %d, Comm: %20s\n", task_pid_nr(current), current->comm); | 61 | printk("Pid : %d, Comm: \t\t%s\n", task_pid_nr(current), current->comm); |
119 | printk("CPU : %d %s (%s %.*s)\n", | 62 | printk("CPU : %d \t\t%s (%s %.*s)\n\n", |
120 | smp_processor_id(), print_tainted(), init_utsname()->release, | 63 | smp_processor_id(), print_tainted(), init_utsname()->release, |
121 | (int)strcspn(init_utsname()->version, " "), | 64 | (int)strcspn(init_utsname()->version, " "), |
122 | init_utsname()->version); | 65 | init_utsname()->version); |
@@ -148,26 +91,16 @@ void show_regs(struct pt_regs * regs) | |||
148 | regs->mach, regs->macl, regs->gbr, regs->pr); | 91 | regs->mach, regs->macl, regs->gbr, regs->pr); |
149 | 92 | ||
150 | show_trace(NULL, (unsigned long *)regs->regs[15], regs); | 93 | show_trace(NULL, (unsigned long *)regs->regs[15], regs); |
94 | show_code(regs); | ||
151 | } | 95 | } |
152 | 96 | ||
153 | /* | 97 | /* |
154 | * Create a kernel thread | 98 | * Create a kernel thread |
155 | */ | 99 | */ |
156 | 100 | ATTRIB_NORET void kernel_thread_helper(void *arg, int (*fn)(void *)) | |
157 | /* | 101 | { |
158 | * This is the mechanism for creating a new kernel thread. | 102 | do_exit(fn(arg)); |
159 | * | 103 | } |
160 | */ | ||
161 | extern void kernel_thread_helper(void); | ||
162 | __asm__(".align 5\n" | ||
163 | "kernel_thread_helper:\n\t" | ||
164 | "jsr @r5\n\t" | ||
165 | " nop\n\t" | ||
166 | "mov.l 1f, r1\n\t" | ||
167 | "jsr @r1\n\t" | ||
168 | " mov r0, r4\n\t" | ||
169 | ".align 2\n\t" | ||
170 | "1:.long do_exit"); | ||
171 | 104 | ||
172 | /* Don't use this in BL=1(cli). Or else, CPU resets! */ | 105 | /* Don't use this in BL=1(cli). Or else, CPU resets! */ |
173 | int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) | 106 | int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) |