I'm running on a system with no FPU. Now, I've got a program do_float
which seems to work fine. But if I enter:
/bin/echo hello; ./do_float
it terminates with a bus error or FP error. The bug is in exit_thread().
Can anyone explain to me, what good the "cfc1 $0,$31" does?
Here is the patch:
RCS file: /cvs/linux/arch/mips/kernel/process.c,v
retrieving revision 1.36
diff -u -r1.36 process.c
--- process.c 2002/05/29 18:36:28 1.36
+++ process.c 2002/06/06 14:51:32
@@ -54,9 +54,11 @@
void exit_thread(void)
{
/* Forget lazy fpu state */
- if (last_task_used_math == current && mips_cpu.options & MIPS_CPU_FPU) {
- __enable_fpu();
- __asm__ __volatile__("cfc1\t$0,$31");
+ if (last_task_used_math == current) {
+ if (mips_cpu.options & MIPS_CPU_FPU) {
+ __enable_fpu();
+ __asm__ __volatile__("cfc1\t$0,$31");
+ }
last_task_used_math = NULL;
}
}
@@ -64,9 +66,11 @@
void flush_thread(void)
{
/* Forget lazy fpu state */
- if (last_task_used_math == current && mips_cpu.options & MIPS_CPU_FPU) {
- __enable_fpu();
- __asm__ __volatile__("cfc1\t$0,$31");
+ if (last_task_used_math == current) {
+ if (mips_cpu.options & MIPS_CPU_FPU) {
+ __enable_fpu();
+ __asm__ __volatile__("cfc1\t$0,$31");
+ }
last_task_used_math = NULL;
}
}
/Kjeld
--
_ _ ____ ___ Mailto:kjelde@mips.com
|\ /|||___)(___ MIPS Denmark Direct: +45 44 86 55 85
| \/ ||| ____) Lautrupvang 4 B Switch: +45 44 86 55 55
TECHNOLOGIES DK-2750 Ballerup Fax...: +45 44 86 55 56
Denmark http://www.mips.com/
|