How to use floating point in a module?

ndiamond_at_despammed.com
Date: 05/31/04

  • Next message: Måns Rullgård: "Re: How to use floating point in a module?"
    Date:	Sun, 30 May 2004 20:52:23 -0500 (CDT)
    To: linux-kernel@vger.kernel.org
    
    

    A driver, implemented as a module, must do some floating-point computations including trig functions. Fortunately the architecture is x86. A few hundred kilograms of searching (almost a ton of searching :-) seems to reveal the following possibilities.

    Recompile GNU's libc with option "--without-fp". If I understand correctly, the resulting libc will completely avoid using floating-point hardware while providing floating-point computations to its client. Do I understand correctly?

    Compile the module's .c files with gcc's "-msoft-float" option and "-D__NO_MATH_INLINES". (Actually I think "-D__NO_MATH_INLINES" is probably unnecessary here.)

    Link the module's .o files with the version of libc produced above, and try to get a loadable .ko from this... or a loadable .o since the target is still kernel 2.4.something.

    But I'm sure there must be a ton of pitfalls that I'm not seeing here. I'm not the first poor slob who got tasked with shoving some floating-point into a module. My searches found a few tricks that people used for a few floating-point operations, but they used the real floating-point hardware and they didn't really reveal all the trickery they used. (Not that I can blame them, since the hackery they did must be virtually unteachable.) I didn't find anyone saying that they found a safe method of doing it, whether or not a safe method might somewhat resemble the ideas I've just presented. I didn't find anyone saying they got trig functions into it either. If my ideas could possibly work, surely they would have been done already. So, what am I missing?

    And does anyone know a really safe method?
    -
    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/


  • Next message: Måns Rullgård: "Re: How to use floating point in a module?"

    Relevant Pages

    • Re: Why is hotplug a kernel helper?
      ... > I would suggest reading this post from Linus for a quick summary: ... searching, since all the keywords I searched for were in the ... send the line "unsubscribe linux-kernel" in ... More majordomo info at http://vger.kernel.org/majordomo-info.html ...
      (Linux-Kernel)
    • Re: [PATCH 2.6.11.2 1/1] PCI Allow OutOfRange PIRQ table address
      ... You could make it even prettier: ... Should we fall back to searching if someone's specified an address? ... a cut above most of the patches I review;-) ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: 2.6.10-rc2-mm3 [was: Re: 2.6.9-rc2: "kernel BUG at mm/rmap.c:473!"]
      ... Thanks for the report. ... I'm still searching for something useful ... The atomic counter underflow in do_exit does suggest corruption ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [BKPATCH] ACPI for 2.4
      ... Replying to myself... ... Searching for _PTS on google directed me to the ACPI spec. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • ISO9660 file size limitation
      ... I just came across this today after burning backups to dvd-r. ... After searching a little bit ... Lab tests show that use of micro$oft causes cancer in lab animals ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)