Use of floating point in the kernel
Subsystems (2)
Hi
There are a few instances of use of floating point in 2.6,
drivers/media/dvb/ttpci/av7110.c renamed from drivers/media/dvb/ttpci/av7110.c~ +2 -2
@@ -2673,9 +2673,9 @@ buf[1 ] = div &0xff ; buf[2 ] =0x8e ; -if (freq < (u32 )16 *168.25 ) +if (freq <2692 )/* 16*168.25 */ config =0xa0 ; -else if (freq < (u32 )16 *447.25 ) +else if (freq <7156 )/* 16*447.25 */ config =0x90 ;else config =0x30 ;
(If I'm not mistaken a similar patch for this has already been sent to Linus, just making sure the DVB people get this in their trees as well) (u32) (16*168.25) would work too, I suppose.
The other case is a bit more widespread, patch below is mostly rhetoric :-)
http://www.winischhofer.net/linuxsisvga.shtml#download contains the latest version of the sisfb that doesn't use floating point at all, so that is certainly the better option.
drivers/video/sis/sis_main.c renamed from drivers/video/sis/sis_main.c~ +1 -0
@@ -616,6 +616,7 @@ var->left_margin + var->xres + var->right_margin + var->hsync_len;unsigned int vtotal =0 ; +#error Use of floating point in the kernel is NOT safe!double drate =0 , hrate =0 ;int found_mode =0 ;int old_mode;
drivers/video/Kconfig renamed from drivers/video/Kconfig~ +1 -1
@@ -704,7 +704,7 @@ config FB_SIS tristate "SIS acceleration" - depends on FB && PCI + depends on FB && PCI && BROKEN help This is the frame buffer device driver for the SiS 630 and 640 Super Socket 7 UMA cards. Specs available at <http://www.sis.com.tw/>.
Signature · 1 line
Pekka Pietikainen
Quoted 4 lines · Pekka Pietikainen
Hi
There are a few instances of use of floating point in 2.6,
Has anyone considered asking the gcc people to add an -fno-fpu (or -mno-fpu) option, throwing an error if any FP instructions are used?
-hpa
Quoted 2 lines · H. Peter Anvin
Has anyone considered asking the gcc people to add an -fno-fpu (or -mno-fpu) option, throwing an error if any FP instructions are used?
building with -msoft-float gets you this.
Dave
Quoted 7 lines · H. Peter Anvin
Quoted 2 lines · Pekka Pietikainen
There are a few instances of use of floating point in 2.6,
Has anyone considered asking the gcc people to add an -fno-fpu (or -mno-fpu) option, throwing an error if any FP instructions are used?
We really should, but there really are some rare cases where it is actually ok.
In particular, you _can_ do math, if you just do the proper "kernel_fpu_begin()"/"kernel_fpu_end()" around it, and you have reason to believe that you can assume a math processor exists.
Is it needed? I dunno. I'd frown on it in general, but I don't see it being fundamentally wrong under the rigth circumstances.
Linus
Quoted 8 lines · Linus Torvalds
We really should, but there really are some rare cases where it is actually ok.
In particular, you _can_ do math, if you just do the proper
"kernel_fpu_begin()"/"kernel_fpu_end()" around it, and you have reason to believe that you can assume a math processor exists.Is it needed? I dunno. I'd frown on it in general, but I don't see it being fundamentally wrong under the rigth circumstances.
Sure; however, perhaps those can be marked separately in the Makefile.
-hpa