On Thu, 2002-04-18 at 18:57, Oleg Goldshmidt wrote:
> 
> [Context: some time ago I asked about using libm functions such as
> exp, log, pow in a kernel module]
> 
> Shlomi Fish <[EMAIL PROTECTED]> writes:
> 
> > 1. Rip the i386's log implementation from glibc and use it for i386
> > modules. It was very hard.
> 
> Actually, it occured to me that if I needed an exponent I could
> 
> ar x /usr/lib/libm.a e_exp.o
> 
> and then
> 
> ld -m elf_i386 -r -o mymath.o my_math.o e_exp.o
> 
> where my_math.c containes initialization and cleanup - this seems to
> work just fine, and saves me quite a bit of assembly-level headache
> associated with ripping glibc code to pieces.
> 
> Other libm functions may be added in a similar manner.

DANGER WILL ROBINSON!

Depending on the specific functions used, the place and time you use
them etc. you *might* be munging the FPU context while doing this. The
results may vary between nothing at all to producing the most horrid and
inexplainable bugs known to men (and some women too) in seemlingly
unrelated userspace proccesses that happen to use the FPU.

Thus spake Rusty (of ipchains/tables fame):
http://kernelnewbies.org/documents/kdoc/kernel-hacking/basic-rules.html

Gilad.

-- 
Gilad Ben-Yossef <[EMAIL PROTECTED]>
Code mangler, senior coffee drinker and VP SIGSEGV
Qlusters ltd.

"To err is human. To realy fsck up you need a computer. For
 those really large scale disastears, an SSI cluster is a must."





=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to