X-Git-Url: http://rtime.felk.cvut.cz/gitweb/mcf548x/linux.git/blobdiff_plain/698a4555a5744245272c7d7eea04068a57c18914..db6f0eeb987ccb6db01d0ea318700368c26be7bf:/arch/m68k/kernel/process.c diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c index c2a1fc23dd75..760878870e9a 100644 --- a/arch/m68k/kernel/process.c +++ b/arch/m68k/kernel/process.c @@ -184,13 +184,23 @@ EXPORT_SYMBOL(kernel_thread); void flush_thread(void) { - unsigned long zero = 0; + unsigned long zero = 0; set_fs(USER_DS); + +#ifndef CONFIG_COLDFIRE current->thread.fs = __USER_DS; if (!FPU_IS_EMU) asm volatile (".chip 68k/68881\n\t" "frestore %0@\n\t" ".chip 68k" : : "a" (&zero)); +#else + current->thread.fs = USER_DS; + +#ifdef CONFIG_FPU + if (!FPU_IS_EMU) + asm volatile ("frestore %0@\n\t" : : "a" (&zero)); +#endif +#endif } /* @@ -258,6 +268,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, * Must save the current SFC/DFC value, NOT the value when * the parent was last descheduled - RGH 10-08-96 */ +#ifndef CONFIG_COLDFIRE p->thread.fs = get_fs().seg; if (!FPU_IS_EMU) { @@ -272,7 +283,33 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, /* Restore the state in case the fpu was busy */ asm volatile ("frestore %0" : : "m" (p->thread.fpstate[0])); } +#else + p->thread.fs = get_fs(); +#if defined(CONFIG_FPU) + if (!FPU_IS_EMU) { + /* Copy the current fpu state */ + asm volatile ("fsave %0" : : "m" (p->thread.fpstate[0]) + : "memory"); + if (p->thread.fpstate[0]) { + asm volatile ("fmovemd %/fp0-%/fp7,%0" + : : "m" (p->thread.fp[0]) + : "memory"); + asm volatile ("fmovel %/fpiar,%0" + : : "m" (p->thread.fpcntl[0]) + : "memory"); + asm volatile ("fmovel %/fpcr,%0" + : : "m" (p->thread.fpcntl[1]) + : "memory"); + asm volatile ("fmovel %/fpsr,%0" + : : "m" (p->thread.fpcntl[2]) + : "memory"); + } + /* Restore the state in case the fpu was busy */ + asm volatile ("frestore %0" : : "m" (p->thread.fpstate[0])); + } +#endif +#endif return 0; } @@ -297,6 +334,7 @@ int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu) } /* First dump the fpu context to avoid protocol violation. */ +#ifndef CONFIG_COLDFIRE asm volatile ("fsave %0" :: "m" (fpustate[0]) : "memory"); if (!CPU_IS_060 ? !fpustate[0] : !fpustate[2]) return 0; @@ -307,6 +345,25 @@ int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu) asm volatile ("fmovemx %/fp0-%/fp7,%0" :: "m" (fpu->fpregs[0]) : "memory"); +#elif CONFIG_FPU + /* COLDFIRE + FPU */ + asm volatile ("fsave %0" :: "m" (fpustate[0]) : "memory"); + if (!CPU_IS_060 ? !fpustate[0] : !fpustate[2]) + return 0; + + asm volatile ("fmovel %/fpiar,%0" + : : "m" (fpu->fpcntl[0]) + : "memory"); + asm volatile ("fmovel %/fpcr,%0" + : : "m" (fpu->fpcntl[1]) + : "memory"); + asm volatile ("fmovel %/fpsr,%0" + : : "m" (fpu->fpcntl[2]) + : "memory"); + asm volatile ("fmovemd %/fp0-%/fp7,%0" + : : "m" (fpu->fpregs[0]) + : "memory"); +#endif return 1; } EXPORT_SYMBOL(dump_fpu);