sh: Fix up DSP context save/restore.
[safe/jmp/linux-2.6] / arch / sh / kernel / process_32.c
index 130817a..0747fab 100644 (file)
@@ -97,21 +97,10 @@ void show_regs(struct pt_regs * regs)
 /*
  * Create a kernel thread
  */
-
-/*
- * This is the mechanism for creating a new kernel thread.
- *
- */
-extern void kernel_thread_helper(void);
-__asm__(".align 5\n"
-       "kernel_thread_helper:\n\t"
-       "jsr    @r5\n\t"
-       " nop\n\t"
-       "mov.l  1f, r1\n\t"
-       "jsr    @r1\n\t"
-       " mov   r0, r4\n\t"
-       ".align 2\n\t"
-       "1:.long do_exit");
+ATTRIB_NORET void kernel_thread_helper(void *arg, int (*fn)(void *))
+{
+       do_exit(fn(arg));
+}
 
 /* Don't use this in BL=1(cli).  Or else, CPU resets! */
 int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
@@ -187,14 +176,26 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
 {
        struct thread_info *ti = task_thread_info(p);
        struct pt_regs *childregs;
-#if defined(CONFIG_SH_FPU)
+#if defined(CONFIG_SH_FPU) || defined(CONFIG_SH_DSP)
        struct task_struct *tsk = current;
+#endif
 
+#if defined(CONFIG_SH_FPU)
        unlazy_fpu(tsk, regs);
        p->thread.fpu = tsk->thread.fpu;
        copy_to_stopped_child_used_math(p);
 #endif
 
+#if defined(CONFIG_SH_DSP)
+       if (is_dsp_enabled(tsk)) {
+               /* We can use the __save_dsp or just copy the struct:
+                * __save_dsp(p);
+                * p->thread.dsp_status.status |= SR_DSP
+                */
+               p->thread.dsp_status = tsk->thread.dsp_status;
+       }
+#endif
+
        childregs = task_pt_regs(p);
        *childregs = *regs;