floating point problem

mdaljeet@in.ibm.com
Thu, 5 Jul 2001 21:43:07 +0530


In Linux PPC, the MSR[FP] bit (that is floating point available bit) is off
(atleast for non-SMP).

Due to this, whenever some floating point instruction is executed in 'user
mode', it leads to a exception 'FPUnavailable'. The exception handler for
this exception apart from setting the MSR[FP] bit, also sets the MSR[FE0]
and MSR[FE1] bits. These bits basically enables the floating point
exceptions so that if there are some floating point exception conditions
encountered while exeuting a floating point instruction, an appropriate
exception is raised.
But whenever some floating point instruction is executed in 'kernel mode',
'FPUnavailabe' exception handler code does not set the 'MSR[FE0] and
MSR[FE1]' bits.

The result is that when we execute a piece of code that executes floating
point instructions with some large values, we get 'floating point
exceptions for overflow etc' but we get some rounded off values when we
execute the same piece of code in a kernel module. We made a modification
in the head.S file and commented out the setting of 'MSR[FE0] and MSR[FE1]'
bits in the 'FPUnavailable' exception handler for user mode. Due to this we
are getting correct results i.e. rounded off values.

Problem is that we want to get the good results without changing the
kernel. Either by having the user mode application to interact with some
special module which can set the MSR[FP] bit before we execute the floating
point instruction or by some other trick.....Is there any solution apart
from changing the kernel?

thanks,
Daljeet.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/