From: ndiamond@despammed.com
To: linux-kernel@vger.kernel.org
Subject: How to use floating point in a module?
Date: Sun, 30 May 2004 20:52:23 -0500 (CDT) [thread overview]
Message-ID: <200405310152.i4V1qNk03732@mailout.despammed.com> (raw)
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?
next reply other threads:[~2004-05-31 2:05 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-31 1:52 ndiamond [this message]
2004-05-31 2:18 ` Måns Rullgård
2004-05-30 22:39 ` Calvin Spealman
2004-05-31 4:28 ` Linus Torvalds
2004-05-31 3:57 ` Calvin Spealman
2004-05-31 3:59 ` Matt Mackall
2004-05-31 4:11 ` Stephen Smoogen
2004-05-31 14:55 ` Scott Robert Ladd
2004-06-01 2:11 ` Richard B. Johnson
2004-05-31 2:50 ndiamond
2004-05-31 4:02 ` Chris Friesen
2004-05-31 5:44 ` Ian Kent
2004-05-31 6:13 ` Peter Williams
2004-05-31 13:39 ` Horst von Brand
2004-05-31 20:12 ` Michal Jaegermann
2004-05-31 20:23 ` Hugo Mills
2004-05-31 22:43 ` Peter Williams
2004-05-31 20:38 Manfred Spraul
2004-05-31 21:11 ` Horst von Brand
2004-06-01 0:38 ndiamond
2004-06-01 20:52 ` H. Peter Anvin
2004-06-01 2:27 ndiamond
2004-06-02 5:52 ndiamond
2004-06-02 19:31 ` Valdis.Kletnieks
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200405310152.i4V1qNk03732@mailout.despammed.com \
--to=ndiamond@despammed.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®