aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/kernel/process.c')
-rw-r--r--arch/sh/kernel/process.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c
index f2031314cb2b..0b1d5dd7a93b 100644
--- a/arch/sh/kernel/process.c
+++ b/arch/sh/kernel/process.c
@@ -81,16 +81,6 @@ void cpu_idle(void)
81 81
82void machine_restart(char * __unused) 82void machine_restart(char * __unused)
83{ 83{
84
85#ifdef CONFIG_KEXEC
86 struct kimage *image;
87 image = xchg(&kexec_image, 0);
88 if (image) {
89 machine_shutdown();
90 machine_kexec(image);
91 }
92#endif
93
94 /* SR.BL=1 and invoke address error to let CPU reset (manual reset) */ 84 /* SR.BL=1 and invoke address error to let CPU reset (manual reset) */
95 asm volatile("ldc %0, sr\n\t" 85 asm volatile("ldc %0, sr\n\t"
96 "mov.l @%1, %0" : : "r" (0x10000000), "r" (0x80000001)); 86 "mov.l @%1, %0" : : "r" (0x10000000), "r" (0x80000001));
@@ -263,6 +253,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
263 unsigned long unused, 253 unsigned long unused,
264 struct task_struct *p, struct pt_regs *regs) 254 struct task_struct *p, struct pt_regs *regs)
265{ 255{
256 struct thread_info *ti = task_thread_info(p);
266 struct pt_regs *childregs; 257 struct pt_regs *childregs;
267#if defined(CONFIG_SH_FPU) 258#if defined(CONFIG_SH_FPU)
268 struct task_struct *tsk = current; 259 struct task_struct *tsk = current;
@@ -277,8 +268,10 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
277 268
278 if (user_mode(regs)) { 269 if (user_mode(regs)) {
279 childregs->regs[15] = usp; 270 childregs->regs[15] = usp;
271 ti->addr_limit = USER_DS;
280 } else { 272 } else {
281 childregs->regs[15] = (unsigned long)task_stack_page(p) + THREAD_SIZE; 273 childregs->regs[15] = (unsigned long)task_stack_page(p) + THREAD_SIZE;
274 ti->addr_limit = KERNEL_DS;
282 } 275 }
283 if (clone_flags & CLONE_SETTLS) { 276 if (clone_flags & CLONE_SETTLS) {
284 childregs->gbr = childregs->regs[0]; 277 childregs->gbr = childregs->regs[0];
@@ -299,13 +292,15 @@ ubc_set_tracing(int asid, unsigned long pc)
299{ 292{
300 ctrl_outl(pc, UBC_BARA); 293 ctrl_outl(pc, UBC_BARA);
301 294
295#ifdef CONFIG_MMU
302 /* We don't have any ASID settings for the SH-2! */ 296 /* We don't have any ASID settings for the SH-2! */
303 if (cpu_data->type != CPU_SH7604) 297 if (cpu_data->type != CPU_SH7604)
304 ctrl_outb(asid, UBC_BASRA); 298 ctrl_outb(asid, UBC_BASRA);
299#endif
305 300
306 ctrl_outl(0, UBC_BAMRA); 301 ctrl_outl(0, UBC_BAMRA);
307 302
308 if (cpu_data->type == CPU_SH7729) { 303 if (cpu_data->type == CPU_SH7729 || cpu_data->type == CPU_SH7710) {
309 ctrl_outw(BBR_INST | BBR_READ | BBR_CPU, UBC_BBRA); 304 ctrl_outw(BBR_INST | BBR_READ | BBR_CPU, UBC_BBRA);
310 ctrl_outl(BRCR_PCBA | BRCR_PCTE, UBC_BRCR); 305 ctrl_outl(BRCR_PCBA | BRCR_PCTE, UBC_BRCR);
311 } else { 306 } else {
@@ -344,6 +339,7 @@ struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *ne
344 } 339 }
345#endif 340#endif
346 341
342#ifdef CONFIG_MMU
347 /* 343 /*
348 * Restore the kernel mode register 344 * Restore the kernel mode register
349 * k7 (r7_bank1) 345 * k7 (r7_bank1)
@@ -351,19 +347,21 @@ struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *ne
351 asm volatile("ldc %0, r7_bank" 347 asm volatile("ldc %0, r7_bank"
352 : /* no output */ 348 : /* no output */
353 : "r" (task_thread_info(next))); 349 : "r" (task_thread_info(next)));
350#endif
354 351
355#ifdef CONFIG_MMU
356 /* If no tasks are using the UBC, we're done */ 352 /* If no tasks are using the UBC, we're done */
357 if (ubc_usercnt == 0) 353 if (ubc_usercnt == 0)
358 /* If no tasks are using the UBC, we're done */; 354 /* If no tasks are using the UBC, we're done */;
359 else if (next->thread.ubc_pc && next->mm) { 355 else if (next->thread.ubc_pc && next->mm) {
360 ubc_set_tracing(next->mm->context & MMU_CONTEXT_ASID_MASK, 356 int asid = 0;
361 next->thread.ubc_pc); 357#ifdef CONFIG_MMU
358 asid |= next->mm->context.id & MMU_CONTEXT_ASID_MASK;
359#endif
360 ubc_set_tracing(asid, next->thread.ubc_pc);
362 } else { 361 } else {
363 ctrl_outw(0, UBC_BBRA); 362 ctrl_outw(0, UBC_BBRA);
364 ctrl_outw(0, UBC_BBRB); 363 ctrl_outw(0, UBC_BBRB);
365 } 364 }
366#endif
367 365
368 return prev; 366 return prev;
369} 367}