Skip to contentSkip to conversation

Floating Point Operation in Kernel

DISCUSSION jimmy liu 5 participants 6 messages Dec 12, 2006 – Dec 15, 2006

lore
Share & tools
lore

jimmy liu

author
#0 lore raw

I am writing a module which need be integrated to the linux kernel with floating point operations for mpc82xx. The kernel does not provide support for floating point operations. Does anybody have good idea to implement it or make it to work around?

____________________________________________________________________________________
Yahoo! Music Unlimited
Access over 1 million songs.
http://music.yahoo.com/unlimited

#1 lore raw
Quoted 5 lines · jimmy liu

I am writing a module which need be integrated to the linux kernel with floating point operations for mpc82xx. The kernel does not provide support for floating point operations. Does anybody have good idea to implement it or make it to work around?

The official answer is: "Don't do that." :)

Here's the more generous reply: The kernel explicitly does not support floating point in the kernel. Save/restore on floating point registers is expensive. In fact, IIRC, floating point registers for user space use 'lazy save/restore'; ie. the registers are not saved on every context switch; they are only saved if another user space process tries to perform FP operations.

To support FP access in kernel space means you must fit your code into the already complex FP save/restore state machine; or you need to disable all interrupts and perform your own FP register save/restore within the context of your driver. And it's a pretty safe bet that you'll have trouble getting the driver into mainline.

Why do you need kernel space FP?

Signature · 4 lines
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
[email protected]
(403) 399-0195
#2 lore raw
In reply to jimmy liu
Quoted 9 lines · jimmy liu

I am writing a module which need be integrated to the linux kernel with floating point operations for mpc82xx. The kernel does not provide support for floating point operations. Does anybody have good idea to implement it or make it to work around?

Quoted 10 lines

____________________________________________________________________________________
Yahoo! Music Unlimited
Access over 1 million songs.
http://music.yahoo.com/unlimited
_______________________________________________
Linuxppc-embedded mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-embedded

What exactly is the floating point operation you need to implement ?

Carlos

Signature · 2 lines
There are two rules for success in life:
1) Never tell everything you know.
author
#3 lore raw

We has a hardware driver need the floating point operation to do timing recover. Maybe, we have to do it in user space.

Quoted 22 lines · --- Carlos Munoz
Quoted 1 line · jimmy liu

I am writing a module which need be integrated to

the

Quoted 3 lines

linux kernel with floating point operations for
mpc82xx. The kernel does not provide support for
floating point operations. Does anybody have good

idea

Quoted 5 lines

to implement it or make it to work around?

____________________________________________________________________________________

Quoted 6 lines

Yahoo! Music Unlimited
Access over 1 million songs.
http://music.yahoo.com/unlimited
_______________________________________________
Linuxppc-embedded mailing list
[email protected]

Quoted 14 lines

https://ozlabs.org/mailman/listinfo/linuxppc-embedded

Quoted 2 lines

What exactly is the floating point operation you
need to implement ?

Carlos

Signature · 2 lines
There are two rules for success in life:
1) Never tell everything you know.

____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com

#4 lore raw
Quoted 4 lines · jimmy liu

We has a hardware driver need the floating point operation to do timing recover. Maybe, we have to do it in user space.

Have you considered doing the math in fixed point instead? I realize that certain data sets make this difficult but this has been a standard technique in resource-constrained systems forever.

regards,
Ben

#5 lore raw
In reply to jimmy liu
Quoted 5 lines · jimmy liu

I am writing a module which need be integrated to the linux kernel with floating point operations for mpc82xx. The kernel does not provide support for floating point operations. Does anybody have good idea to implement it or make it to work around?

How about my fixed point routines. They use S31.32 fixed format, which is often better precision than using floats, though it has less range. Awkward to use, but handy when you absolutely need to.

I originally wrote it for MP3 decoding on ARM, but it should be portable to anything supporting "signed long long" format (hence the name). http://cvs.isoar.ca/math-sll/

--
Andrew E. Mileski