Messages in this thread | | | Date | Mon, 31 May 2004 19:38:59 -0500 (CDT) | From | ndiamond@despamme ... | Subject | Re: How to use floating point in a module? |
| |
In http://www.ussg.iu.edu/hypermail/linux/kernel/0405.3/1620.html, Linus Torvalds wrote:
> You can do it "safely" on x86 using > kernel_fpu_begin(); > ... > kernel_fpu_end(); > and make sure that _all_ the FP stuff is in between those two things, and > that you don't do _anything_ that might fault or sleep.
In http://www.uwsg.iu.edu/hypermail/linux/kernel/0202.1/1591.html, Alan Cox two years ago advised another questioner that init_fpu() could be called after kernel_fpu_begin(). Looking at the source code, this seems like a good idea.
Since the kernel is 2.4. 20something, init_fpu() takes no arguments.
I am looking at directory linux/arch/i386/kernel, with file i387.c containing functions kernel_fpu_begin() and init_fpu() and others, file i387.o resulting from a compilation, and Makefile saying that i387 is included in the obj-y list. So it seems to me that the executing kernel should have kernel_fpu_begin() and init_fpu() built in.
But when we do insmod on our module, the list of undefined symbols includes kernel_fpu_begin and init_fpu. How is this possible?
(The CPU is an i686. I'll have to look up its opcodes and see if its hardware will come close enough for everything the driver needs. If it doesn't, I'll buy one of the books that some others kindly recommended and do polynomial approximations.) (By the way the driver is being ported from VxWorks, where it seems that the kernel can do floating point including trig, logarithms, etc.)
- 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/
| |