lkml.org 
[lkml]   [2011]   [Nov]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectFloating point usage inside kernel
Hi,

This question has probably bean discussed for several times in this list
but the information I found googling around is inconclusive to me.

I'm implementing a kernel input driver and I have successfully achieved
my goal for at least 75%.

Since I understand that kernel floating point usage is discouraged I
have converted most of my code to use integers. I knew that kernel
floating point usage was already discouraged in Windows but could be
done by saving floating point unit state.

However, there is a small part of my code that really needs floating
point calculations and it's conversion to integer is not being trivial.

Since that part of the code is not done intensively and since I have
already found information that leads me to believe that the same is
possible, that is, saving fpu state and successfully achieve floating
point calculation on kernel.

I found this article on the internet which deeply explains fpu usage in
kernel:

http://www.linuxsmiths.com/blog/?p=253

As a conclusion, the article says that if we need to use floating point
calculations in kernel, it is possible if we keep the state of the fpu
unit with the following calls:

*/kernel_fpu_begin()
/**/kernel_fpu_end()

We also need to use the compiler flag -mhard-float

But when I compile I get:

error: implicit declaration of function ‘kernel_fpu_begin’
[-Werror=implicit-function-declaration]
error: implicit declaration of function ‘kernel_fpu_end’
[-Werror=implicit-function-declaration]

Doing a grep -r kernel_fpu_begin * on kernel source dir I can find
several references to this functions but not them is included in the
include dir. Which include do I need to have this functions found in
compile time?

Am I even sailing in the right direction? Is this really possible or am
I wasting my time?

I'm new to kernel programming and this is not a trivial issue for me. I
hope you understand.

Thanks,

With my best regards,

Nuno Santos
/*
--
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/

\
 
 \ /
  Last update: 2011-11-25 12:25    [W:0.083 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site